Python PyQt5.QtWidgets 模块,QWidget() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt5.QtWidgets.QWidget()

项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def setupUi(self, Window):
        Window.setObjectName("Window")
        Window.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(Window)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setContentsMargins(-1, 4, -1, 4)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.webView = QtWebKitWidgets.QWebView(self.centralwidget)
        self.webView.setUrl(QtCore.QUrl("http://qt.nokia.com/"))
        self.webView.setObjectName("webView")
        self.verticalLayout_2.addWidget(self.webView)
        Window.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(Window)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 27))
        self.menubar.setObjectName("menubar")
        Window.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(Window)
        self.statusbar.setObjectName("statusbar")
        Window.setStatusBar(self.statusbar)
        self.dockWidget = QtWidgets.QDockWidget(Window)
        self.dockWidget.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea|QtCore.Qt.RightDockWidgetArea)
        self.dockWidget.setObjectName("dockWidget")
        self.dockWidgetContents = QtWidgets.QWidget()
        self.dockWidgetContents.setObjectName("dockWidgetContents")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.dockWidgetContents)
        self.verticalLayout.setContentsMargins(4, 4, 4, 4)
        self.verticalLayout.setObjectName("verticalLayout")
        self.treeWidget = QtWidgets.QTreeWidget(self.dockWidgetContents)
        self.treeWidget.setObjectName("treeWidget")
        self.treeWidget.headerItem().setText(0, "1")
        self.treeWidget.header().setVisible(False)
        self.verticalLayout.addWidget(self.treeWidget)
        self.dockWidget.setWidget(self.dockWidgetContents)
        Window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget)

        self.retranslateUi(Window)
        QtCore.QMetaObject.connectSlotsByName(Window)
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def optics(self):
        toolbar = QToolBar()
        toolbar.setToolButtonStyle( Qt.ToolButtonTextUnderIcon)
        toolbar.setIconSize(QSize(42, 42))

        self.run = QAction(QIcon_load("media-playback-start"), wrap_text(_("Calculate"),5), self)
        toolbar.addAction(self.run)

        self.export = QAction(QIcon_load("document-export"), wrap_text(_("Export spectrum"),5), self)
        #self.export.triggered.connect(self.save_image)
        toolbar.addAction(self.export)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        toolbar.addWidget(spacer)


        self.help = QAction(QIcon_load("help"), _("Help"), self)
        toolbar.addAction(self.help)
        return toolbar
项目:activity-browser    作者:LCA-ActivityBrowser    | 项目源码 | 文件源码
def __init__(self, parent):
        super(LCAResultsTab, self).__init__(parent)
        self.panel = parent  # e.g. right panel
        self.visible = False

        self.scroll_area = QtWidgets.QScrollArea()
        self.scroll_widget = QtWidgets.QWidget()
        self.scroll_widget_layout = QtWidgets.QVBoxLayout()

        self.scroll_widget.setLayout(self.scroll_widget_layout)
        self.scroll_area.setWidget(self.scroll_widget)
        self.scroll_area.setWidgetResizable(True)

        self.layout = QtWidgets.QVBoxLayout()
        self.setLayout(self.layout)

        self.connect_signals()
项目:taobao    作者:laogewen    | 项目源码 | 文件源码
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(564, 270)
        self.centralWidget = QtWidgets.QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.pushButton = QtWidgets.QPushButton(self.centralWidget)
        self.pushButton.setGeometry(QtCore.QRect(320, 60, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.textEdit = QtWidgets.QTextEdit(self.centralWidget)
        self.textEdit.setGeometry(QtCore.QRect(60, 60, 151, 31))
        self.textEdit.setObjectName("textEdit")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralWidget)
        self.pushButton_2.setGeometry(QtCore.QRect(320, 150, 111, 28))
        self.pushButton_2.setObjectName("pushButton_2")
        self.label = QtWidgets.QLabel(self.centralWidget)
        self.label.setGeometry(QtCore.QRect(60, 30, 151, 16))
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralWidget)
        self.label_2.setGeometry(QtCore.QRect(60, 110, 151, 41))
        self.label_2.setObjectName("label_2")
        self.comboBox = QtWidgets.QComboBox(self.centralWidget)
        self.comboBox.setGeometry(QtCore.QRect(60, 160, 87, 22))
        self.comboBox.setObjectName("comboBox")
        MainWindow.setCentralWidget(self.centralWidget)
        self.menuBar = QtWidgets.QMenuBar(MainWindow)
        self.menuBar.setGeometry(QtCore.QRect(0, 0, 564, 26))
        self.menuBar.setObjectName("menuBar")
        MainWindow.setMenuBar(self.menuBar)
        self.mainToolBar = QtWidgets.QToolBar(MainWindow)
        self.mainToolBar.setObjectName("mainToolBar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
        self.statusBar = QtWidgets.QStatusBar(MainWindow)
        self.statusBar.setObjectName("statusBar")
        MainWindow.setStatusBar(self.statusBar)

        self.comboBox.addItems(["%s" % x for x in range(1, 100)])
        self.pushButton.clicked.connect(self.start)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
项目:ReadManga    作者:kanishka-linux    | 项目源码 | 文件源码
def progressBar(cmd):
    MainWindow = QtWidgets.QWidget()
    progress = QtWidgets.QProgressDialog("Please Wait!", "Cancel", 0, 100, MainWindow)
    progress.setWindowModality(QtCore.Qt.WindowModal)
    progress.setAutoReset(True)
    progress.setAutoClose(True)
    progress.setMinimum(0)
    progress.setMaximum(100)
    progress.resize(500,100)
    progress.setWindowTitle("Loading, Please Wait! (Cloudflare Protection)")
    progress.show()
    progress.setValue(0)
    #content = cmd
    #print content
    #content = ccurl(cmd,"")
    content = subprocess.check_output(cmd)

    progress.setValue(100)
    progress.hide()
    #print content
    return content
项目:axopy    作者:ucdrascal    | 项目源码 | 文件源码
def __init__(self):
        app = get_qtapp()
        super(MainWindow, self).__init__()

        app.installEventFilter(self)

        self._central_widget = QtWidgets.QWidget(self)
        self._layout = QtWidgets.QStackedLayout(self._central_widget)
        self.setCentralWidget(self._central_widget)

        status_bar = QtWidgets.QStatusBar(self)
        self.setStatusBar(status_bar)
        self._statusbar_label = QtWidgets.QLabel("status")
        status_bar.addPermanentWidget(self._statusbar_label)

        self.show()
项目:AlphaHooks    作者:AlphaHooks    | 项目源码 | 文件源码
def tree_widget(self, tree, structure):
        """
        Used to traverse a QTreeWidget and adding the items in a
        dict or list.

        :param tree: pass a QTreeWidget instance
        :param structure: pass a dictionary
        """
        if type(structure) is dict:
            for key, val in structure.items():
                child = QTreeWidgetItem()
                child.setText(0, key)
                tree.addChild(child)
                self.tree_widget(child, val)
        elif type(structure) is str:
            child = QTreeWidgetItem()
            child.setText(0, structure)
            tree.addChild(child)
        elif isinstance(structure, QWidget):
            self.index += 1
            tree.setText(1, str(self.index))
            self.display.addWidget(structure)
项目:OnCue    作者:featherbear    | 项目源码 | 文件源码
def __init__(self):
        QtWidgets.QColorDialog.__init__(self)
        self.setOption(QtWidgets.QColorDialog.NoButtons)
        """
        QColorDialog
            [0] PyQt5.QtWidgets.QVBoxLayout
            [1] PyQt5.QtWidgets.QWidget             | Basic Color Grid
            [2] PyQt5.QtWidgets.QLabel              | Basic Color Label
            [3] PyQt5.QtWidgets.QPushButton         | Pick Screen Color Button
            [4] PyQt5.QtWidgets.QLabel              | Background for the colour preview
            [5] PyQt5.QtWidgets.QWidget             | Custom Color Grid
            [6] PyQt5.QtWidgets.QLabel              | Custom Color Label
            [7] PyQt5.QtWidgets.QPushButton         | Add to Custom Colors Button
            [8] PyQt5.QtWidgets.QFrame              | Hue Saturation Picker
            [9] PyQt5.QtWidgets.QWidget             | Intensity Slider
            [10] PyQt5.QtWidgets.QWidget            | Value and Preview
            [11] PyQt5.QtWidgets.QDialogButtonBox   | Dialog Buttons
            [12] PyQt5.QtCore.QTimer                | ???
        """
        self.children()[10].children()[16].setText("&Hex:")
        [self.children()[1].setParent(None) for elem in range(7)]  # Remove elements 1-7
        self.updateColor()
        # Elements 0, 8, 9, 10, 11 are important
项目:OnCue    作者:featherbear    | 项目源码 | 文件源码
def __init__(self):
            """
            Initialise class
            """
            QtWidgets.QWidget.__init__(self)
            self.setupUi(self)
            output.PPTevents.updateSlide = self.powerpointSlides.setCurrentRow
            self.contentControls.setCurrentIndex(0)

            # TODO not implemented
            """ 
            self.mediaProgressSeek.setMouseTracking(True)
            self.mediaProgressSeek.leaveEvent=self.seekMouse
            self.mediaProgressSeek.mouseMoveEvent=self.seekMouse
            self.mediaProgressSeek.mouseReleaseEvent=lambda e: output.seek(e.x()/self.mediaProgressSeek.width())
            """

            # Update video scrubber position
            class ProgressBarUpdater(QtCore.QThread):
                tick = QtCore.pyqtSignal(int)

                def run(self):
                    while True:
                        self.sleep(1)
                        self.tick.emit(oncue.lib.utils.confine(int(output.VLCposition() * 1000), 0, 1000))

            self.mediaProgressBarThread = ProgressBarUpdater()
            self.mediaProgressBarThread.tick.connect(
                lambda value: self.mediaProgressBar.setValue(value) or self.mediaProgressBar.repaint())
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(FileWatch, self).__init__(*args, **kwargs)

        self.filePath = ""
        self.lastEdited = 0
        self.fileContent = ""

        self.propertiesWidget = QWidget()

        self.vlayout = QVBoxLayout()
        self.lineEdit = QLineEdit()
        self.lineEdit.textChanged.connect(self.lineEditTextChanges)

        self.vlayout.addWidget(self.lineEdit)
        self.vlayout.addItem(QSpacerItem(40, 20, QSizePolicy.Minimum, QSizePolicy.Expanding))

        self.propertiesWidget.setLayout(self.vlayout)

        self.timer = QTimer()
        self.timer.timeout.connect(self.checkFileChange)
        self.timer.start(200)
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(FullScreenQuad, self).__init__(*args, **kwargs)

        self.propertiesWidget = QWidget()

        self.vlayout = QVBoxLayout()

        self.xoffsetWidget = QDoubleSpinBox()
        self.xoffsetWidget.setMaximum(9999)
        self.xoffsetWidget.setMinimum(-9999)
        self.yoffsetWidget = QDoubleSpinBox()
        self.yoffsetWidget.setMaximum(9999)
        self.yoffsetWidget.setMinimum(-9999)
        self.vlayout.addWidget(self.xoffsetWidget)
        self.vlayout.addWidget(self.yoffsetWidget)

        self.xoffsetWidget.valueChanged.connect(self.offsetchange)
        self.yoffsetWidget.valueChanged.connect(self.offsetchange)

        self.vlayout.addItem(QSpacerItem(40, 20, QSizePolicy.Minimum, QSizePolicy.Expanding))

        self.propertiesWidget.setLayout(self.vlayout)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def __init__(self, parent):   
        super(QWidget, self).__init__(parent)
        self.layout = QVBoxLayout(self)

        # Initialize tab screen
        self.tabs = QTabWidget()
        self.tab1 = QWidget()   
        self.tab2 = QWidget()
        self.tabs.resize(300,200) 

        # Add tabs
        self.tabs.addTab(self.tab1,"Tab 1")
        self.tabs.addTab(self.tab2,"Tab 2")

        # Create first tab
        self.tab1.layout = QVBoxLayout(self)
        self.pushButton1 = QPushButton("PyQt5 button")
        self.tab1.layout.addWidget(self.pushButton1)
        self.tab1.setLayout(self.tab1.layout)

        # Add tabs to widget        
        self.layout.addWidget(self.tabs)
        self.setLayout(self.layout)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def window():
    app = QtWidgets.QApplication(sys.argv)
    w = QtWidgets.QWidget()
    b = QtWidgets.QPushButton('Push Me')
    l = QtWidgets.QLabel('Look at me')

    h_box = QtWidgets.QHBoxLayout()
    h_box.addStretch()
    h_box.addWidget(l)
    h_box.addStretch()

    v_box = QtWidgets.QVBoxLayout()
    v_box.addWidget(b)
    v_box.addLayout(h_box)

    w.setLayout(v_box)

    w.setWindowTitle('PyQt5 Lesson 4')
    w.show()

    sys.exit(app.exec_())
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent, slider: VideoSlider):
        super(VideoSliderWidget, self).__init__(parent)
        self.parent = parent
        self.slider = slider
        self.loaderEffect = OpacityEffect()
        self.loaderEffect.setEnabled(False)
        self.setGraphicsEffect(self.loaderEffect)
        self.setContentsMargins(0, 0, 0, 0)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.layout().setStackingMode(QStackedLayout.StackAll)
        self.genlabel = QLabel(self.parent)
        self.genlabel.setContentsMargins(0, 0, 0, 14)
        self.genlabel.setPixmap(QPixmap(':/images/generating-thumbs.png'))
        self.genlabel.setAlignment(Qt.AlignCenter)
        self.genlabel.hide()
        sliderLayout = QGridLayout()
        sliderLayout.setContentsMargins(0, 0, 0, 0)
        sliderLayout.setSpacing(0)
        sliderLayout.addWidget(self.slider, 0, 0)
        sliderLayout.addWidget(self.genlabel, 0, 0)
        sliderWidget = QWidget(self.parent)
        sliderWidget.setLayout(sliderLayout)
        self.addWidget(sliderWidget)
项目:BATS-Bayesian-Adaptive-Trial-Simulator    作者:ContaTP    | 项目源码 | 文件源码
def __init__(self, parent=None):

        QtWidgets.QWidget.__init__(self, parent)
        # Layout
        self.runmenulayout = QtWidgets.QVBoxLayout()
        # Widget
        self.runmenuLabel = QtWidgets.QLabel()
        self.runmenuLabel.setText("Task is running\nPlease wait...")
        # self.runmenuMovieLabel = QtWidgets.QLabel()
        # self.runmenuMovie = QtGui.QMovie(":/resources/runmenu.gif")
        # self.runmenuMovieLabel.setMovie(self.runmenuMovie)
        # self.runmenuMovieLabel.show()
        # Add Widget
        self.runmenulayout.addWidget(self.runmenuLabel)
        # self.runmenulayout.addWidget(self.runmenuMovieLabel)
        # Set layout
        self.runmenulayout.setAlignment(QtCore.Qt.AlignCenter)
        self.runmenulayout.setSpacing(0)
        self.runmenulayout.setContentsMargins(10, 0, 10, 0)        
        self.setLayout(self.runmenulayout)

        # Stylesheet
        self.setStyleSheet("QLabel{background:transparent; color:#3d5159; font-family:'Segoe UI'; font-size:13pt; border:none;}")
项目:thegame    作者:afg984    | 项目源码 | 文件源码
def paint(
            self,
            painter: QPainter,
            option: QStyleOptionGraphicsItem,
            widget: QWidget):
        pen = QPen()
        pen.setWidth(3)
        painter.setRenderHint(QPainter.Antialiasing)
        pen.setColor(QColor(61, 61, 61, 255))
        painter.setPen(pen)
        painter.setBrush(QBrush(QColor(61, 61, 61, 255), Qt.SolidPattern))
        painter.drawRect(
            QRectF(-self.maxWidth / 2, -10, self.maxWidth, 20))
        painter.setBrush(QBrush(QColor(240, 217, 108, 255), Qt.SolidPattern))
        painter.drawRect(
            QRectF(-self.maxWidth / 2, -10, self.displayWidth, 20))
        path = QPainterPath()

        path.addText(-self.maxWidth / 2, 35, QFont('monospace', 18, QFont.Bold), f'{self.name}  Lv.{self.level}  Exp. {self.actualExperience:{len(str(self.maxExperience))}}/{self.maxExperience}')

        # pen.setColor(Qt.white)
        pen.setWidth(2)
        painter.setPen(pen)
        painter.setBrush(QBrush(QColor(0, 0, 0, 61), Qt.SolidPattern))
        painter.drawPath(path)
项目:thegame    作者:afg984    | 项目源码 | 文件源码
def paint(
            self,
            painter: QPainter,
            option: QStyleOptionGraphicsItem,
            widget: QWidget):
        pen = QPen()
        pen.setWidth(1)
        painter.setRenderHint(QPainter.Antialiasing)
        pen.setColor(QColor(81, 81, 81, 255))
        painter.setPen(pen)
        painter.setBrush(QBrush(QColor(81, 81, 81, 255), Qt.SolidPattern))
        path = QPainterPath()
        path.addText(
            -self.width,
            self.height,
            QFont('monospace', 13, QFont.PreferNoHinting),
            self.text)
        painter.drawPath(path)
项目:thegame    作者:afg984    | 项目源码 | 文件源码
def paint(
            self,
            painter: QPainter,
            option: QStyleOptionGraphicsItem,
            widget: QWidget):
        pen = QPen()
        pen.setWidth(1)
        painter.setRenderHint(QPainter.Antialiasing)
        pen.setColor(QColor(81, 81, 81, 255))
        painter.setPen(pen)
        painter.setBrush(QBrush(QColor(81, 81, 81, 255), Qt.SolidPattern))
        for i, score in enumerate(self.scores):
            path = QPainterPath()
            path.addText(
                -self.width,
                14 + i * 16,
                QFont('monospace', 13, QFont.PreferNoHinting),
                f'{score.score:6}[{score.level:2}]  {score.hero_name}')
            painter.drawPath(path)
项目:lighthouse    作者:gaasedelen    | 项目源码 | 文件源码
def __init__(self, title, icon_path):
        self._title = title
        self._icon = QtGui.QIcon(icon_path)

        # IDA 7+ Widgets
        if using_ida7api:
            import sip

            self._form   = idaapi.create_empty_widget(self._title)
            self._widget = sip.wrapinstance(long(self._form), QtWidgets.QWidget) # NOTE: LOL

        # legacy IDA PluginForm's
        else:
            self._form = idaapi.create_tform(self._title, None)
            if using_pyqt5:
                self._widget = idaapi.PluginForm.FormToPyQtWidget(self._form)
            else:
                self._widget = idaapi.PluginForm.FormToPySideWidget(self._form)

        self._widget.setWindowIcon(self._icon)
项目:vivisect-py3    作者:bat-serjo    | 项目源码 | 文件源码
def __init__(self, trace=None, parent=None):
        QtWidgets.QWidget.__init__(self, parent=parent)
        VQTraceNotifier.__init__(self, trace)

        self.grid = QtWidgets.QGridLayout()
        if not trace.hasStatusRegister():
            return

        self.flags_def = trace.getStatusRegNameDesc()
        self.flags = {}
        self.flag_labels = {}
        for idx, (name, desc) in enumerate(self.flags_def):
            flag_button = QtWidgets.QPushButton(name)
            flag_button.clicked.connect(self.buttonClicked)
            flag_button.setToolTip(desc)

            flag_label = QtWidgets.QLabel('0', self)
            flag_label.setAlignment(QtCore.Qt.AlignCenter)
            self.flag_labels[name] = flag_label

            self.grid.addWidget(flag_button, 0, idx)
            self.grid.addWidget(flag_label, 1, idx)

        self.setLayout(self.grid)
        self.vqLoad()
项目:Sephrasto    作者:Aeolitus    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()
        if Wolke.Debug:
            print("Initializing VorteileWrapper...")
        self.formVor = QtWidgets.QWidget()
        self.uiVor = CharakterVorteile.Ui_Form()
        self.uiVor.setupUi(self.formVor)

        self.uiVor.treeWidget.itemSelectionChanged.connect(self.vortClicked)
        self.uiVor.treeWidget.itemChanged.connect(self.itemChangeHandler)
        self.uiVor.treeWidget.header().setSectionResizeMode(0,1)

        if len(Wolke.Char.vorteile) > 0:
            self.currentVort = Wolke.Char.vorteile[0]
        else:
            self.currentVort = ""

        self.itemWidgets = {}

        self.initVorteile()
项目:Sephrasto    作者:Aeolitus    | 项目源码 | 文件源码
def __init__(self):
        ''' Initialize the GUI and set signals for the spinners'''
        super().__init__()
        if Wolke.Debug:
            print("Initializing AttrWrapper...")
        self.formAttr = QtWidgets.QWidget()
        self.uiAttr = CharakterAttribute.Ui_formAttribute()
        self.uiAttr.setupUi(self.formAttr)
        self.loadAttribute()
        #Signals
        self.uiAttr.spinAsP.valueChanged.connect(self.updateAttribute)
        self.uiAttr.spinKaP.valueChanged.connect(self.updateAttribute)
        self.uiAttr.spinKO.valueChanged.connect(self.refresh)
        self.uiAttr.spinMU.valueChanged.connect(self.refresh)
        self.uiAttr.spinIN.valueChanged.connect(self.refresh)
        self.uiAttr.spinGE.valueChanged.connect(self.refresh)
        self.uiAttr.spinKK.valueChanged.connect(self.refresh)
        self.uiAttr.spinFF.valueChanged.connect(self.refresh)
        self.uiAttr.spinKL.valueChanged.connect(self.refresh)
        self.uiAttr.spinCH.valueChanged.connect(self.refresh)
项目:Sephrasto    作者:Aeolitus    | 项目源码 | 文件源码
def __init__(self):
        ''' Initialize and connect signals '''
        super().__init__()
        if Wolke.Debug:
            print("Initializing BeschrWrapper...")
        self.formBeschr = QtWidgets.QWidget()
        self.uiBeschr = CharakterBeschreibung.Ui_formBeschreibung()
        self.uiBeschr.setupUi(self.formBeschr)
        self.loadBeschreibung()
        self.uiBeschr.editName.editingFinished.connect(self.updateBeschreibung)
        self.uiBeschr.editRasse.editingFinished.connect(
                self.updateBeschreibung)
        self.uiBeschr.editKurzbeschreibung.editingFinished.connect(
            self.updateBeschreibung)
        for i in range(8):
            eval("self.uiBeschr.editEig" + str(i+1) +
                 ".editingFinished.connect(self.updateBeschreibung)")
        self.uiBeschr.comboFinanzen.activated.connect(self.updateBeschreibung)
        self.uiBeschr.comboStatus.activated.connect(self.updateBeschreibung)
        self.uiBeschr.comboHeimat.activated.connect(self.updateBeschreibung)
        self.currentGebraeuche = Wolke.Char.heimat
        if "Gebräuche: " + self.currentGebraeuche not in \
                Wolke.Char.fertigkeiten["Gebräuche"].gekaufteTalente:
            Wolke.Char.fertigkeiten["Gebräuche"].gekaufteTalente.append(
                    "Gebräuche: " + self.currentGebraeuche)
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def __init__(self):
        QTabWidget.__init__(self)
        self.setMaximumHeight(120)
        #self.setStyleSheet("QWidget {  background-color:cyan; }")

        self.about = QToolButton(self)
        self.about.setText(_("About"))
        self.about.pressed.connect(self.callback_about_dialog)

        self.setCornerWidget(self.about)

        w=self.optics()
        self.addTab(w,_("Spectrum"))


        sheet=self.readStyleSheet(os.path.join(get_css_path(),"style.css"))
        if sheet!=None:
            sheet=str(sheet,'utf-8')
            self.setStyleSheet(sheet)
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def file(self):
        toolbar = QToolBar()
        toolbar.setToolButtonStyle( Qt.ToolButtonTextUnderIcon)
        toolbar.setIconSize(QSize(42, 42))

        self.home_new = QAction(QIcon_load("document-new"), _("New simulation").replace(" ","\n"), self)
        #self.home_new.setText(_("New\nsimulation"))
        toolbar.addAction(self.home_new)

        self.home_open = QAction(QIcon_load("document-open"), _("Open\nsimulation"), self)
        toolbar.addAction(self.home_open)

        self.home_export = QAction(QIcon_load("document-export"), _("Export\ndata"), self)
        toolbar.addAction(self.home_export)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        toolbar.addWidget(spacer)

        self.home_help = QAction(QIcon_load("internet-web-browser"), _("Help"), self)
        toolbar.addAction(self.home_help)

        return toolbar
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def __init__(self):
        QTabWidget.__init__(self)
        self.setMaximumHeight(120)
        #self.setStyleSheet("QWidget {  background-color:cyan; }")

        self.about = QToolButton(self)
        self.about.setText(_("About"))
        self.about.pressed.connect(self.callback_about_dialog)

        self.setCornerWidget(self.about)

        w=self.optics()
        self.addTab(w,_("Optics"))


        sheet=self.readStyleSheet(os.path.join(get_css_path(),"style.css"))
        if sheet!=None:
            sheet=str(sheet,'utf-8')
            self.setStyleSheet(sheet)
项目:CRIkit2    作者:CoherentRamanNIST    | 项目源码 | 文件源码
def setupUi(self, MainWindow):
            MainWindow.setObjectName("MainWindow")
            MainWindow.resize(984, 658)
            self.centralwidget = QtWidgets.QWidget(MainWindow)
            self.centralwidget.setObjectName("centralwidget")
            self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
            self.gridLayout.setObjectName("gridLayout")
            self.verticalLayout = QtWidgets.QVBoxLayout()
            self.verticalLayout.setObjectName("verticalLayout")
            self.pushbutton = QtWidgets.QPushButton('Test')
            self.verticalLayout.addWidget(self.pushbutton)
            self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
            MainWindow.setCentralWidget(self.centralwidget)
            self.menubar = QtWidgets.QMenuBar(MainWindow)
            self.menubar.setGeometry(QtCore.QRect(0, 0, 984, 21))
            self.menubar.setObjectName("menubar")
            MainWindow.setMenuBar(self.menubar)
            self.statusbar = QtWidgets.QStatusBar(MainWindow)
            self.statusbar.setObjectName("statusbar")
            MainWindow.setStatusBar(self.statusbar)

            self.retranslateUi(MainWindow)
            QtCore.QMetaObject.connectSlotsByName(MainWindow)
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def __init__(self):
        super(MainWindow, self).__init__()
        self.central_widget = QWidget()
        self.layout = QVBoxLayout()
        self.central_widget.setLayout(self.layout)
        self.setCentralWidget(self.central_widget)

        self.widget = Widget()


        self.btn_save = QPushButton("Save")
        self.btn_save.clicked.connect(self.save)
        self.btn_load = QPushButton("Load")
        self.btn_load.clicked.connect(self.load)

        self.layout.addWidget(self.widget)
        self.layout.addWidget(self.btn_save)
        self.layout.addWidget(self.btn_load)
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def __init__(self):
   super(QWidget, self).__init__()
   layout = QVBoxLayout()
   self.edit = QTextEdit()
   self.thread = QThread()

   self.setupConnections()

   self.edit.setWindowTitle("QTextEdit Standard Output Redirection")
   layout.addWidget(self.edit)
   self.setLayout(layout)
   self.show()
项目:python-course    作者:juancarlospaco    | 项目源码 | 文件源码
def main():
    application = QtWidgets.QApplication([])
    window = QtWidgets.QWidget()
    layout_numbers = QtWidgets.QVBoxLayout(window)

    result = QtWidgets.QTextEdit()
    layout_numbers.addWidget(result)

    # Numbers from 0 to 9, Numeros de 0 a 9
    for number in range(10):
        button = QtWidgets.QPushButton(str(number))
        button.clicked.connect(lambda _, number=number:
                               result.insertPlainText(str(number)))
        layout_numbers.addWidget(button)

    # Math Operators, Operadores Matematicos
    operators = QtWidgets.QWidget()
    layout_operators = QtWidgets.QHBoxLayout(operators)
    for operator in ("*", "/", "+", "-", "//"):
        button = QtWidgets.QPushButton(str(operator))
        button.clicked.connect(lambda _, operator=operator:
                               result.insertPlainText(str(operator)))
        layout_operators.addWidget(button)
    layout_numbers.addWidget(operators)

    # Solve the user input, Resolver lo ingresado por el usuario
    solve = QtWidgets.QPushButton("EVAL", window)
    solve.clicked.connect(lambda _, maths=result:
                          result.setPlainText(str(eval(maths.toPlainText()))))
    layout_numbers.addWidget(solve)

    window.show()
    exit(application.exec_())
项目:Py2DSpectroscopy    作者:SvenBo90    | 项目源码 | 文件源码
def __init__(self, map_tab_widget):

        # set object name
        map_tab_widget.setObjectName("mapTab")

        # create plot widget
        self.plot_widget = QWidget(map_tab_widget)
        self.plot_widget.setGeometry(QRect(10, 10, 600, 350))
        self.plot_widget.setObjectName("plotWidget")

        # create toolbar widget
        self.toolbar_widget = QWidget(map_tab_widget)
        self.toolbar_widget.setGeometry(QRect(10, 350, 450, 80))
        self.toolbar_widget.setObjectName("toolbarWidget")

        # data selection box
        self.data_selection_combo_box = QComboBox(map_tab_widget)
        self.data_selection_combo_box.setGeometry(QRect(460, 360, 150, 30))
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def setupUi(self, SchemaMainWindow):
        SchemaMainWindow.setObjectName("SchemaMainWindow")
        SchemaMainWindow.resize(417, 594)
        self.centralwidget = QtWidgets.QWidget(SchemaMainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.schemaLabel = QtWidgets.QLabel(self.centralwidget)
        self.schemaLabel.setObjectName("schemaLabel")
        self.gridLayout.addWidget(self.schemaLabel, 0, 0, 1, 2)
        self.schemaSelection = QtWidgets.QComboBox(self.centralwidget)
        self.schemaSelection.setObjectName("schemaSelection")
        self.gridLayout.addWidget(self.schemaSelection, 0, 2, 1, 2)
        self.schemaView = QtWidgets.QTextBrowser(self.centralwidget)
        self.schemaView.setObjectName("schemaView")
        self.gridLayout.addWidget(self.schemaView, 1, 0, 1, 4)
        self.instanceLabel = QtWidgets.QLabel(self.centralwidget)
        self.instanceLabel.setObjectName("instanceLabel")
        self.gridLayout.addWidget(self.instanceLabel, 2, 0, 1, 2)
        self.instanceSelection = QtWidgets.QComboBox(self.centralwidget)
        self.instanceSelection.setObjectName("instanceSelection")
        self.gridLayout.addWidget(self.instanceSelection, 2, 2, 1, 2)
        self.instanceEdit = QtWidgets.QTextEdit(self.centralwidget)
        self.instanceEdit.setObjectName("instanceEdit")
        self.gridLayout.addWidget(self.instanceEdit, 3, 0, 1, 4)
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 4, 0, 1, 1)
        self.validationStatus = QtWidgets.QLabel(self.centralwidget)
        self.validationStatus.setObjectName("validationStatus")
        self.gridLayout.addWidget(self.validationStatus, 4, 1, 1, 2)
        self.validateButton = QtWidgets.QPushButton(self.centralwidget)
        self.validateButton.setObjectName("validateButton")
        self.gridLayout.addWidget(self.validateButton, 4, 3, 1, 1)
        SchemaMainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(SchemaMainWindow)
        self.statusbar.setObjectName("statusbar")
        SchemaMainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(SchemaMainWindow)
        QtCore.QMetaObject.connectSlotsByName(SchemaMainWindow)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def setupUi(self, SchemaMainWindow):
        SchemaMainWindow.setObjectName("SchemaMainWindow")
        SchemaMainWindow.resize(417, 594)
        self.centralwidget = QtWidgets.QWidget(SchemaMainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.schemaLabel = QtWidgets.QLabel(self.centralwidget)
        self.schemaLabel.setObjectName("schemaLabel")
        self.gridLayout.addWidget(self.schemaLabel, 0, 0, 1, 2)
        self.schemaSelection = QtWidgets.QComboBox(self.centralwidget)
        self.schemaSelection.setObjectName("schemaSelection")
        self.gridLayout.addWidget(self.schemaSelection, 0, 2, 1, 2)
        self.schemaView = QtWidgets.QTextBrowser(self.centralwidget)
        self.schemaView.setObjectName("schemaView")
        self.gridLayout.addWidget(self.schemaView, 1, 0, 1, 4)
        self.instanceLabel = QtWidgets.QLabel(self.centralwidget)
        self.instanceLabel.setObjectName("instanceLabel")
        self.gridLayout.addWidget(self.instanceLabel, 2, 0, 1, 2)
        self.instanceSelection = QtWidgets.QComboBox(self.centralwidget)
        self.instanceSelection.setObjectName("instanceSelection")
        self.gridLayout.addWidget(self.instanceSelection, 2, 2, 1, 2)
        self.instanceEdit = QtWidgets.QTextEdit(self.centralwidget)
        self.instanceEdit.setObjectName("instanceEdit")
        self.gridLayout.addWidget(self.instanceEdit, 3, 0, 1, 4)
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 4, 0, 1, 1)
        self.validationStatus = QtWidgets.QLabel(self.centralwidget)
        self.validationStatus.setObjectName("validationStatus")
        self.gridLayout.addWidget(self.validationStatus, 4, 1, 1, 2)
        self.validateButton = QtWidgets.QPushButton(self.centralwidget)
        self.validateButton.setObjectName("validateButton")
        self.gridLayout.addWidget(self.validateButton, 4, 3, 1, 1)
        SchemaMainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(SchemaMainWindow)
        self.statusbar.setObjectName("statusbar")
        SchemaMainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(SchemaMainWindow)
        QtCore.QMetaObject.connectSlotsByName(SchemaMainWindow)
项目:pynephoscope    作者:neXyon    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        self.figure = plt.figure()

        self.canvas = FigureCanvas(self.figure)

        self.toolbar = NavigationToolbar(self.canvas, self)

        self.button = QtWidgets.QPushButton("Plot")
        self.button.clicked.connect(self.plot)

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.toolbar)
        layout.addWidget(self.canvas)
        layout.addWidget(self.button)

        self.setLayout(layout)
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def initUI(self):

        # QToolTip.setFont(QFont('SansSerif', 9))

        self.cwidget = GUICenterWidget()
        self.setCentralWidget(self.cwidget)

        # self.setToolTip('This is a <b>QWidget</b> widget')

        self.statusBar().showMessage('Ready')

        self.center()
        self.setWindowTitle('Coliform Control GUI')

        self.onewiretimer = QTimer(self)
        self.onewiretimer.timeout.connect(self.cwidget.onewireOn)
        self.onewiretimer.start(1000)

        # self.p = QPalette(self.palette())
        # self.p.setColor(QPalette.Window, QColor(53, 53, 53))
        # self.p.setColor(QPalette.WindowText, Qt.white)
        # self.p.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ToolTipBase, Qt.white)
        # self.p.setColor(QPalette.ToolTipText, Qt.white)
        # self.p.setColor(QPalette.Button, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ButtonText, Qt.white)
        # self.p.setColor(QPalette.BrightText, Qt.red)
        # self.p.setColor(QPalette.Highlight, QColor(142, 45, 197).lighter())
        # self.p.setColor(QPalette.HighlightedText, Qt.black)
        # self.setPalette(self.p)

        self.show()
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def initUI(self):

        # QToolTip.setFont(QFont('SansSerif', 9))

        self.cwidget = CameraCenterWidget()
        self.setCentralWidget(self.cwidget)

        # self.setToolTip('This is a <b>QWidget</b> widget')

        self.center()
        self.setWindowTitle('Camera Control GUI')

        self.statusBarTimer = QTimer(self)
        self.statusBarTimer.timeout.connect(self.statusUpdate)
        self.statusBarTimer.start(100)

        # self.p = QPalette(self.palette())
        # self.p.setColor(QPalette.Window, QColor(53, 53, 53))
        # self.p.setColor(QPalette.WindowText, Qt.white)
        # self.p.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ToolTipBase, Qt.white)
        # self.p.setColor(QPalette.ToolTipText, Qt.white)
        # self.p.setColor(QPalette.Button, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ButtonText, Qt.white)
        # self.p.setColor(QPalette.BrightText, Qt.red)
        # self.p.setColor(QPalette.Highlight, QColor(142, 45, 197).lighter())
        # self.p.setColor(QPalette.HighlightedText, Qt.black)
        # self.setPalette(self.p)

        self.show()
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def initUI(self):

        # QToolTip.setFont(QFont('SansSerif', 9))

        self.cwidget = RGBCenterWidget()
        self.setCentralWidget(self.cwidget)

        # self.setToolTip('This is a <b>QWidget</b> widget')

        self.center()
        self.setWindowTitle('RGB Sensor GUI')

        self.statusBarTimer = QTimer(self)
        self.statusBarTimer.timeout.connect(self.statusUpdate)
        self.statusBarTimer.start(100)

        # self.p = QPalette(self.palette())
        # self.p.setColor(QPalette.Window, QColor(53, 53, 53))
        # self.p.setColor(QPalette.WindowText, Qt.white)
        # self.p.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ToolTipBase, Qt.white)
        # self.p.setColor(QPalette.ToolTipText, Qt.white)
        # self.p.setColor(QPalette.Button, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ButtonText, Qt.white)
        # self.p.setColor(QPalette.BrightText, Qt.red)
        # self.p.setColor(QPalette.Highlight, QColor(142, 45, 197).lighter())
        # self.p.setColor(QPalette.HighlightedText, Qt.black)
        # self.setPalette(self.p)

        self.show()
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(529, 329)
        self.selInfoWidget = QtWidgets.QWidget(Form)
        self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
        self.selInfoWidget.setObjectName("selInfoWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.selDescLabel = QtWidgets.QLabel(self.selInfoWidget)
        self.selDescLabel.setText("")
        self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.selDescLabel.setWordWrap(True)
        self.selDescLabel.setObjectName("selDescLabel")
        self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
        self.selNameLabel = QtWidgets.QLabel(self.selInfoWidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.selNameLabel.setFont(font)
        self.selNameLabel.setText("")
        self.selNameLabel.setObjectName("selNameLabel")
        self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
        self.selectedTree = DataTreeWidget(self.selInfoWidget)
        self.selectedTree.setObjectName("selectedTree")
        self.selectedTree.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
        self.hoverText = QtWidgets.QTextEdit(Form)
        self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
        self.hoverText.setObjectName("hoverText")
        self.view = FlowchartGraphicsView(Form)
        self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
        self.view.setObjectName("view")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(529, 329)
        self.selInfoWidget = QtWidgets.QWidget(Form)
        self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
        self.selInfoWidget.setObjectName("selInfoWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.selDescLabel = QtWidgets.QLabel(self.selInfoWidget)
        self.selDescLabel.setText("")
        self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.selDescLabel.setWordWrap(True)
        self.selDescLabel.setObjectName("selDescLabel")
        self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
        self.selNameLabel = QtWidgets.QLabel(self.selInfoWidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.selNameLabel.setFont(font)
        self.selNameLabel.setText("")
        self.selNameLabel.setObjectName("selNameLabel")
        self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
        self.selectedTree = DataTreeWidget(self.selInfoWidget)
        self.selectedTree.setObjectName("selectedTree")
        self.selectedTree.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
        self.hoverText = QtWidgets.QTextEdit(Form)
        self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
        self.hoverText.setObjectName("hoverText")
        self.view = FlowchartGraphicsView(Form)
        self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
        self.view.setObjectName("view")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:activity-browser    作者:LCA-ActivityBrowser    | 项目源码 | 文件源码
def __init__(self, parent):
        super(MethodsTab, self).__init__(parent)

        self.table = MethodsTable()
        self.search_box = QtWidgets.QLineEdit()
        self.search_box.setPlaceholderText("Filter LCIA methods")
        reset_search_button = QtWidgets.QPushButton("Reset")
        #
        search_layout = QtWidgets.QHBoxLayout()
        search_layout.setAlignment(QtCore.Qt.AlignTop)
        search_layout.addWidget(header('LCIA Methods:'))
        search_layout.addWidget(self.search_box)
        search_layout.addWidget(reset_search_button)
        #
        search_layout_container = QtWidgets.QWidget()
        search_layout_container.setLayout(search_layout)
        #
        container = QtWidgets.QVBoxLayout()
        container.setAlignment(QtCore.Qt.AlignTop)
        container.addWidget(search_layout_container)
        # container.addWidget(horizontal_line())
        container.addWidget(self.table)
        self.setLayout(container)
        #
        # signals.project_selected.connect(lambda x: self.table.sync())
        # signals.project_selected.connect(self.table.sync)
        # # reset_search_button.clicked.connect(self.table.sync)
        # reset_search_button.clicked.connect(self.search_box.clear)
        # # self.search_box.returnPressed.connect(lambda: self.table.sync(query=self.search_box.text()))
        # signals.project_selected.connect(self.search_box.clear)
项目:activity-browser    作者:LCA-ActivityBrowser    | 项目源码 | 文件源码
def get_details_widget(self):
        self.production = ExchangeTable(self, production=True)
        self.inputs = ExchangeTable(self)
        self.flows = ExchangeTable(self, biosphere=True)
        self.upstream = ExchangeTable(self)

        layout = QtWidgets.QVBoxLayout()
        self.metadata = ActivityDataGrid()
        layout.addWidget(self.metadata)

        # splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)

        tables = [
            (self.production, "Products:"),
            (self.inputs, "Technosphere Inputs:"),
            (self.flows, "Biosphere flows:"),
            (self.upstream, "Downstream consumers:"),
        ]

        for table, label in tables:
            layout.addWidget(DetailsGroupBox(label, table))

        # layout.addWidget(splitter)
        layout.addStretch()
        widget = QtWidgets.QWidget(self)
        widget.setLayout(layout)

        return widget
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def addNamedDivider( self, name ):
        if not isinstance( name, QtWidgets.QWidget ):
            name = QtWidgets.QLabel( '<b>%s</b>' % (name,) )

        self.addWidget( name, self.rowCount(), 0, 1, 2 )
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def addRow( self, label, value, button=None, min_width=None ):
        if label is not None and not isinstance( label, QtWidgets.QWidget ):
            label = QtWidgets.QLabel( label )

        if not isinstance( value, QtWidgets.QWidget ):
            value = QtWidgets.QLineEdit( str(value) )
            value.setReadOnly( True )

        if min_width is not None:
            value.setMinimumWidth( min_width )

        row = self.rowCount()

        if label is not None:
            self.addWidget( label, row, 0 )
            col_start = 1
            col_span = 1

        else:
            col_start = 0
            col_span = 2

        if button is None:
            self.addWidget( value, row, col_start, 1, col_span )

        else:
            self.addWidget( value, row, 1 )
            self.addWidget( button, row, 2 )
项目:git-annex-metadata-gui    作者:alpernebbi    | 项目源码 | 文件源码
def set_item(self, item):
        self.clear()

        if not self.isVisible():
            msg = "Metadata editor invisible, not setting file for it."
            logger.info(msg)
            return

        if not hasattr(item, 'key'):
            return

        self._item = item

        if hasattr(item, 'name'):
            desc = item.name
        else:
            desc = item.key
        self.setTitle(desc)

        model = self._item.model()
        model.columnsInserted.connect(self._on_columns_inserted)
        model.modelReset.connect(self.clear)
        self.new_field_requested.connect(model.insert_field)

        if self._new_field_edit is None:
            line_edit = AutoSizeLineEdit()
            line_edit.editingFinished.connect(self._request_new_field)
            line_edit.setPlaceholderText('+')
            line_edit.setAlignment(Qt.Qt.AlignCenter)
            self.layout().addRow(line_edit, QtWidgets.QWidget())
            self._new_field_edit = line_edit

        self.update_fields()

        fmt = "File '{}' set for metadata editing."
        msg = fmt.format(desc)
        logger.info(msg)
项目:KRPC    作者:BevoLJ    | 项目源码 | 文件源码
def gui():
    app = QtWidgets.QApplication(sys.argv)
    # noinspection PyArgumentList
    form = QtWidgets.QWidget()
    # noinspection PyUnusedLocal
    unused = UiForm(form)
    form.show()
    sys.exit(app.exec_())
项目:Auspex    作者:BBN-Q    | 项目源码 | 文件源码
def __init__(self, hostname=None, status_port=7771, data_port=7772):
        QtWidgets.QMainWindow.__init__(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setWindowTitle("Auspex Plotting")

        self.file_menu = self.menuBar().addMenu('&File')
        self.file_menu.addAction('&Quit', self.fileQuit,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
        self.file_menu.addAction('&Open', self.open_connection_dialog,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_O)
        self.file_menu.addAction('&Open Localhost', lambda: self.open_connection("localhost"),
                                 QtCore.Qt.SHIFT + QtCore.Qt.CTRL + QtCore.Qt.Key_O)
        self.recent = self.file_menu.addMenu("Open Recent")

        self.main_widget = QtWidgets.QWidget(self)
        self.main_widget.setMinimumWidth(800)
        self.main_widget.setMinimumHeight(600)
        self.layout = QtWidgets.QVBoxLayout(self.main_widget)

        self.main_widget.setFocus()
        self.setCentralWidget(self.main_widget)

        self.context = zmq.Context()

        self.listener_thread = None

        if hostname:
            self.open_connection(hostname, status_port, data_port)
项目:Dragonfly    作者:duaneloh    | 项目源码 | 文件源码
def init_UI(self):
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setWindowTitle('Dragonfly Frame Viewer')
        window = QtWidgets.QWidget()

        self.hbox = QtWidgets.QHBoxLayout()
        self.frame_panel = frame_panel.Frame_panel(self, powder=self.do_powder, compare=self.do_compare)
        self.hbox.addWidget(self.frame_panel)

        # Menu items
        menubar = self.menuBar()
        menubar.setNativeMenuBar(False)
        # Theme picker
        thememenu = menubar.addMenu('&Theme')
        self.theme = QtWidgets.QActionGroup(self, exclusive=True)
        for i, s in enumerate(map(str, list(QtWidgets.QStyleFactory.keys()))):
            a = self.theme.addAction(QtWidgets.QAction(s, self, checkable=True))
            if i == 0:
                a.setChecked(True)
            a.triggered.connect(self.theme_changed)
            thememenu.addAction(a)
        # Color map picker
        cmapmenu = menubar.addMenu('&Color Map')
        self.color_map = QtWidgets.QActionGroup(self, exclusive=True)
        for i, s in enumerate(['cubehelix', 'CMRmap', 'gray', 'gray_r', 'jet']):
            a = self.color_map.addAction(QtWidgets.QAction(s, self, checkable=True))
            if i == 0:
                a.setChecked(True)
            a.triggered.connect(self.cmap_changed)
            cmapmenu.addAction(a)

        window.setLayout(self.hbox)
        self.setCentralWidget(window)
        self.show()
项目:ReadManga    作者:kanishka-linux    | 项目源码 | 文件源码
def Browse(self,url):

        if os.path.exists(self.cookie_file):
            content = ccurl(url+'#'+'-b'+'#'+self.cookie_file)
            print(content)
            if 'checking_browser' in content:
                os.remove(self.cookie_file)
                self.add_cookie = True
            else:
                self.add_cookie = False

        else:
            self.add_cookie = True

        self.tab_web = QtWidgets.QWidget()
        self.tab_web.setMaximumSize(300,50)
        self.tab_web.setWindowTitle('Wait!')
        self.horizontalLayout_5 = QtWidgets.QVBoxLayout(self.tab_web)
        self.horizontalLayout_5.addWidget(self)

        if self.add_cookie:
            self.web = BrowserPage(url,self.quality,self.add_cookie,self.cookie_file,self.media_val)

            self.web.cookie_signal.connect(self.cookie_found)
            self.web.media_signal.connect(self.media_source_found)
            self.setPage(self.web)
            print('add_cookie')
            self.load(QUrl(url))
            print('--')
            #self.load(QUrl(url))
            self.cnt = 1



        QtWidgets.QApplication.processEvents()
        QtWidgets.QApplication.processEvents()
        self.tab_web.show()
项目:OnCue    作者:featherbear    | 项目源码 | 文件源码
def __init__(self, components: dict):
        # Initialise class
        self.dprint = components["dprint"]
        self.states = components["states"]
        self.app = components["app"]
        self.pptregistry = components["pptregistry"]
        self.confine = components["confine"]
        self.Vlc = components["Vlc"]
        self.vlc = self.Vlc.Instance()

        self.dprint("Starting output display")
        super(displayOutput, self).__init__(None, QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.Tool)

        gridLayout = QtWidgets.QGridLayout(self)
        gridLayout.setContentsMargins(0, 0, 0, 0)
        gridLayout.setSpacing(0)
        self.foreground = QtWidgets.QWidget(self)
        gridLayout.addWidget(self.foreground)
        self.player = self.vlc.media_player_new()
        # self.overlay = QtWidgets.QWidget(None, QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.Tool)

        # Initialise variables
        self.VLCmedia = None
        self.type = None
        self.VLCpaused = None
        self.VLCpaused_c = None
        self.VLCmuted_c = None
        self.PPTapplication = None
        self.PPTpresentation = None
        self.screen = None
        self.overlay = QtWidgets.QWidget(None, QtCore.Qt.WindowStaysOnTopHint)
        self.overlay.setWindowOpacity(0)
        self.draw()

        """ Not using VLC's event manager, it seems very buggy """
        # eventmanager = self.player.event_manager()
        # eventmanager.event_attach(Vlc.EventType.MediaPlayerPositionChanged, states["mediaSignals"]["update"])
        # eventmanager.event_attach(Vlc.EventType.MediaPlayerPaused, states["mediaSignals"]["pause"])
        # eventmanager.event_attach(Vlc.EventType.MediaPlayerPlaying, states["mediaSignals"]["play"])
        # eventmanager.event_attach(Vlc.EventType.MediaPlayerEndReached, states["mediaSignals"]["finish"])
项目:OnCue    作者:featherbear    | 项目源码 | 文件源码
def __init__(self):
            QtWidgets.QWidget.__init__(self)
            self.setupUi(self)
            self.viewTabs_General.click()  # Set General tab (Index 0) as default

            # Populate monitor dropdowns
            displaysArray = ["%s. %s" % (str(i), states["screens"][i]['name']) for i in states["screens"]]
            self.prefOutputDisplayID.addItems(displaysArray)
            # self.prefStageDisplayID.addItems(displaysArray) # TODO not implemented

            # Set component version info
            self.aboutVersions.setText(
                "\n".join(["%s Version: %s" % (
                    component, states["versions"][component] if states["versions"][component] else "n/a") for component in
                           states["versions"].keys()]))

            # Set custom and last states
            self.customtheme = states["interface"]["theme"]
            self.lastbutton = themes.index(states["interface"]["theme"]) if states["interface"][
                                                                                "theme"] in themes else self.prefTheme.count() - 1
            self.customoutputbackground = states["display"]["outputbackground"]
            self.lastoutputbackground = backgrounds.index(states["display"]["outputbackground"]) if states["display"][
                                                                                                        "outputbackground"] in backgrounds else self.prefOutputBackground.count() - 1
            # TODO not implemented
            # self.customstagebackground = states["display"]["stagebackground"]
            # self.laststagebackground = backgrounds.index(states["display"]["stagebackground"]) if states["display"][
            #                                                                                           "stagebackground"] in backgrounds else self.prefStageBackground.count() - 1

            self.updateSettingInterface()