def __init__(self, parent): super(PresenceDialog, self).__init__(parent) self.model = QuickComboModel(None) self.tar_type_edit = TaskActionReportTypeComboBox("action_type", _("Action"), nullable=False) self.tar_type_edit.set_model( [TaskActionReportType.day_in, TaskActionReportType.day_out]) self.start_time_edit = TimeStampEdit("start_time", _("Start time"), nullable=False) self.form_fields = [self.tar_type_edit, self.start_time_edit] form_layout = QFormLayout() form_layout.addRow(_("Action"), self.tar_type_edit.widget) form_layout.addRow(_("Start time"), self.start_time_edit.widget) self.buttons = QDialogButtonBox() self.buttons.addButton(QDialogButtonBox.Ok) self.buttons.addButton(QDialogButtonBox.Cancel) self.buttons.accepted.connect(self.save_and_accept) self.buttons.rejected.connect(self.cancel) top_layout = QVBoxLayout() top_layout.addLayout(form_layout) top_layout.addWidget(self.buttons) self.setLayout(top_layout)
def setUpUI(self): layout = QVBoxLayout() form = QFormLayout() form.addRow(QLabel("text file"), self.files1) form.addRow(QLabel(".csv file"), self.files2) layout.addLayout(form) self.setLayout(layout)
def _createFormLayout(self): layout = QFormLayout() layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) obsFormat = self._docFormat.getObservationFormat(self._obs.__class__.__name__) fields = dict((f.name, f) for f in self._obs.FIELDS) self._editors = {} for fieldName in obsFormat.fieldOrder: field = fields[fieldName] label = self._getFieldLabel(field) fieldFormat = obsFormat.getFieldFormat(fieldName) value = getattr(self._obs, fieldName) text = fieldFormat.format(value, editing=True) editor = _FieldValueEditor(self, fieldFormat) editor.setText(text) editor.setToolTip(self._getFieldToolTip(field, fieldFormat)) layout.addRow(label, editor) self._editors[fieldName] = editor return layout
def setUpUI(self): layout = QVBoxLayout() form = QFormLayout() form.addRow(QLabel("Satellite Data File"), self.files1) form.addRow(QLabel("Work Station Position DataFile"), self.files2) layout.addLayout(form) self.setLayout(layout)
def __init__(self): super(DirectoryDialog, self).__init__() self.setWindowTitle("Query") rect = QApplication.desktop().screenGeometry() height = rect.height() width = rect.width() self.setGeometry(width / 3, height / 3, width / 3, height / 8) formLayout = QFormLayout() self.dir = QLineEdit() self.dir.setReadOnly(True) formLayout.addRow(QLabel("Select a folder"), self.dir) browseBtn = QPushButton("Browse") browseBtn.clicked.connect(self.browseAction) formLayout.addWidget(browseBtn) btnOk = QPushButton("Ok") btnOk.clicked.connect(self.okAction) btnCancel = QPushButton("Cancel") btnCancel.clicked.connect(self.reject) group = QDialogButtonBox() group.addButton(btnOk, QDialogButtonBox.AcceptRole) group.addButton(btnCancel, QDialogButtonBox.RejectRole) formLayout.addRow(group) self.setLayout(formLayout) self.setWindowIcon(QIcon("res/SplashScreen.png")) self.__result = None
def initialize(self, words): self.removeComboBox = QComboBox() self.removeComboBox.addItems(words) self.tooltips.append((self.removeComboBox, """\ <p><b>Spelling Words combobox</b></p> <p>This index's list of words that have been remembered as correctly spelled or to be ignored even though they aren't in the dictionary for the index's language.</p>""")) self.helpButton = QPushButton(QIcon(":/help.svg"), "Help") self.tooltips.append((self.helpButton, "Help on the Forget Spelling Words dialog")) self.removeButton = QPushButton(QIcon(":/spelling-remove.svg"), "&Forget") self.tooltips.append((self.removeButton, """\ <p><b>Forget</b></p> <p>Permanently forget the selected word from the index's spelling words list. Afterwards, if this word appears in any entry, it will be highlighted as misspelled.</p>""")) closeButton = QPushButton(QIcon(":/dialog-close.svg"), "&Close") self.tooltips.append((closeButton, """<p><b>Close</b></p> <p>Close the dialog.</p>""")) self.buttonBox = QDialogButtonBox() self.buttonBox.addButton(closeButton, QDialogButtonBox.RejectRole) self.buttonBox.addButton( self.removeButton, QDialogButtonBox.ApplyRole) self.buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole) layout = QFormLayout() layout.addRow("F&orget", self.removeComboBox) layout.addRow(self.buttonBox) self.setLayout(layout) self.helpButton.clicked.connect(self.help) self.removeButton.clicked.connect(self.remove) self.buttonBox.rejected.connect(self.reject)
class FormWidget(QWidget): def __init__(self, parent=None, submit_callback=None, inputs=None): super(FormWidget, self).__init__(parent) if inputs is None: inputs = {} self.submit_callback = submit_callback self.form = QFormLayout() self.inputs = {} for key in inputs: self.inputs[key] = QLineEdit() self.form.addRow(QLabel(key), self.inputs[key]) self.submitButton = QPushButton("Submit") self.submitButton.clicked.connect(self.button_pushed) self.form.addRow(self.submitButton) self.setLayout(self.form) def button_pushed(self, checked): if self.submit_callback: values = {key: self.inputs[key].text() for key in self.inputs} self.submit_callback(values)
def __init__(self, parent): global configuration super(EditConfigurationDialog, self).__init__(parent) title = _("Preferences") self.setWindowTitle(title) self.title_widget = TitleWidget(title, self) self.buttons = QDialogButtonBox() self.buttons.addButton(QDialogButtonBox.Ok) self.buttons.addButton(QDialogButtonBox.Cancel) self.font_select = QCheckBox() self.server_address = QLineEdit() form_layout = QFormLayout() form_layout.addRow(_("Fonts"), self.font_select) form_layout.addRow(_("Server's IP address"), self.server_address) top_layout = QVBoxLayout() top_layout.addWidget(self.title_widget) top_layout.addLayout(form_layout) top_layout.addWidget(self.buttons) self.setLayout(top_layout) # QWidget takes ownership of the layout self.buttons.accepted.connect(self.save_and_accept) self.buttons.rejected.connect(self.cancel) self._load_configuration(configuration)
def __init__(self, parameter, parent=None): _ParameterWidget.__init__(self, parameter, parent) # Widgets self._lbl_u = QLabel('u') self._lbl_u.setStyleSheet("color: blue") self._txt_u = MultiNumericalLineEdit() self._lbl_v = QLabel('v') self._lbl_v.setStyleSheet("color: blue") self._txt_v = MultiNumericalLineEdit() self._lbl_w = QLabel('w') self._lbl_w.setStyleSheet("color: blue") self._txt_w = MultiNumericalLineEdit() # Layouts layout = QFormLayout() layout.setContentsMargins(0, 0, 0, 0) if sys.platform == 'darwin': # Fix for Mac OS layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) layout.addRow(self._lbl_u, self._txt_u) layout.addRow(self._lbl_v, self._txt_v) layout.addRow(self._lbl_w, self._txt_w) self.setLayout(layout) # Signals self.valuesChanged.connect(self._onChanged) self.validationRequested.connect(self._onChanged) self._txt_u.textChanged.connect(self.valuesChanged) self._txt_v.textChanged.connect(self.valuesChanged) self._txt_w.textChanged.connect(self.valuesChanged) self.validationRequested.emit()
def __init__(self): super(PhoneFrame, self).__init__() self.setWindowTitle('Phone Book.') self.name = QLineEdit() self.number = QLineEdit() entry = QFormLayout() entry.addRow(QLabel('Name'), self.name) entry.addRow(QLabel('Number'), self.number) buttons = QHBoxLayout() button = QPushButton('&Add') button.clicked.connect(self._addEntry) buttons.addWidget(button) button = QPushButton('&Update') button.clicked.connect(self._updateEntry) buttons.addWidget(button) button = QPushButton('&Delete') button.clicked.connect(self._deleteEntry) buttons.addWidget(button) dataDisplay = QTableView() dataDisplay.setModel(PhoneDataModel()) layout = QVBoxLayout() layout.addLayout(entry) layout.addLayout(buttons) layout.addWidget(dataDisplay) self.setLayout(layout) self.show()
def __init__(self,parent=None): super(QtReducePreferencesComputation,self).__init__(parent) reduceGroup = QGroupBox("Reduce") self.reduceBinary = QLineEdit() # font = self.reduceBinary.font() # font.setFamily(QSettings().value("worksheet/fontfamily", # QtReduceDefaults.FONTFAMILY)) # self.reduceBinary.setFont(font) self.reduceBinary.setText(QSettings().value("computation/reduce", QtReduceDefaults.REDUCE)) self.reduceBinary.editingFinished.connect(self.editingFinishedHandler) reduceLayout = QFormLayout() reduceLayout.addRow(self.tr("Reduce Binary"),self.reduceBinary) reduceGroup.setLayout(reduceLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(reduceGroup) self.setLayout(mainLayout)
def SetFLayout(self): formLayout = QFormLayout(self) labelUsername = QLabel("Username") txtUsername = QLineEdit() labelPassword = QLabel("Password") txtPassword = QLineEdit() formLayout.addRow(labelUsername, txtUsername) formLayout.addRow(labelPassword, txtPassword) self.setLayout(formLayout)
def _create_field_controls(self): """Creates QWidgets for editing each field in DWC_TERMS and returns tuple of two dicts ({ field name: control }, { group name: QGroupBox } """ # Mapping { field name: control } controls = {} # Mapping { group name: ToggleFrame } groups = {} current_group = group_layout = None def finish_group(): # Finish the existing group debug_print('Finishing', current_group) # The widget that holds this group's controls controls_widget = QWidget() controls_widget.setLayout(group_layout) controls_widget.setVisible(False) # The group box, which contains the label to toggle the controls# # and the controls themselves group_box_layout = QVBoxLayout() group_box_layout.addWidget( ToggleWidgetLabel(current_group, controls_widget)) group_box_layout.addWidget(controls_widget) group_box = QGroupBox() group_box.setLayout(group_box_layout) # Add the group box to the main layout self._main_layout.addRow(group_box) #self._main_layout.addWidget(group_box) groups[current_group] = group_box # Create controls and group boxes for field in DWC_TERMS: if field['Group label'] != current_group: if current_group: finish_group() group_layout = QFormLayout() group_layout.setFieldGrowthPolicy( QFormLayout.ExpandingFieldsGrow) current_group = field['Group label'] # Create control for this field control = self._create_field_control(field) group_layout.addRow(URLLabel(field['URI'], field['Label']), control) controls[field['Name']] = control finish_group() return controls, groups
def SetLayout(self): formLayout = QFormLayout(self) labelUsername = QLabel("Username") txtUsername = QLineEdit() labelPassword = QLabel("Password") txtPassword = QLineEdit() formLayout.addRow(labelUsername, txtUsername) formLayout.addRow(labelPassword, txtPassword) self.setLayout(formLayout)
def initUI(self): self.fileWidget = FileBrowseWidget("Firmware file .hex (*.hex)") layout = QFormLayout() layout.addRow(QLabel("Firmware file (.hex):"), self.fileWidget) label = QLabel("<b>Note:</b> after updating the firmware, all layout " "and device settings will be erased.") label.setTextInteractionFlags(Qt.TextSelectableByMouse) layout.addRow(label) self.setLayout(layout)
def setLayoutForm(self): """Présentation du QFormLayout""" self.setWindowTitle("Form Layout") formLayout = QFormLayout(self) labelUser = QLabel("Username") txtUser = QLineEdit() labelPass = QLabel("Password") txtPass = QLineEdit() formLayout.addRow(labelUser, txtUser) formLayout.addRow(labelPass, txtPass) self.setLayout(formLayout)
def SetLayout(self): formLayout = QFormLayout(self) lUsername = QLabel("Username") txtUsername = QLineEdit() lPasswd = QLabel("Passwd") txPasswd = QLineEdit() formLayout.addRow(lUsername, txtUsername) formLayout.addRow(lPasswd, txPasswd) self.setLayout(formLayout)
def setLayoutForm(self): """Présentation du QFormLayout""" self.setWindowTitle("Form Layout") formLayout = QFormLayout(self) labelUser = QLabel("Username") txtUser = QLineEdit() labelPass = QLabel("Password") txtPass = QLineEdit() formLayout.addRow(labelUser, txtUser) formLayout.addRow(labelPass, txtPass) self.setLayout(formLayout)
def __init__(self): QDialog.__init__(self) layout = QFormLayout(self) self.setLayout(layout) layout.addRow("Python version:", QLabel("%s.%s.%s (%s)" % (sys.version_info[0], sys.version_info[1], sys.version_info[2], sys.version_info[3]))) layout.addRow("Qt version:", QLabel( qVersion()))
def layoutWidgets(self): layout = QFormLayout() layout.addRow(self.termLabelLabel, self.termLabel) layout.addRow("Pages", self.originalPagesLabel) layout.addRow("Pages if Combined", self.combinedPagesLabel) layout.addRow(self.buttonBox) self.setLayout(layout)
def testGetItemPosition(self): formlayout = QFormLayout() row, role = formlayout.getItemPosition(0) self.assert_(isinstance(row, int)) self.assert_(isinstance(role, QFormLayout.ItemRole)) self.assertEqual(row, -1) widget = QWidget() formlayout.addRow(widget) row, role = formlayout.getItemPosition(0) self.assert_(isinstance(row, int)) self.assert_(isinstance(role, QFormLayout.ItemRole)) self.assertEqual(row, 0) self.assertEqual(role, QFormLayout.SpanningRole)
def initUI(self): self.layoutFile = FileBrowseWidget( "Layout settings file .yaml (*.yaml)") self.layoutFile.setText(DEFAULT_LAYOUT_FILE) self.rfSettingsFile = FileBrowseWidget( "Device settings file .yaml (*.yaml)") self.rfSettingsFile.setText(DEFAULT_RF_FILE) layout = QFormLayout() layout.addRow(QLabel("Layout settings file (.yaml):"), self.layoutFile) layout.addRow(QLabel("RF settings file (.yaml):"), self.rfSettingsFile) self.idLine = QLineEdit() self.idLine.setText(str(DEFAULT_DEVICE_ID)) self.idLine.setMaximumWidth(50) self.idLine.setValidator(QIntValidator(0, 63)) layout.addRow(QLabel("Device id (0-63):"), self.idLine) self.generateButton = QPushButton("Generate new RF settings") self.generateButton.setMaximumWidth(230) self.generateButton.clicked.connect(self.generateRFSettings) layout.addRow(None, self.generateButton) label = QLabel( "<b>Note:</b> These settings only need to be loaded on each " "device once and are persistent when you update the layout. " "To ensure proper operation and security, each device must " "have a unique device ID for a given RF settings file. " "Since RF settings file contains your encryption key, make " "sure to keep it secret.") label.setTextInteractionFlags(Qt.TextSelectableByMouse) label.setWordWrap(True) layout.addRow(label) self.setLayout(layout)
def testGetItemPosition(self): formlayout = QFormLayout() row, role = formlayout.getItemPosition(0) self.assert_(isinstance(row, int)) self.assert_(isinstance(role, QFormLayout.ItemRole)) self.assertEqual(row, -1) widget = QWidget() formlayout.addRow(widget) row, role = formlayout.getItemPosition(0) self.assert_(isinstance(row, int)) self.assert_(isinstance(role, QFormLayout.ItemRole)) self.assertEqual(row, 0) self.assertEqual(role, QFormLayout.SpanningRole)
def setup_general_server_group(self): """ Setup the 'Server' group in the 'General' tab. Returns: -------- A QGroupBox widget """ group = QGroupBox('Server') layout = QFormLayout() layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) email, password = self.auth_credentials() self.email_edit = QLineEdit(email) self.email_edit.textChanged.connect(self.update_auth) layout.addRow('Email', self.email_edit) self.password_edit = QLineEdit(password) self.password_edit.setEchoMode(QLineEdit.Password) self.password_edit.textChanged.connect(self.update_auth) layout.addRow('Password', self.password_edit) show_password_widget = QCheckBox() show_password_widget.stateChanged.connect(self.on_show_password_toggle) layout.addRow('Show password', show_password_widget) test_authentication_button = QPushButton('Test Authentication') test_authentication_button.clicked.connect(self.on_test_authentication) layout.addRow(test_authentication_button) group.setLayout(layout) return group
def _initUI(self): # Widgets self._txt_showers = QLineEdit() self._txt_showers.setText(str(self.result().showers)) # Layouts layout = _SaveableResultWidget._initUI(self) sublayout = QFormLayout() if sys.platform == "darwin": # Fix for Mac OS layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) sublayout.addRow("Number of showers", self._txt_showers) layout.addLayout(sublayout) layout.addStretch() return layout
def __init__(self,parent=None): super(QtReducePreferencesToolBar,self).__init__(parent) settings = QSettings() toolBarGroup = QGroupBox(self.tr("Toolbar")) self.iconSetCombo = QtReduceComboBox() iDbKeys = QtReduceIconSets().db.keys() iDbKeys.sort() self.iconSetCombo.addItems(iDbKeys) settings.setValue("toolbar/iconset","Oxygen") # Hack traceLogger.debug("toolbar/iconset=%s" % settings.value("toolbar/iconset")) self.iconSetCombo.setCurrentIndex( self.iconSetCombo.findText( settings.value("toolbar/iconset",QtReduceDefaults.ICONSET))) self.iconSizeCombo = QtReduceIconSizeComboBox() self.iconSizeCombo.addItems(["16","22","32"]) self.iconSizeCombo.setCurrentIndex( self.iconSizeCombo.findText( str(settings.value("toolbar/iconsize", QtReduceDefaults.ICONSIZE)))) self.showCombo = QtReduceComboBox() self.showCombo.addItems([self.tr("Symbol and Text"), self.tr("Only Symbol"), self.tr("Only Text")]) self.showCombo.setCurrentIndex(self.showCombo.findText( settings.value("toolbar/buttonstyle", self.tr(QtReduceDefaults.BUTTONSTYLE)))) toolBarLayout = QFormLayout() # toolBarLayout.addRow(self.tr("Symbol Set"),self.iconSetCombo) toolBarLayout.addRow(self.tr("Symbol Size"),self.iconSizeCombo) toolBarLayout.addRow(self.tr("Show"),self.showCombo) toolBarGroup.setLayout(toolBarLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(toolBarGroup) self.setLayout(mainLayout)
def initUI(self): self.fileWidget = FileBrowseWidget("Layout file (*.yaml)") layout = QFormLayout() layout.addRow(QLabel("Layout file (.yaml): "), self.fileWidget) label = QLabel( "<b>Note:</b> Each device that can act as a " "wireless/wired receiver stores its own copy of the " "layout settings. The other devices will still function " "when the layout is updated, but they will use their " "old version of the layout instead. " "You can intentionally load different layouts on different " "keyboard components to have different layout options depending " "on which device is acting as the receiver.") label.setTextInteractionFlags(Qt.TextSelectableByMouse) label.setWordWrap(True) layout.addRow(label) self.setLayout(layout)
def setup_advanced_server_group(self): """ Setup the 'Server' group in the 'Advanced' tab. Returns: -------- A QGroupBox widget """ group = QGroupBox('Server') layout = QFormLayout() layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) self.message_url_edit = QLineEdit(Config.get('WS_HOST', '')) self.message_url_edit.textChanged.connect(self.update_message_url) layout.addRow('Messages API URL', self.message_url_edit) group.setLayout(layout) return group
def setup_advanced_storage_group(self): """ Setup the 'Storage' group in the 'Advanced' tab. Returns: -------- A QGroupBox widget """ group = QGroupBox('Storage') layout = QFormLayout() layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) path = Config.get('WEB_SOURCE_STORE', '') self.message_storage_edit = QLineEdit(path) self.message_storage_edit.textChanged.connect(self.update_message_storage) layout.addRow('Message Storage Path', self.message_storage_edit) group.setLayout(layout) return group
def __init__(self, parent): super(TimeEditDialog, self).__init__(parent) self.in_validation = False self.last_validated_identifier = None self.identifier_editor = OrderPartIdentifierEdit("identifier", _("identifier"), parent=self) self.identifier_editor.widget.editingFinished.connect( self.identifier_set) # self.identifier_widget = QLineEdit(self) # self.identifier_widget_validator = OrderPartIdentifierValidator() # self.identifier_widget.setValidator(self.identifier_widget_validator) # self.identifier_widget.editingFinished.connect(self.identifier_set) self.task_widget = AutoCompleteComboBox(None, self) self.task_widget.section_width = [300] self.task_widget.currentIndexChanged.connect(self.operation_set) self.tar_type_editor = TaskActionReportTypeComboBox( "tar_type", _("Action")) self.tar_type_editor.set_model( [TaskActionReportType.start_task, TaskActionReportType.stop_task]) self.machine_editor = ConstrainedMachineEdit("machine_id", _("Machine")) # self.machine_editor = AutoCompleteComboBox(None,self) # self.machine_editor.set_model(machine_service.find_machines_for_operation_definition(proxy.operation_definition_id)) self.start_time_editor = TimeStampEdit("start_time", _("Start time"), nullable=False) form_layout = QFormLayout() form_layout.addRow(_("Identifier"), self.identifier_editor.widget) form_layout.addRow(_("Task"), self.task_widget) form_layout.addRow(_("Machine"), self.machine_editor.widget) form_layout.addRow(_("Action"), self.tar_type_editor.widget) form_layout.addRow(_("Start time"), self.start_time_editor.widget) top_layout = QVBoxLayout() top_layout.addLayout(form_layout) self.buttons = QDialogButtonBox() self.buttons.addButton(QDialogButtonBox.Ok) self.buttons.addButton(QDialogButtonBox.Cancel) top_layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.cancel) self.setLayout(top_layout)
def __init__(self, parent=None): super(WranglerDialog, self).__init__(parent) layout = QFormLayout(self) self.wrangler_field = QLineEdit("") layout.addRow("Wrangler:", self.wrangler_field) # OK and Cancel buttons self.buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) self.setWindowTitle("Set Wrangler") self.resize(250, 100)
def __init__(self, wdg_limit, parent=None): QDialog.__init__(self, parent) self.setWindowTitle(wdg_limit.accessibleName()) # Widgets self._wdg_limit = wdg_limit buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) # Layouts layout = QFormLayout() layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) # Fix for Mac OS layout.addRow(self._wdg_limit) layout.addRow(buttons) self.setLayout(layout) # Signals buttons.accepted.connect(self._onOk) buttons.rejected.connect(self.reject)
def __init__(self): ''' Constructor ''' super(LoginDialog, self).__init__() formLayout = QFormLayout() self.input1 = QLineEdit() self.input2 = QLineEdit() self.input2.setEchoMode(QLineEdit.EchoMode.Password) self.input3 = QLineEdit() self.input3.setEchoMode(QLineEdit.EchoMode.Password) self.cb = QComboBox() self.cb.addItems(["Sef stanice", "Radnik u centrali", "Radnik na naplatnom mestu", "Admin"]) palete = QPalette() palete.setColor(self.backgroundRole(), Qt.black) self.setPalette(palete) self.setWindowTitle("Login") self.resize(370, 100) label2 = QLabel("<font color='White'>Username</font>") label3 = QLabel("<font color='White'>Password</font>") label4 = QLabel("<font color='White'>Registration key</font>") label5 = QLabel("<font color='White'>Role</font>") formLayout.addRow(label2, self.input1) formLayout.addRow(label3, self.input2) btnOK = QPushButton("Login") btnOK.clicked.connect(self.loginAction) btnCancel = QPushButton("Cancel") btnCancel.clicked.connect(self.reject) btnRegister = QPushButton("Register") btnRegister.clicked.connect(self.registerAction) group = QDialogButtonBox() group.addButton(btnOK, QDialogButtonBox.AcceptRole) group.addButton(btnCancel, QDialogButtonBox.RejectRole) formLayout.addRow(group) formLayout.addRow(label4, self.input3) formLayout.addRow(label5, self.cb) formLayout.addWidget(btnRegister) self.result = None self.setLayout(formLayout)
def layoutWidgets(self): form = QFormLayout() form.addRow(self.addingLabel) hbox = QHBoxLayout() hbox.addWidget(self.termEdit, 1) hbox.addWidget(self.helpButton) form.addRow(self.termLabel, hbox) form.addRow(self.pagesLabel, self.pagesEdit) hbox = QHBoxLayout() hbox.addWidget(self.calcSortAsCheckBox, 1) hbox.addWidget(self.sortAsHelpButton) form.addRow(hbox) form.addRow(self.sortAsLabel, self.sortAsEdit) vbox = QVBoxLayout() vbox.addLayout(form) vbox.addWidget(self.xrefLabel) vbox.addWidget(self.xrefList, 1) vbox.addWidget(self.notesLabel) vbox.addWidget(self.notesEdit, 1) self.setLayout(vbox)
def _table(self, a): if self.mySQL.do: da_2 = QDialog(self.app) if self.Data_Name != None: da_2.setWindowTitle("%s in %s" % (a.text(), self.Data_Name)) da_2.resize(500, 280) line = QLineEdit() edi_t = edit.editText() but = QPushButton('Create') vbox = QVBoxLayout(da_2) form = QFormLayout() form.addRow(QLabel("Name Table"), line) vbox.addLayout(form) vbox.addWidget(edi_t) vbox.addWidget(but) but.clicked.connect(lambda: self.mySQL.create_table( self.Data_Name, line.text(), edi_t.toPlainText())) self.app.ref = True da_2.exec_() else: MsgBox_2().showMsg("Plz Select Database ")
def drop_table(self, a): if self.mySQL.do: if self.Data_Name != None: da = QDialog(self.app) da.setWindowTitle("%s From %s" % (a.text(), self.Data_Name)) da.setFixedSize(300, 100) form = QFormLayout(da) lin = QLineEdit() lin.setFont(QFont("", 14)) but = QPushButton("Delete Table") but.clicked.connect( lambda: self.mySQL.drop_table(self.Data_Name, lin.text())) form.addRow(QLabel("<h3>Name Table</h3>"), lin) form.setSpacing(30) form.addRow(but) self.app.ref = True da.exec_() else: MsgBox_2().showMsg("Plz Select Database") else: MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
def data(self, a): if self.mySQL.do: di_ac = { "Create Database": self.mySQL.create_data, "Delete Database": self.mySQL.drop_data, } da = QDialog(self.app) da.setFixedSize(300, 100) form = QFormLayout(da) lin = QLineEdit() lin.setFont(QFont("", 14)) but = QPushButton("%s" % str(a.text()).split(' ')[0]) but.clicked.connect(lambda: di_ac[a.text()](lin.text())) form.addRow(QLabel("<h3>Name Database</h3>"), lin) form.setSpacing(30) form.addRow(but) da.setWindowTitle("%s" % a.text()) da.exec_() self.app.ref = True else: MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
def _fill_form_layout(self, layout: QtGui.QFormLayout): """ Fill a QGridLayout with all MultiForms and Field, in the right order :param layout: :return: """ all_components = [] for multiform in self._multiforms.values(): all_components.append(multiform) for field in self._fields.values(): all_components.append(field) all_components.sort(key=self._sort_components) for row_index, obj in enumerate(all_components): if isinstance(obj, MultiForm): # a MultiForm already is a QWidget layout.addRow(obj) elif isinstance(obj, SubForm): widget = QtGui.QGroupBox(str(obj.verbose_name), p(self)) sub_layout = QtGui.QFormLayout(p(widget)) obj._fill_form_layout(sub_layout) widget.setLayout(sub_layout) layout.addRow(widget) else: widget = obj.get_widget(self, self) self._widgets[obj.name] = widget obj.set_widget_value(widget, self._values[obj.name]) layout.addRow(obj.label or '', widget)
def __init__(self, wdg_detector, key='', parent=None): QDialog.__init__(self, parent) self.setWindowTitle(wdg_detector.accessibleName()) # Widgets self._txt_key = QLineEdit() self._txt_key.setValidator(QRegExpValidator(QRegExp(r"^(?!\s*$).+"))) self._txt_key.setText(key) self._wdg_detector = wdg_detector buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) # Layouts layout = QFormLayout() layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) # Fix for Mac OS layout.addRow('Key', self._txt_key) layout.addRow(self._wdg_detector) layout.addRow(buttons) self.setLayout(layout) # Signals self._txt_key.textChanged.connect(self._onChanged) self._txt_key.textChanged.emit('') buttons.accepted.connect(self._onOk) buttons.rejected.connect(self.reject)
def __init__(self, parent=None): if not parent: parent = hiero.ui.mainWindow() super(ExportPdfOptionDialog, self).__init__(parent) layout = QFormLayout() self._fileNameField = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter="*.pdf") self._fileNameField.setFilename(os.path.join(os.getenv("HOME"), "Desktop", "Sequence.pdf")) self._optionDropdown = QComboBox() self._buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self._buttonbox.button(QDialogButtonBox.Ok).setText("Export") self._buttonbox.accepted.connect(self.accept) self._buttonbox.rejected.connect(self.reject) self._pdfActionSettings = {"1 Shot per page": [1, 1], "4 Shots per page)": [2, 2], "9 Shots per page)": [3, 3]} for pdfMode in sorted(self._pdfActionSettings, reverse=True): self._optionDropdown.addItem(pdfMode) layout.addRow("Save to:", self._fileNameField) layout.addRow("PDF Layout:", self._optionDropdown) layout.addRow("", self._buttonbox) self.setLayout(layout) self.setWindowTitle("Export PDF Options") self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
def __init__(self, url="", parent=None): super(WSDLDialog, self).__init__() self.setWindowTitle("Select Web Service") layout = QVBoxLayout(self) form = QWidget(self) form_layout = QFormLayout(form) self.wsdl_field = QLineEdit() self.wsdl_field.setText(url) form_layout.addRow("WSDL Address:", self.wsdl_field) layout.addWidget(form) self.auth = QGroupBox("Use HTTP Basic Authentication") self.auth.setCheckable(True) self.auth.setChecked(False) auth_layout = QFormLayout(self.auth) self.user_field = QLineEdit() auth_layout.addRow("Username:"******"Pass:", self.pass_field) layout.addWidget(self.auth) button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) button_box.accepted.connect(self.accept) button_box.rejected.connect(self.reject) layout.addWidget(button_box)
def _initUI(self): # Widgets val, unc = self.result().absorbed self._txt_absorbed = QLineEdit() self._txt_absorbed.setText(u"{0:n} \u00b1 {1:n}".format(val, unc)) self._txt_absorbed.setReadOnly(True) val, unc = self.result().backscattered self._txt_backscattered = QLineEdit() self._txt_backscattered.setText(u"{0:n} \u00b1 {1:n}".format(val, unc)) self._txt_backscattered.setReadOnly(True) val, unc = self.result().transmitted self._txt_transmitted = QLineEdit() self._txt_transmitted.setText(u"{0:n} \u00b1 {1:n}".format(val, unc)) self._txt_transmitted.setReadOnly(True) # Layouts layout = _SaveableResultWidget._initUI(self) sublayout = QFormLayout() if sys.platform == "darwin": # Fix for Mac OS layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) sublayout.addRow("Absorbed fraction", self._txt_absorbed) sublayout.addRow("Backscattered fraction", self._txt_backscattered) sublayout.addRow("Transmitted fraction", self._txt_transmitted) layout.addLayout(sublayout) layout.addStretch() return layout
def __init__(self, parent=None): super(TransferTaskDialog, self).__init__(parent) layout = QFormLayout(self) self.to_queue_selector = QComboBox() self.from_queue_selector = QComboBox() queue_list = cqmanage.cqQueueList() for queue in queue_list: self.to_queue_selector.addItem(str(queue)) self.from_queue_selector.addItem(str(queue)) self.number_to_transfer = QLineEdit("") layout.addRow("To Queue:", self.to_queue_selector) layout.addRow("From Queue:", self.from_queue_selector) layout.addRow("Amount:", self.number_to_transfer) # OK and Cancel buttons self.buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) self.setWindowTitle("Transfer Tasks") self.resize(225, 150)
def __init__(self,parent=None): super(QtReducePreferencesWorksheet,self).__init__(parent) fontGroup = QGroupBox(self.tr("Fonts")) self.fontCombo = QtReduceFontComboBox(self) self.setFocusPolicy(Qt.NoFocus) self.fontCombo.setEditable(False) self.fontCombo.setCurrentFont(self.parent().parent().controller.view.font()) self.sizeCombo = QtReduceFontSizeComboBox() self.sizeComboFs = QtReduceFontSizeComboBoxFs() self.findSizes(self.fontCombo.currentFont()) self.fontCombo.currentFontChanged.connect(self.findSizes) fontLayout = QFormLayout() fontLayout.addRow(self.tr("General Worksheet Font"),self.fontCombo) fontLayout.addRow(self.tr("Font Size"),self.sizeCombo) fontLayout.addRow(self.tr("Full Screen Font Size"),self.sizeComboFs) fontGroup.setLayout(fontLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(fontGroup) self.setLayout(mainLayout)
def __init__(self, parent=None): super(FinishWrangleItemsDialog, self).__init__(parent) layout = QFormLayout(self) self.status_selector = QComboBox() status_list = ["abort", "done", "publish", "cancel"] for status in status_list: self.status_selector.addItem(str(status)) layout.addRow("Finished Status:", self.status_selector) # OK and Cancel buttons self.buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) self.setWindowTitle("Select Finished Status") self.resize(250, 100)
def __init__(self, parent=None): super(OptionSection, self).__init__(parent) #create widgets label_buffer_size = QLabel("Buffer Size") self.spinbox_buffer_size = ValidatedSpinBox() self.spinbox_buffer_size.setSingleStep(10) self.spinbox_buffer_size.setMaximum(9999999) self.spinbox_buffer_size.setSuffix(" bytes") self.spinbox_buffer_size.setValue(55) label_timeout = QLabel("Timeout") self.spinbox_timeout = ValidatedSpinBox() self.spinbox_timeout.setMaximum(9999999) self.spinbox_timeout.setSuffix(" ms") self.spinbox_timeout.setSingleStep(100) self.spinbox_timeout.setValue(1000) label_delay = QLabel("Delay Between Packets") self.spinbox_delay = ValidatedSpinBox() self.spinbox_delay.setMaximum(9999999) self.spinbox_delay.setSuffix(" ms") self.spinbox_delay.setSingleStep(100) self.spinbox_delay.setValue(1000) label_delay_distribution = QLabel("Delay Distribution") self.combobox_delay_distribution = QComboBox() self.combobox_delay_distribution.addItem("Constant") self.combobox_delay_distribution.insertSeparator(10) self.combobox_delay_distribution.addItems(["Uniform", "Gaussian", "Poisson", "Exponential"]) label_packet_count = QLabel("Packets to Send") self.spinbox_packet_count = ValidatedSpinBox() self.spinbox_packet_count.setMaximum(9999999) self.spinbox_packet_count.setValue(3) #setup layout layout = QFormLayout() layout.addRow(label_buffer_size, self.spinbox_buffer_size) layout.addRow(label_timeout, self.spinbox_timeout) layout.addRow(label_delay, self.spinbox_delay) layout.addRow(label_delay_distribution, self.combobox_delay_distribution) layout.addRow(label_packet_count, self.spinbox_packet_count) self.setLayout(layout)
def __init__(self, parent = None): super(QueueDialog, self).__init__(parent) layout = QFormLayout(self) self.queue_selector = QComboBox() queue_list = cqmanage.cqQueueList() for queue in queue_list: self.queue_selector.addItem(str(queue)) layout.addRow("Queue:", self.queue_selector) # OK and Cancel buttons self.buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) self.setWindowTitle("Select Queue") self.resize(200, 100)
def _initUI(self): # Widgets self._txt_time = QLineEdit() self._txt_time.setText(human_time(self.result().simulation_time_s)) self._txt_time.setReadOnly(True) self._txt_speed = QLineEdit() self._txt_speed.setText(human_time(self.result().simulation_speed_s[0])) self._txt_speed.setReadOnly(True) # Layouts layout = _SaveableResultWidget._initUI(self) sublayout = QFormLayout() if sys.platform == "darwin": # Fix for Mac OS layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) sublayout.addRow("Total time of the simulation", self._txt_time) sublayout.addRow("Average time of one trajectory", self._txt_speed) layout.addLayout(sublayout) layout.addStretch() return layout
def __init__(self,element): #kreiramo prozor QWidget.__init__(self) self.element = element #iskljucujemo polja za uvecanje i minimizaciju self.setWindowFlags(self.windowFlags() & ~Qt.WindowMaximizeButtonHint & ~Qt.WindowMinimizeButtonHint) #Podesavamo naslov self.setWindowTitle(self.element.ime) self.focusWidget() #editor teksta self.textEditor = QTextEdit() self.textEditor.setText(self.element.data) #dodajemo dugmad za primenu i odbacivanje promena #i povezujemo ih sa odgovarajucim funkcijama self.dugmeOk = QPushButton("Potvrdi") self.dugmeOtkazi = QPushButton("Otkazi") self.connect(self.dugmeOk,SIGNAL('clicked()'),self,SLOT('podesi()')) self.connect(self.dugmeOtkazi,SIGNAL('clicked()'),self,SLOT('zatvori()')) #formiramo raspored raspored = QFormLayout() raspored.addRow(self.textEditor) raspored.addRow(self.dugmeOtkazi,self.dugmeOk) self.setLayout(raspored)
def layoutWidgets(self): layout = QVBoxLayout() hbox = QHBoxLayout() hbox.addStretch() hbox.addWidget(self.formatPanel) layout.addLayout(hbox) seeGroup = QGroupBox("See") form = QFormLayout() form.addRow(self.seeLabel, self.seeTextEdit) hbox = QHBoxLayout() hbox.addWidget(self.seePrefixTextEdit) hbox.addWidget(self.seeSepLabel) hbox.addWidget(self.seeSepTextEdit) hbox.addWidget(self.seeSuffixLabel) hbox.addWidget(self.seeSuffixTextEdit) form.addRow(self.seePrefixLabel, hbox) seeGroup.setLayout(form) layout.addWidget(seeGroup) alsoGroup = QGroupBox("See Also") form = QFormLayout() form.addRow(self.seeAlsoLabel, self.seeAlsoTextEdit) hbox = QHBoxLayout() hbox.addWidget(self.seeAlsoPrefixTextEdit) hbox.addWidget(self.seeAlsoSepLabel) hbox.addWidget(self.seeAlsoSepTextEdit) hbox.addWidget(self.seeAlsoSuffixLabel) hbox.addWidget(self.seeAlsoSuffixTextEdit) form.addRow(self.seeAlsoPrefixLabel, hbox) form.addRow(self.seeAlsoPositionLabel, self.seeAlsoPositionComboBox) alsoGroup.setLayout(form) layout.addWidget(alsoGroup) layout.addStretch(2) self.setLayout(layout)
def __init__(self, client, method): super(Tab, self).__init__(None) self.client = client self.method = method horiz = QHBoxLayout(self) left = QWidget() horiz.addWidget(left) layout = QFormLayout(left) self.fields = [] for param in method[1]: field = QLineEdit() self.fields.append(field) layout.addRow(param[0], field) button = QPushButton("Execute Web Service") button.clicked.connect(self.execute) layout.addWidget(button) display = QTabWidget() self.result = QTextBrowser() display.addTab(self.result, "Result") self.request = QTextBrowser() display.addTab(self.request, "Request", ) self.response = QTextBrowser() display.addTab(self.response, "Response") horiz.addWidget(display)
def make_main_frame(self): self.main_frame = QWidget() win = pg.GraphicsWindow() self.crosshair_lb = pg.LabelItem(justify='right') win.addItem(self.crosshair_lb) self.plot = win.addPlot(row=1, col=0) self.plot.showGrid(x=True, y=True) self.right_panel = QGroupBox("Spectrometer Settings") hbox = QHBoxLayout() for w in [win, self.right_panel]: hbox.addWidget(w) form = QFormLayout() self.integration_sb = pg.SpinBox(value=0.001, bounds=(10*1e-6, 6553500*1e-6), suffix='s', siPrefix=True, \ dec=True, step=1) self.integration_sb.valueChanged.connect(self.change_integration_time) self.persistence_sb = QtGui.QSpinBox() self.persistence_sb.setValue(7) self.persistence_sb.setRange(1,10) self.persistence_sb.valueChanged.connect(self.change_persistence) self.take_background_btn = QtGui.QPushButton('Take background') self.take_background_btn.clicked.connect(self.on_take_background) self.conc_lb = pg.ValueLabel() self.spec_temp_lb = pg.ValueLabel() self.use_background_cb = QtGui.QCheckBox("enabled") self.use_background_cb.stateChanged.connect(self.on_use_background) form.addRow("Integration time", self.integration_sb) form.addRow("Persistence", self.persistence_sb) form.addRow("Background", self.take_background_btn) form.addRow("Use background", self.use_background_cb) self.right_panel.setLayout(form) self.main_frame.setLayout(hbox) self.setCentralWidget(self.main_frame)
def __init__(self, window = None): super(SelectUser, self).__init__(window) layout = QFormLayout(self) self.email = QLineEdit(self) fm = self.email.fontMetrics() self.email.setMaximumWidth(30 * fm.maxWidth() + 11) layout.addRow("&User ID:", self.email) self.pwd = QLineEdit(self) self.pwd.setEchoMode(QLineEdit.Password) fm = self.pwd.fontMetrics() self.pwd.setMaximumWidth(30 * fm.width('*') + 11) layout.addRow("&Password:"******"&Save Credentials (unsafe)") layout.addRow(self.savecreds) self.buttonbox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) self.buttonbox.accepted.connect(self.authenticate) self.buttonbox.rejected.connect(self.reject) layout.addRow(self.buttonbox) self.setLayout(layout)
def __init__(self, parent = None): if not parent: parent = hiero.ui.mainWindow() super(ExportPdfOptionDialog, self).__init__(parent) layout = QFormLayout() self._fileNameField = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter='*.pdf') self._fileNameField.setFilename(os.path.join(os.getenv('HOME'), "Desktop", "Sequence.pdf")) self._pdfLayoutDropdown = QComboBox() self._pdfLayoutDropdown.setToolTip("Set the PDF page layout type.") self._thumbFrameTypeDropdown = QComboBox() self._thumbFrameTypeDropdown.setToolTip("Set which frame to take the thumbnail from.") self._buttonbox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self._buttonbox.button(QDialogButtonBox.Ok).setText("Export") self._buttonbox.accepted.connect(self.accept) self._buttonbox.rejected.connect(self.reject) self._pdfLayouts = PDFExporter.PAGE_LAYOUTS_DICT self._thumbFrameTypes = PDFExporter.THUMB_FRAME_TYPES for pdfLayout in sorted(self._pdfLayouts, reverse=True): self._pdfLayoutDropdown.addItem(pdfLayout) for frameType in self._thumbFrameTypes: self._thumbFrameTypeDropdown.addItem(frameType) layout.addRow("Save to:", self._fileNameField) layout.addRow("PDF Layout:", self._pdfLayoutDropdown) layout.addRow("Thumbnail Frame:", self._thumbFrameTypeDropdown) layout.addRow("", self._buttonbox) self.setLayout(layout) self.setWindowTitle("Export PDF Options") self.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )
def __init__(self, parameter, parent=None): _ParameterWidget.__init__(self, parameter, parent) # Widgets self._lbl_x = QLabel('x') self._lbl_x.setStyleSheet("color: blue") self._txt_x = MultiNumericalLineEdit() self._lbl_y = QLabel('y') self._lbl_y.setStyleSheet("color: blue") self._txt_y = MultiNumericalLineEdit() self._lbl_z = QLabel('z') self._lbl_z.setStyleSheet("color: blue") self._txt_z = MultiNumericalLineEdit() self._cb_unit = UnitComboBox(parameter.unit) # Layouts layout = QFormLayout() layout.setContentsMargins(0, 0, 0, 0) if sys.platform == 'darwin': # Fix for Mac OS layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) layout.addRow(self._lbl_x, self._txt_x) layout.addRow(self._lbl_y, self._txt_y) layout.addRow(self._lbl_z, self._txt_z) layout.addRow('Unit', self._cb_unit) self.setLayout(layout) # Signals self.valuesChanged.connect(self._onChanged) self.validationRequested.connect(self._onChanged) self._txt_x.textChanged.connect(self.valuesChanged) self._txt_y.textChanged.connect(self.valuesChanged) self._txt_z.textChanged.connect(self.valuesChanged) self._cb_unit.currentIndexChanged.connect(self.valuesChanged) self.validationRequested.emit()