How to use the qtpy.QtCore.Qt function in QtPy

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 slaclab / rogue / python / pyrogue / pydm / widgets / run_control.py View on Github external
fl.setRowWrapPolicy(QFormLayout.DontWrapRows)
        fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop)
        fl.setLabelAlignment(Qt.AlignRight)
        vb.addLayout(fl)

        w = PyDMEnumComboBox(parent=None, init_channel=self._path + '.runRate')
        w.alarmSensitiveContent = False
        w.alarmSensitiveBorder  = False
        fl.addRow('Run Rate:',w)

        hb = QHBoxLayout()
        vb.addLayout(hb)

        fl = QFormLayout()
        fl.setRowWrapPolicy(QFormLayout.DontWrapRows)
        fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop)
        fl.setLabelAlignment(Qt.AlignRight)
        hb.addLayout(fl)

        w = PyDMEnumComboBox(parent=None, init_channel=self._path + '.runState')
        w.alarmSensitiveContent = False
        w.alarmSensitiveBorder  = False
        fl.addRow('Run State:',w)

        fl = QFormLayout()
        fl.setRowWrapPolicy(QFormLayout.DontWrapRows)
        fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop)
        fl.setLabelAlignment(Qt.AlignRight)
        hb.addLayout(fl)

        w = PyDMLineEdit(parent=None, init_channel=self._path + '.runCount')
        w.showUnits             = False
github Ulm-IQO / qudi / logic / single_shot_logic.py View on Github external
def on_activate(self):
        """ Initialisation performed during activation of the module.
        """


        # QTimer must be created here instead of __init__ because otherwise the timer will not run
        # in this logic's thread but in the manager instead.
        self.__analysis_timer = QtCore.QTimer()
        self.__analysis_timer.setSingleShot(False)
        self.__analysis_timer.setInterval(round(1000. * self.timer_interval))
        self.__analysis_timer.timeout.connect(self._ssr_analysis_loop,
                                              QtCore.Qt.QueuedConnection)

        # Fitting
        self.fc = self.fitlogic().make_fit_container('pulsed', '1d')
        self.fc.set_units(['s', 'arb.u.'])

        self.timer_pulsed_old = self.pulsedmeasurementlogic().timer_interval

        # Recall saved status variables
        if 'fits' in self._statusVariables and isinstance(self._statusVariables.get('fits'), dict):
            self.fc.load_from_dict(self._statusVariables['fits'])

        # Turn off pulse generator
        self.pulsedmeasurementlogic().pulse_generator_off()


        # update gui
github kcjengr / qtpyvcp / qtpyvcp / widgets / dialogs / offsets_dialog.py View on Github external
"P9": "P9 G59.3"
                         }

        for key, value in OrderedDict(sorted(coord_systems.items(), key=lambda t: t[0])).items():
            self.system_combo.addItem(value, key)

        close_button = QPushButton("Close")
        set_button = QPushButton("Set")

        main_layout = QVBoxLayout()
        button_layout = QHBoxLayout()

        button_layout.addWidget(close_button)
        button_layout.addWidget(set_button)

        main_layout.addWidget(self.axis_combo, alignment=Qt.AlignTop)
        main_layout.addWidget(coords_msg, alignment=Qt.AlignLeft | Qt.AlignTop)
        main_layout.addWidget(self.coords_input, alignment=Qt.AlignTop)
        main_layout.addWidget(system_msg, alignment=Qt.AlignLeft | Qt.AlignTop)
        main_layout.addWidget(self.system_combo, alignment=Qt.AlignBottom)
        main_layout.addLayout(button_layout)

        self.setLayout(main_layout)
        self.setWindowTitle("Regular Offsets")

        set_button.clicked.connect(self.set_method)
        close_button.clicked.connect(self.close_method)

        self.setWindowFlags(Qt.Popup)
github Dioptas / Dioptas / dioptas / widgets / MapWidgets.py View on Github external
def __init__(self, parent):
        super(SetupMapDialog, self).__init__(parent)

        self.setWindowTitle("Setup Map")

        self._parent = parent
        self._create_widgets()
        self._layout_widgets()
        self._style_widgets()

        self.setWindowFlags(QtCore.Qt.Tool)
        self.setAttribute(QtCore.Qt.WA_MacAlwaysShowToolWindow)

        self._connect_widgets()
        self.approved = False
github Ulm-IQO / qudi / gui / pulsed / pulsed_maingui_new.py View on Github external
label.setObjectName(name_label)
            self._gs.gridLayout_3.addWidget(label, index, 0, 1, 1)
            label.setText(QtWidgets.QApplication.translate(objectname, func_name, None, _encoding))

            name_checkbox = 'checkbox_' + str(index)
            setattr(self._gs, name_checkbox, QtWidgets.QCheckBox(self._gs.groupBox))
            checkbox = getattr(self._gs, name_checkbox)
            checkbox.setObjectName(name_checkbox)
            self._gs.gridLayout_3.addWidget(checkbox, index, 1, 1, 1)
            checkbox.setText(QtWidgets.QApplication.translate(objectname, '', None, _encoding))
        # make the first 4 Functions as default.
        # FIXME: the default functions, must be passed as a config
        for index in range(4):
            name_checkbox = 'checkbox_' + str(index)
            checkbox = getattr(self._gs, name_checkbox)
            checkbox.setCheckState(QtCore.Qt.Checked)
        return
github scikit-rf / scikit-rf / qtapps / skrf_qtwidgets / widgets.py View on Github external
def __init__(self, title="", msg="", parent=None):
        super(OverwriteFilesQuery, self).__init__(parent)
        self.verticalLayout = QtWidgets.QVBoxLayout(self)
        self.textBrowser = QtWidgets.QTextBrowser(self)
        self.verticalLayout.addWidget(self.textBrowser)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.buttonBox = QtWidgets.QDialogButtonBox(self)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.No|QtWidgets.QDialogButtonBox.Yes|QtWidgets.QDialogButtonBox.YesToAll)

        self.choice = None

        self.yes = self.buttonBox.button(QtWidgets.QDialogButtonBox.Yes)
        self.yesToAll = self.buttonBox.button(QtWidgets.QDialogButtonBox.YesToAll)
        self.no = self.buttonBox.button(QtWidgets.QDialogButtonBox.No)
        self.cancel = self.buttonBox.button(QtWidgets.QDialogButtonBox.Cancel)
        self.yes.clicked.connect(self.set_yes)
        self.yesToAll.clicked.connect(self.set_yesToAll)
        self.no.clicked.connect(self.set_no)
        self.cancel.clicked.connect(self.set_cancel)

        self.horizontalLayout.addWidget(self.buttonBox)
        self.verticalLayout.addLayout(self.horizontalLayout)
github spyder-ide / spyder / spyder / plugins / editor / panels / codefolding.py View on Github external
def _on_key_pressed(self, event):
        """
        Override key press to select the current scope if the user wants
        to deleted a folded scope (without selecting it).
        """
        delete_request = event.key() in [Qt.Key_Backspace,
                                         Qt.Key_Delete]
        if event.text() or delete_request:
            cursor = self.editor.textCursor()
            if cursor.hasSelection():
                # change selection to encompass the whole scope.
                positions_to_check = cursor.selectionStart(), cursor.selectionEnd()
            else:
                positions_to_check = (cursor.position(), )
            for pos in positions_to_check:
                block = self.editor.document().findBlock(pos)
                start_line = block.blockNumber() + 1
                if (start_line in self.folding_regions and
                        self.folding_status[start_line]):
                    end_line = self.folding_regions[start_line]
                    self.toggle_fold_trigger(block.next())
                    if delete_request and cursor.hasSelection():
                        tc = TextHelper(self.editor).select_lines(start_line, end_line)
github sharppy / SHARPpy / sharppy / viz / ensemble.py View on Github external
def draw_ensemble_point(self, qp, prof):
        # Plot the profile index on the scatter plot
        if 'pbl_h' not in dir(prof): # Make sure a PBL top has been found in the profile object
            ppbl_top = params.pbl_top(prof)
            setattr(prof, 'pbl_h', interp.to_agl(prof, interp.hght(prof, ppbl_top)))
        if 'sfcpcl' not in dir(prof): # Make sure a surface parcel has been lifted in the profile object
            setattr(prof, 'sfcpcl', params.parcelx(prof, flag=1 ))
        #x = self.x_to_xpix()
        #y = self.y_to_ypix()
        color = QtCore.Qt.red
        qp.setPen(QtGui.QPen(color))
        qp.setBrush(QtGui.QBrush(color))
        x = self.x_to_xpix(prof.pbl_h) - 50 / 2.
        y = self.y_to_ypix(prof.sfcpcl.bplus) - (self.fsize-1) / 2
        qp.drawEllipse(x, y, 3, 3)

        return