How to use QtPy - 10 common examples

To help you get started, we’ve selected a few QtPy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mantidproject / mantid / qt / python / mantidqt / utils / qt / testing / nosy_qapplication.py View on Github external
def str_from_button(self, enum_val):
        if enum_val == Qt.LeftButton:
            return "LeftButton"
        else:
            return ""
github MTgeophysics / mtpy / tests / SmartMT / test_exportDialog.py View on Github external
def _rewrite_text(widget, text, modifier=QtCore.Qt.NoModifier):
    QTest.keyEvent(QTest.Click, widget, QtCore.Qt.Key_A, QtCore.Qt.ControlModifier)
    QTest.keyClicks(widget, text, modifier=modifier)
    QTest.keyEvent(QTest.Click, widget, QtCore.Qt.Key_Enter)
github Ulm-IQO / qudi / gui / testgui.py View on Github external
def on_activate(self):
        """This creates all the necessary UI elements.
        """
        self._mw = QtWidgets.QMainWindow()
        self._mw.setGeometry(300,300,500,100)
        self._mw.setWindowTitle('TEST')
        self.cwdget = QtWidgets.QWidget()
        self.button = QtWidgets.QPushButton(self.buttonText)
        self.buttonerror = QtWidgets.QPushButton('Giff Error!')
        self.checkbutton = QtWidgets.QPushButton('Status Error')
        self.checkbutton.setCheckable(True)
        self.button.clicked.connect(self.handleButton)
        self.buttonerror.clicked.connect(self.handleButtonError)
        self.layout = QtWidgets.QVBoxLayout()
        self.layout.addWidget(self.button)
        self.layout.addWidget(self.buttonerror)
        self.layout.addWidget(self.checkbutton)
        self.cwdget.setLayout(self.layout)
        self._mw.setCentralWidget(self.cwdget)
        self._mw.show()
github avalentino / gsdview / tests / test_gdalbackend_widgets.py View on Github external
def test_gdalinfowidget():
    app = QtWidgets.QApplication(sys.argv)
    dialog = QtWidgets.QDialog()
    layout = QtWidgets.QVBoxLayout()
    layout.addWidget(GDALInfoWidget())
    dialog.setLayout(layout)
    dialog.resize(500, 400)
    dialog.show()
    app.exec_()
github avalentino / gsdview / tests / test_ogrqt.py View on Github external
def _setupHelpActions(self):
        actions = QtWidgets.QActionGroup(self)

        icon = QtGui.QIcon.fromTheme('dialog-information')
        QtWidgets.QAction(
            icon, self.tr('About'), actions,
            objectName='aboutAction',
            statusTip=self.tr('About'),
            triggered=self.about)

        icon = QtGui.QIcon(':qtlogo-64')
        QtWidgets.QAction(
            icon, self.tr('About Qt'), actions,
            objectName='aboutQtAction',
            statusTip=self.tr('About Qt'),
            triggered=QtWidgets.QApplication.aboutQt)

        return actions
github MTgeophysics / mtpy / tests / SmartMT / test_exportDialog.py View on Github external
def _fake_msg_dialog_exec_overwrite(self):
        self.dialog._msg_box.show()
        QTest.qWaitForWindowActive(self.dialog._msg_box)
        _click_area(self.dialog._msg_box_button_overwrite)
        return QMessageBox.Accepted
github avalentino / gsdview / tests / test_ogrqt.py View on Github external
# Layer Actions
        layeractions = self.layermanager.actions

        menu = QtWidgets.QMenu('Layer', self)
        menu.addActions(layeractions.actions())
        self.menuBar().addMenu(menu)

        toolbar = QtWidgets.QToolBar('Layer toolbar')
        toolbar.addActions(layeractions.actions())
        self.addToolBar(toolbar)

        # Help action
        self.helpactions = self._setupHelpActions()

        menu = QtWidgets.QMenu('Help', self)
        menu.addActions(self.helpactions.actions())
        self.menuBar().addMenu(menu)

        toolbar = QtWidgets.QToolBar('Help toolbar', self)
        toolbar.addActions(self.helpactions.actions())
        self.addToolBar(toolbar)

        self.resize(900, 500)
        self.reset()
        self.statusBar().showMessage('Ready')
github Fluorescence-Tools / chisurf / mfm / tools / f_test / f_calculator.py View on Github external
def read_n1(self):
        menu = QtWidgets.QMenu()
        for f in mfm.fits:
            for fs in f:
                Action = menu.addAction(fs.name)
                Action.triggered.connect(
                    self.read_v((fs, self.spinBox, self.doubleSpinBox))
                )
        self.toolButton.setMenu(menu)
github VIDA-NYU / reprozip / reprounzip-qt / reprounzip_qt / gui / run.py View on Github external
def __init__(self):
        super(DockerOptions, self).__init__()

        self.x11 = QtWidgets.QCheckBox("enabled", checked=False)
        self.tunneled_x11 = QtWidgets.QCheckBox("use tunnel", checked=False)
        row = QtWidgets.QHBoxLayout()
        row.addWidget(self.x11)
        row.addWidget(self.tunneled_x11)
        row.addStretch(1)
        self.add_row_layout("X11 display:", row)

        self.detach = QtWidgets.QCheckBox("start background container and "
                                          "leave it running",
                                          checked=False)
        self.add_row("Detach:", self.detach)

        self.raw_options = QtWidgets.QLineEdit('')
        self.add_row("Raw Docker options:", self.raw_options)

        self.ports = QtWidgets.QLineEdit(
github ScopeFoundry / ScopeFoundry / helper_funcs.py View on Github external
def eventFilter(self, obj, event):
        """
        Listens for QtCore.QEvent.Close signal and asks the user whether to
        close the app in a pop-up dialog."""
        if event.type() == QtCore.QEvent.Close:
            # eat close event
            logging.debug("close")
            reply = QtWidgets.QMessageBox.question(None, 
                                               self.title, 
                                               self.message,
                                               QtWidgets.QMessageBox.Yes, 
                                               QtWidgets.QMessageBox.No)
            if reply == QtWidgets.QMessageBox.Yes:
                logging.debug("closing")
                if self.func_on_close:
                    self.func_on_close()
                QtWidgets.QApplication.quit()
                event.accept()
            else:
                event.ignore()
            return True
        else:
            # standard event processing            
            return QtCore.QObject.eventFilter(self,obj, event)