class UserSummaryWizardPage(QWizardPage): def __init__(self, parent=None): super(UserSummaryWizardPage, self).__init__( parent, title="Summary", subTitle="Summary of new user account") # labels self.usernameLabel = QLabel() self.tokenLabel = QLabel() # form self.form = QFormLayout() self.form.addRow("username: "******"token: ", self.tokenLabel) # layout self.setLayout(self.form) def initializePage(self): self.usernameLabel.setText(self.field('username').toString()) self.tokenLabel.setText(self.field('token').toString())
def __init__(self, parent, hex_widget, column_model): utils.Dialog.__init__(self, parent, name='configure_column_dialog') self.hexWidget = hex_widget self.columnModel = column_model self.setWindowTitle(utils.tr('Setup column {0}').format(column_model.name)) self.setLayout(QVBoxLayout()) self.txtColumnName = QLineEdit(self) forml = QFormLayout() forml.addRow(utils.tr('Name:'), self.txtColumnName) self.layout().addLayout(forml) self.txtColumnName.setText(column_model.name) self.provider = providerForColumnModel(column_model) if self.provider is not None: self.configWidget = self.provider.createConfigurationWidget(self, hex_widget, column_model) self.layout().addWidget(self.configWidget) else: self.configWidget = None self.txtColumnName.setEnabled(self.configWidget is not None) self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel, Qt.Horizontal, self) self.layout().addWidget(self.buttonBox) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject)
def __init__(self, parent, hex_widget): utils.Dialog.__init__(self, parent, name='create_column_dialog') self.hexWidget = hex_widget self.configWidget = None self.setWindowTitle(utils.tr('Add column')) self.setLayout(QVBoxLayout()) self.cmbColumnProvider = QComboBox(self) self.cmbColumnProvider.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) self.layout().addWidget(self.cmbColumnProvider) for provider in availableProviders(): if provider.creatable: self.cmbColumnProvider.addItem(provider.name, provider) self.txtColumnName = QLineEdit(self) forml = QFormLayout() forml.addRow(utils.tr('Name:'), self.txtColumnName) self.layout().addLayout(forml) self.cmbColumnProvider.currentIndexChanged[int].connect(self._onCurrentProviderChanged) self.layout().addStretch() self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel, Qt.Horizontal, self) self.layout().addWidget(self.buttonBox) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self._onCurrentProviderChanged(self.cmbColumnProvider.currentIndex())
def createArgument(self, arg): warg = QWidget() vlayout = QVBoxLayout() vlayout.setSpacing(5) vlayout.setMargin(0) winfo = QWidget() infolayout = QFormLayout() infolayout.setMargin(0) requirement = arg.requirementType() # Generate argument's widget warguments = self.getWidgetFromType(arg) if arg.requirementType() in (Argument.Optional, Argument.Empty): checkBox = checkBoxWidget(self, winfo, warguments, self.labActivate.text()) vlayout.addWidget(checkBox, 0) tedit = QTextEdit(str(arg.description())) tedit.setReadOnly(True) infolayout.addRow(tedit) winfo.setLayout(infolayout) vlayout.addWidget(winfo, 1) if warguments: vlayout.addWidget(warguments, 2) self.valueArgs[arg.name()] = warguments else: self.valueArgs[arg.name()] = winfo warg.setLayout(vlayout) self.stackedargs.addWidget(warg) argitem = QListWidgetItem(str(arg.name()), self.listargs)
def buildGui(self): layout = QFormLayout(self) self.is_default = False self.setTitle(tr("Route specification")) self.setSubTitle(tr("Specify a route")) self.network = NetworkCombo(parent=self, modelname=MODEL_NETWORKS_EXCL_HA) layout.addRow(tr("Network :"), self.network) dst_group = QGroupBox() layout.addRow(dst_group) dst_group.setTitle(tr("Route parameters")) form = QGridLayout(dst_group) self.destination = NetworkEdit() self.gateway = IpEdit() self.registerField("destination", self.destination) form.addWidget(QLabel(tr("Destination")), 0, 0) form.addWidget(self.destination, 0, 1) self.connect(self.gateway, SIGNAL('textChanged(QString)'), self.ifCompleteChanged) self.connect(self.destination, SIGNAL('textChanged(QString)'), self.ifCompleteChanged) build_default = QPushButton(tr("Build a default route")) form.addWidget(build_default, 0, 2) self.connect(build_default, SIGNAL('clicked()'), self.setDefaultRoute) self.registerField("gateway", self.gateway) form.addWidget(QLabel(tr("Gateway")), 2, 0) form.addWidget(self.gateway, 2, 1) self.message = Help() form.addWidget(self.message, 3, 0, 1, 3)
class StatusPage(ScrollArea): COMPONENT = 'status' LABEL = tr('Status') REQUIREMENTS = ('status',) ICON = ':/icons/info.png' def __init__(self, client, parent): ScrollArea.__init__(self) self.client = client self.mainwindow = parent self.form = QFormLayout(self) title = QLabel("<H1>Services</H1>") self.form.addRow(title) self.monitor = None group = QGroupBox() group.setTitle(self.tr("System Services Status")) box = QVBoxLayout(group) #parent is expected to be MainWindow ! self.monitor = MonitorWindow(client, self, parent) box.addWidget(self.monitor) self.form.addRow(group) @staticmethod def get_calls(): """ services called by initial multicall """ # for first refresh inside MonitorWindow return ( ('status', 'getStatus'), ) def isModified(self): return False
def _initialize(self): ## self.paramTPerm = self.field("paramTPerm") self.tabs.clear() self.total_answers = 0 self.radioGroups = {} filas = int(self.paramNPerm.toString()) for x in range(filas): mygroupbox = QScrollArea() mygroupbox.setWidget(QWidget()) mygroupbox.setWidgetResizable(True) myform = QHBoxLayout(mygroupbox.widget()) cols = self.paramNCols.toString().split(',') ansID = 0 radioGroupList = {} for col in cols: mygroupboxCol = QGroupBox() myformCol = QFormLayout() mygroupboxCol.setLayout(myformCol) for y in range(int(col)): ansID += 1 radioGroupList[ansID] = QButtonGroup() layoutRow = QHBoxLayout() for j in range(int(self.paramNAlts.toString())): myradio = QRadioButton(chr(97 + j).upper()) layoutRow.addWidget(myradio) radioGroupList[ansID].addButton(myradio) self.total_answers += 1 myformCol.addRow(str(ansID), layoutRow) myform.addWidget(mygroupboxCol) self.radioGroups[chr(97 + x).upper()] = radioGroupList self.tabs.addTab(mygroupbox, _('Model ') + chr(97 + x).upper())
def __init__(self, parent, old_ids): QDialog.__init__(self, parent) self.old_ids = old_ids main_lay = QVBoxLayout(self) self.fra_id = QFrame(self) fra_id_lay = QFormLayout(self.fra_id) self.lbl_id = QLabel('New ID:') self.txt_id = QLineEdit('') fra_id_lay.addRow(self.lbl_id, self.txt_id) self.lbl_desc = QLabel('Description:') self.txt_desc = QLineEdit('') fra_id_lay.addRow(self.lbl_desc, self.txt_desc) self.fra_buttons = QFrame() fra_buttons_lay = QHBoxLayout(self.fra_buttons) self.btn_ok = QPushButton('OK') self.btn_ok.clicked.connect(self.btn_ok_clicked) self.btn_cancel = QPushButton('Cancel') self.btn_cancel.clicked.connect(self.btn_cancel_clicked) fra_buttons_lay.addWidget(self.btn_ok) fra_buttons_lay.addWidget(self.btn_cancel) main_lay.addWidget(self.fra_id) main_lay.addWidget(self.fra_buttons) self.new_id = None self.description = None
class UserSummaryWizardPage(QWizardPage): def __init__(self, parent=None): super(UserSummaryWizardPage, self).__init__(parent, title="Summary", subTitle="Summary of new user account") # labels self.usernameLabel = QLabel() self.tokenLabel = QLabel() # form self.form = QFormLayout() self.form.addRow("username: "******"token: ", self.tokenLabel) # layout self.setLayout(self.form) def initializePage(self): self.usernameLabel.setText(self.field('username').toString()) self.tokenLabel.setText(self.field('token').toString())
def buildfromauto(formconfig, base): widgetsconfig = formconfig['widgets'] outlayout = QFormLayout() outlayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) outwidget = base outwidget.setLayout(outlayout) for config in widgetsconfig: widgettype = config['widget'] field = config['field'] name = config.get('name', field) if not field: utils.warning("Field can't be null for {}".format(name)) utils.warning("Skipping widget") continue label = QLabel(name) label.setObjectName(field + "_label") widget = roam.editorwidgets.core.createwidget(widgettype, parent=base) widget.setObjectName(field) layoutwidget = QWidget() layoutwidget.setLayout(QBoxLayout(QBoxLayout.LeftToRight)) layoutwidget.layout().addWidget(widget) if config.get('rememberlastvalue', False): savebutton = QToolButton() savebutton.setObjectName('{}_save'.format(field)) layoutwidget.layout().addWidget(savebutton) outlayout.addRow(label, layoutwidget) outlayout.addItem(QSpacerItem(10, 10)) installflickcharm(outwidget) return outwidget
def __init__(self, ideaType = None, parent=None): super().__init__("Bonuses", parent=parent) self.ideaType = ideaType layout = QFormLayout() self.bonuses = [] if ideaType == "traditions": self.nBonuses = 2 elif ideaType == "ambitions": self.nBonuses = 1 else: self.nBonuses = 3 for i in range(self.nBonuses): allowNone = (ideaType is None) and i > 0 if allowNone: initialIndex = 0 else: initialIndex = i + 1 ideaBonus = IdeaBonus(initialIndex = initialIndex, allowNone = allowNone) ideaBonus.costChanged.connect(self.handleCostChanged) self.bonuses.append(ideaBonus) layout.addRow(QLabel("Bonus %d:" % (i + 1,)), self.bonuses[i]) self.setLayout(layout) self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) self.setToolTip("Total cost for each idea should not be negative or too large. Taking duplicates of some bonuses will result in penalty cards.")
class AuxLayerSelector(QWidget): def __init__(self, parent=None): super(AuxLayerSelector, self).__init__(parent) self.layout = QFormLayout() def setInitialState(self, initDict): """ Sets widget interface with initDict entries. Keys are labels and values are list of items for each combobox corresponding to each key. """ for key, value in initDict.items(): label = QLabel(key) widget = DsgCustomComboBox() widget.addItems(value) self.layout.addRow(label, widget) self.setLayout(self.layout) def resetLayout(self): """ Resets current widget layout. """ self.layout = QFormLayout() self.setLayout(self.layout) def getParameters(self): """ Gets current values fom each widget as a dictionary. """ returnDict = dict() for i in range(self.layout.rowCount()): key = self.layout.itemAt(i, QFormLayout.LabelRole).text() value = self.layout.itemAt(i, QFormLayout.FieldRole).currentText() returnDict[key] = value return returnDict
def _initialize(self): ## self.paramTPerm = self.field("paramTPerm") self.tabs.clear() self.total_answers = 0 self.radioGroups = {} filas = int(self.paramNPerm.toString()) for x in range(filas): mygroupbox = QScrollArea() mygroupbox.setWidget(QWidget()) mygroupbox.setWidgetResizable(True) myform = QHBoxLayout(mygroupbox.widget()) cols = self.paramNCols.toString().split(',') ansID = 0 radioGroupList = {} for col in cols: mygroupboxCol = QGroupBox() myformCol = QFormLayout() mygroupboxCol.setLayout(myformCol) for y in range(int(col)): ansID += 1 radioGroupList[ansID] = QButtonGroup() layoutRow = QHBoxLayout() for j in range(int(self.paramNAlts.toString())): myradio = QRadioButton(chr(97+j).upper()) layoutRow.addWidget(myradio) radioGroupList[ansID].addButton(myradio) self.total_answers += 1 myformCol.addRow(str(ansID), layoutRow) myform.addWidget(mygroupboxCol) self.radioGroups[chr(97+x).upper()] = radioGroupList self.tabs.addTab(mygroupbox, _('Model ') + chr(97+x).upper())
def __init__(self, ideaType=None, parent=None): super().__init__("Bonuses", parent=parent) self.ideaType = ideaType layout = QFormLayout() self.bonuses = [] if ideaType == "traditions": self.nBonuses = 2 elif ideaType == "ambitions": self.nBonuses = 1 else: self.nBonuses = 3 for i in range(self.nBonuses): allowNone = (ideaType is None) and i > 0 if allowNone: initialIndex = 0 else: initialIndex = i + 1 ideaBonus = IdeaBonus(initialIndex=initialIndex, allowNone=allowNone) ideaBonus.costChanged.connect(self.handleCostChanged) self.bonuses.append(ideaBonus) layout.addRow(QLabel("Bonus %d:" % (i + 1, )), self.bonuses[i]) self.setLayout(layout) self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) self.setToolTip( "Total cost for each idea should not be negative or too large. Taking duplicates of some bonuses will result in penalty cards." )
def __init__(self, parent): super(ManualInstallWidget, self).__init__() self._parent = parent vbox = QVBoxLayout(self) form = QFormLayout() self._txtName = QLineEdit() self._txtVersion = QLineEdit() form.addRow(self.tr("Plugin Name:"), self._txtName) form.addRow(self.tr("Plugin Version:"), self._txtVersion) vbox.addLayout(form) hPath = QHBoxLayout() self._txtFilePath = QLineEdit() self._btnFilePath = QPushButton(QIcon(":img/open"), '') hPath.addWidget(QLabel(self.tr("Plugin File:"))) hPath.addWidget(self._txtFilePath) hPath.addWidget(self._btnFilePath) vbox.addLayout(hPath) vbox.addSpacerItem( QSpacerItem(0, 1, QSizePolicy.Expanding, QSizePolicy.Expanding)) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) self._btnInstall = QPushButton(self.tr("Install")) hbox.addWidget(self._btnInstall) vbox.addLayout(hbox) #Signals self.connect(self._btnFilePath, SIGNAL("clicked()"), self._load_plugin_path) self.connect(self._btnInstall, SIGNAL("clicked()"), self.install_plugin)
def __init__(self, parent=None): QWidget.__init__(self, parent) layout = QFormLayout() self.setLayout(layout) # # Audio Quality # self.label_audio_quality = QLabel("Audio Quality") self.spinbox_audio_quality = QDoubleSpinBox() self.spinbox_audio_quality.setMinimum(0.0) self.spinbox_audio_quality.setMaximum(1.0) self.spinbox_audio_quality.setSingleStep(0.1) self.spinbox_audio_quality.setDecimals(1) self.spinbox_audio_quality.setValue(0.3) # Default value 0.3 # # Video Quality # self.label_video_quality = QLabel("Video Quality (kb/s)") self.spinbox_video_quality = QSpinBox() self.spinbox_video_quality.setMinimum(0) self.spinbox_video_quality.setMaximum(16777215) self.spinbox_video_quality.setValue(2400) # Default value 2400 # # Misc. # self.label_matterhorn = QLabel("Matterhorn Metadata") self.label_matterhorn.setToolTip("Generates Matterhorn Metadata in XML format") self.checkbox_matterhorn = QCheckBox() layout.addRow(self.label_matterhorn, self.checkbox_matterhorn)
def __init__(self, parent=None): QWidget.__init__(self, parent) v = QVBoxLayout() f = QFormLayout() self.mzTolSpinBox = QDoubleSpinBox(self) self.mzTolSpinBox.setMaximum(100) self.mzTolSpinBox.setMinimum(1) self.mzTolSpinBox.setValue(10) f.addRow("mz tolerance(ppm):", self.mzTolSpinBox) self.mzSpinBox = QDoubleSpinBox(self) self.mzSpinBox.setMaximum(2000.0) self.mzSpinBox.setMinimum(300.0) self.mzSpinBox.setValue(500.0) f.addRow("requested m/z:", self.mzSpinBox) v.addLayout(f) self.plotButton = QPushButton("Plot") v.addWidget(self.plotButton) self.setLayout(v)
def createArgument(self, arg): warg = QWidget() vlayout = QVBoxLayout() vlayout.setSpacing(5) vlayout.setMargin(0) winfo = QWidget() infolayout = QFormLayout() infolayout.setMargin(0) requirement = arg.requirementType() # Generate argument's widget warguments = self.getWidgetFromType(arg) if arg.requirementType() in (Argument.Optional, Argument.Empty): checkBox = checkBoxWidget(self, winfo, warguments, self.labActivate.text()) vlayout.addWidget(checkBox, 0) infolayout.addRow(self.labType.text(), QLabel(str(typeId.Get().typeToName(arg.type())))) tedit = QTextEdit(str(arg.description())) tedit.setReadOnly(True) infolayout.addRow(tedit) winfo.setLayout(infolayout) vlayout.addWidget(winfo, 1) if warguments: vlayout.addWidget(warguments, 2) self.valueArgs[arg.name()] = warguments else: self.valueArgs[arg.name()] = winfo warg.setLayout(vlayout) self.stackedargs.addWidget(warg) argitem = QListWidgetItem(str(arg.name()), self.listargs)
def buildfromauto(formconfig): widgetsconfig = formconfig['widgets'] outlayout = QFormLayout() outwidget = QWidget() outwidget.setLayout(outlayout) for config in widgetsconfig: widgettype = config['widget'] field = config['field'] name = config.get('name', field) label = QLabel(name) label.setObjectName(field + "_label") widgetwrapper = WidgetsRegistry.createwidget(widgettype, layer=None, field=field, widget=None, label=label, config=None) widget = widgetwrapper.widget widget.setObjectName(field) layoutwidget = QWidget() layoutwidget.setLayout(QBoxLayout(QBoxLayout.LeftToRight)) layoutwidget.layout().addWidget(widget) if config.get('rememberlastvalue', False): savebutton = QToolButton() savebutton.setObjectName('{}_save'.format(field)) layoutwidget.layout().addWidget(savebutton) hidden = config.get('hidden', False) if not hidden: outlayout.addRow(label, layoutwidget) outlayout.addItem(QSpacerItem(10,10)) return outwidget
def __init__(self, iface_name, parent=None): IfaceWizardPage.__init__(self, parent) self.q_netobject = QNetObject.getInstance() self.setSubTitle("What kind of interface do you want to configure?") box = QVBoxLayout(self) self.ethernet = "ethernet", "Activate ethernet interface %s" % iface_name , QRadioButton() self.vlan = "vlan", "Create a VLAN interface", QRadioButton() group = QButtonGroup(self) form = QFormLayout() options = (self.ethernet, self.vlan) for item in options: group.addButton(item[2]) form.addRow(item[1], item[2]) self.registerField(item[0], item[2]) self.ethernet[2].setChecked(Qt.Checked) box.addLayout(form) box.addStretch() box.addWidget( HelpMissingFunction("""\ All interfaces but one (%s) are configured. In order to be able to activate an ethernet interface for bonding agregation, \ you must deconfigure at least one ethernet interface first \ (which may be in use by vlans or bondings).""" % iface_name) )
def __init__(self, parent, settings): super().__init__(parent) self.settings = settings self.setWindowTitle("Shampoo configuration") self.resize(400, 100) main_layout = QVBoxLayout() layout = QFormLayout() self.openfoam_path = QLineEdit() self.openfoam_path.setText(settings.value("openfoam/path")) layout.addRow("OpenFOAM path", self.openfoam_path) b_layout = QHBoxLayout() b_layout.addStretch(1) button = QPushButton("Ok") button.setDefault(True) button.clicked.connect(self.accept) b_layout.addWidget(button) main_layout.addLayout(layout) main_layout.addLayout(b_layout) self.setLayout(main_layout)
def __init__(self, title, stream, parent, checked=False): super().__init__(title, 'subtitle', stream, parent, checked) inner_layout = QFormLayout() inner_layout.addRow('Language:', QLabel(stream.language)) self.scodec_combo = SubtitleCombo() inner_layout.addRow('Codec:', self.scodec_combo) self.setLayout(inner_layout)
def __init__(self, username='', parent=None): self.password = "******" self.username = username super(GetPassword, self).__init__(parent) self.username_le = QLineEdit() self.username_le.setText(self.username) self.username_le.setObjectName("username_le") self.username_lbl = QLabel('USERNAME:'******'PASSWORD:', self) self.ok = QPushButton() self.ok.setObjectName("OK") self.ok.setText("OK") layout = QFormLayout() layout.addRow(self.username_lbl, self.username_le) layout.addRow(self.password_lbl, self.password_le) layout.addWidget(self.ok) self.setLayout(layout) self.connect(self.ok, SIGNAL("clicked()"), self.ok_click) self.setWindowTitle("Please enter your username and password")
def _init_gui_tab_and_groupbox_widgets(self): #top area for main stuff group_box_main_config = QGroupBox("Configuration") main_config_layout = QFormLayout() widget_delimiter = self._init_gui_delimiter_entries() tab_widget = QTabWidget() tab_widget.addTab(widget_delimiter, "delimiter") tab_widget.addTab(self.color_choosing_widget, "colors") #widget for bottom = save button save_widget = QWidget() layout_save_widget = QFormLayout() save_button = QPushButton("save", self) QObject.connect(save_button, SIGNAL('clicked()'), self._save_config) layout_save_widget.addWidget(save_button) save_widget.setLayout(layout_save_widget) main_config_layout.addRow(self.checkbox_start_with_last_opened_file) group_box_main_config.setLayout(main_config_layout) tab_widget_layout = QVBoxLayout() tab_widget_layout.addWidget(group_box_main_config) tab_widget_layout.addWidget(tab_widget) tab_widget_layout.addWidget(save_widget) return tab_widget_layout
def __init__(self, parent): super(ManualInstallWidget, self).__init__() self._parent = parent vbox = QVBoxLayout(self) form = QFormLayout() self._txtName = QLineEdit() self._txtVersion = QLineEdit() form.addRow(self.tr("Plugin Name:"), self._txtName) form.addRow(self.tr("Plugin Version:"), self._txtVersion) vbox.addLayout(form) hPath = QHBoxLayout() self._txtFilePath = QLineEdit() self._btnFilePath = QPushButton(QIcon(":img/open"), '') hPath.addWidget(QLabel(self.tr("Plugin File:"))) hPath.addWidget(self._txtFilePath) hPath.addWidget(self._btnFilePath) vbox.addLayout(hPath) vbox.addSpacerItem(QSpacerItem(0, 1, QSizePolicy.Expanding, QSizePolicy.Expanding)) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) self._btnInstall = QPushButton(self.tr("Install")) hbox.addWidget(self._btnInstall) vbox.addLayout(hbox) #Signals self.connect(self._btnFilePath, SIGNAL("clicked()"), self._load_plugin_path) self.connect(self._btnInstall, SIGNAL("clicked()"), self.install_plugin)
def __init__(self, table_p, parent, provid_clt=None, type_=None, refund=None, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) self.type_ = type_ self.refund = refund self.parent = parent self.table_p = table_p self.provid_clt = provid_clt self.new = True if self.refund: self.new = False self.last_r = self.refund self.type_ = refund.type_ self.refund_date_field = FormatDate(self.refund.date) self.refund_date_field.setEnabled(False) self.title = u"Modification de {} {}".format(self.refund.type_, self.refund.invoice.client) self.succes_msg = u"{} a été bien mise à jour".format( self.refund.type_) self.amount = refund.amount self.provid_clt = refund.provider_client else: self.refund_date_field = FormatDate(QDate.currentDate()) self.succes_msg = u"Client a été bien enregistré" self.title = u"Création d'un nouvel client" self.amount = "" self.refund = Refund() self.last_r = Refund.select().where( Refund.provider_client == provid_clt).order_by(Refund.date.desc()).get() self.setWindowTitle(self.title) self.amount_field = IntLineEdit(unicode(self.amount)) vbox = QVBoxLayout() self.last_remaining = self.last_r.refund_remaing() print(self.last_remaining) # try: # self.last_r.refund_remaing() # self.remaining = self.last_r.remaining # except Exception as e: # self # print("last_r except ", e) # self.last_r = None # self.close() formbox = QFormLayout() formbox.addRow(FormLabel("Client :"), FormLabel(self.provid_clt.name)) formbox.addRow(FormLabel("Dette restante :"), FormLabel(str(formatted_number(self.last_remaining)) + Config.DEVISE)) formbox.addRow(FormLabel(u"Date : *"), self.refund_date_field) formbox.addRow(FormLabel(u"Montant : *"), self.amount_field) butt = Button_save(u"Enregistrer") butt.clicked.connect(self.save_edit) formbox.addRow("", butt) # formbox.addRow("", "Le client {} n'est pas endetté") vbox.addLayout(formbox) self.setLayout(vbox)
def Build_Tab(group, source_key, default, projector, projectordb, edit=False): """ Create the radio button page for a tab. Dictionary will be a 1-key entry where key=tab to setup, val=list of inputs. source_key: {"groupkey1": {"key11": "key11-text", "key12": "key12-text", ... }, "groupkey2": {"key21": "key21-text", "key22": "key22-text", .... }, ... } :param group: Button group widget to add buttons to :param source_key: Dictionary of sources for radio buttons :param default: Default radio button to check :param projector: Projector instance :param projectordb: ProjectorDB instance for session :param edit: If we're editing the source text """ buttonchecked = False widget = QWidget() layout = QFormLayout() if edit else QVBoxLayout() layout.setSpacing(10) widget.setLayout(layout) tempkey = list(source_key.keys())[0] # Should only be 1 key sourcelist = list(source_key[tempkey]) sourcelist.sort() button_count = len(sourcelist) if edit: for key in sourcelist: item = QLineEdit() item.setObjectName('source_key_%s' % key) source_item = projectordb.get_source_by_code(code=key, projector_id=projector.db_item.id) if source_item is None: item.setText(PJLINK_DEFAULT_CODES[key]) else: item.setText(source_item.text) layout.addRow(PJLINK_DEFAULT_CODES[key], item) group.append(item) else: for key in sourcelist: source_item = projectordb.get_source_by_code(code=key, projector_id=projector.db_item.id) if source_item is None: text = source_key[tempkey][key] else: text = source_item.text itemwidget = QRadioButton(text) itemwidget.setAutoExclusive(True) if default == key: itemwidget.setChecked(True) buttonchecked = itemwidget.isChecked() or buttonchecked group.addButton(itemwidget, int(key)) layout.addWidget(itemwidget) layout.addStretch() return widget, button_count, buttonchecked
def __init__(self, table_p, parent, provid_clt=None, type_=None, refund=None, *args, **kwargs): QDialog.__init__(self, parent, *args, **kwargs) self.type_ = type_ self.refund = refund self.parent = parent self.table_p = table_p self.provid_clt = provid_clt self.new = True if self.refund: self.new = False self.last_r = self.refund self.type_ = refund.type_ self.refund_date_field = FormatDate(self.refund.date) self.refund_date_field.setEnabled(False) self.title = u"Modification de {} {}".format(self.refund.type_, self.refund.invoice.client) self.succes_msg = u"{} a été bien mise à jour".format( self.refund.type_) self.amount = refund.amount self.provid_clt = refund.provider_client else: self.refund_date_field = FormatDate(QDate.currentDate()) self.succes_msg = u"Client a été bien enregistré" self.title = u"Création d'un nouvel client" self.amount = "" self.refund = Refund() self.last_r = Refund.select().where( Refund.provider_client == provid_clt).order_by(Refund.date.desc()).get() self.setWindowTitle(self.title) self.amount_field = IntLineEdit(unicode(self.amount)) vbox = QVBoxLayout() self.last_remaining = self.last_r.refund_remaing() # try: # self.last_r.refund_remaing() # self.remaining = self.last_r.remaining # except Exception as e: # self # print("last_r except ", e) # self.last_r = None # self.close() formbox = QFormLayout() formbox.addRow(FormLabel("Client :"), FormLabel(self.provid_clt.name)) formbox.addRow(FormLabel("Dette restante :"), FormLabel(str(formatted_number(self.last_remaining)))) formbox.addRow(FormLabel(u"Date : *"), self.refund_date_field) formbox.addRow(FormLabel(u"Montant : *"), self.amount_field) butt = ButtonSave(u"Enregistrer") butt.clicked.connect(self.save_edit) formbox.addRow("", butt) # formbox.addRow("", "Le client {} n'est pas endetté") vbox.addLayout(formbox) self.setLayout(vbox)
def _setupUi(self): self.x1 = QLabel() self.x2 = QLabel() self.result = QLabel() a = QFormLayout(self) a.addRow('x1:', self.x1) a.addRow('x2:', self.x2) a.addRow('result:', self.result)
def __init__(self, net, parent=None): QWidget.__init__(self, parent) self.net = net form = QFormLayout(self) net_ips = NetIps(net) form.addRow(tr("IP addresses:"), net_ips) self.connect(net_ips, SIGNAL('double click'), self.edit)
def buildAntivirus(self, layout, row, col): antivirus = QGroupBox(self) antivirus.setTitle(tr('Antivirus')) antivirus_layout = QFormLayout(antivirus) antivirus_enable = QCheckBox() antivirus_layout.addRow(tr('Enable antivirus'), antivirus_enable) self.connect(antivirus_enable, SIGNAL('clicked(bool)'), self.setAntivirusEnabled) layout.addWidget(antivirus, row, col) return antivirus_enable
def buildPostProcessorForm(self, theParams): """Build Post Processor Tab Args: * theParams - dictionary containing element of form Returns: not applicable """ # create postprocessors tab myTab = QWidget() myFormLayout = QFormLayout(myTab) myFormLayout.setLabelAlignment(Qt.AlignLeft) self.tabWidget.addTab(myTab, self.tr('Postprocessors')) self.tabWidget.tabBar().setVisible(True) # create element for the tab myValues = {} for myLabel, myOptions in theParams.items(): myInputValues = {} # NOTE (gigih) : 'params' is assumed as dictionary if 'params' in myOptions: myGroupBox = QGroupBox() myGroupBox.setCheckable(True) myGroupBox.setTitle(get_postprocessor_human_name(myLabel)) # NOTE (gigih): is 'on' always exist?? myGroupBox.setChecked(myOptions.get('on')) myInputValues['on'] = self.bind(myGroupBox, 'checked', bool) myLayout = QFormLayout(myGroupBox) myGroupBox.setLayout(myLayout) # create widget element from 'params' myInputValues['params'] = {} for myKey, myValue in myOptions['params'].items(): myHumanName = get_postprocessor_human_name(myKey) myInputValues['params'][myKey] = self.buildWidget( myLayout, myHumanName, myValue) myFormLayout.addRow(myGroupBox, None) elif 'on' in myOptions: myCheckBox = QCheckBox() myCheckBox.setText(get_postprocessor_human_name(myLabel)) myCheckBox.setChecked(myOptions['on']) myInputValues['on'] = self.bind(myCheckBox, 'checked', bool) myFormLayout.addRow(myCheckBox, None) else: raise NotImplementedError('This case is not handled for now') myValues[myLabel] = myInputValues self.values['postprocessors'] = myValues
class dlgAbstractUserLogin( QDialog ): """ Clase base para todos los dialogos que requieren autenticar a un usuario """ def __init__( self, parent = None, maxAttempts = 3 ): super( dlgAbstractUserLogin, self ).__init__() self.setupUi() self.parent = parent self.user = None self.maxAttempts = maxAttempts self.attempts = 0 #self.txtUser.setText('root') #self.txtBd.setText('Esquipulasdb') self.buttonbox.accepted.connect( self.accept ) self.buttonbox.rejected.connect( self.reject ) def accept( self ): self.user = User( self.txtUser.text(), self.txtPassword.text() ) if self.user.valid or self.attempts == self.maxAttempts - 1: super( dlgAbstractUserLogin, self ).accept() else: self.txtPassword.setText( "" ) self.lblError.setText( u"Hay un error en su usuario o su" + u" contraseña" ) self.lblError.setVisible( True ) self.attempts += 1 QTimer.singleShot( 3000, functools.partial( self.lblError.setVisible, False ) ) def setupUi( self ): self.txtPassword = QLineEdit() self.txtPassword.setEchoMode( QLineEdit.Password ) self.txtUser = QLineEdit() self.buttonbox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel ) self.lblError = QLabel() self.lblError.setProperty( "error", True ) self.lblError.setText( u"El usuario o la contraseña son incorrectos" ) self.lblError.setVisible( False ) self.formLayout = QFormLayout() self.formLayout.addRow( u"&Usuario", self.txtUser ) self.formLayout.addRow( u"&Contraseña", self.txtPassword ) self.txtUser.setWhatsThis( "Escriba aca su usuario" ) self.txtPassword.setWhatsThis( u"Escriba aca su contraseña, "\ + "tenga en cuenta que el sistema hace "\ + "diferencia entre minusculas y"\ + " mayusculas" ) self.txtApplication = QLabel()
def __init__(self, parent=None): QWidget.__init__(self, parent) layout = QFormLayout() self.setLayout(layout) self.source_label = QLabel('Source') self.source_combobox = QComboBox() self.source_combobox.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum) layout.addRow(self.source_label, self.source_combobox)
def buildGUI(self): self.setTitle(self.tr("Create a VLAN interface")) self.setPixmap(QWizard.LogoPixmap, QPixmap(":/icons/vlan")) self.registerField("raw_device", self.vlan_editor.raw_device) self.registerField( "vlan_id", self.vlan_editor.vlan_id) self.registerField("vlan_name", self.vlan_editor.name) self.setSubTitle(self.tr("Please select an ethernet interface to use as a basis for your new VLAN interface")) form = QFormLayout(self) form.addRow(self.vlan_editor)
def __init__(self, parent=None): QWidget.__init__(self, parent) layout = QFormLayout() self.setLayout(layout) self.devicesLabel = QLabel("Video Device") self.devicesCombobox = QComboBox() self.devicesCombobox.setMinimumWidth(150) layout.addRow(self.devicesLabel, self.devicesCombobox)
class RepoRemoveDialog(QDialog): def __init__(self, github, name, parent=None): super(RepoRemoveDialog, self).__init__(parent, windowTitle="Remove Repo") self.github = github self.login = self.github.get_user().login self.name = name self.label = QLabel(''' <p>Are you sure?</p> <p>This action <b>CANNOT</b> be undone.</p> <p>This will delete the <b>{}/{}</b> repository, wiki, issues, and comments permanently.</p> <p>Please type in the name of the repository to confirm.</p> '''.format(self.login, self.name)) self.label.setTextFormat(Qt.RichText) validator = QRegExpValidator( QRegExp(r'{}/{}'.format(self.login, self.name))) self.nameEdit = QLineEdit(textChanged=self.textChanged) self.nameEdit.setValidator(validator) # Form self.form = QFormLayout() self.form.addRow(self.label) self.form.addRow(self.nameEdit) # ButtonBox self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, accepted=self.accept, rejected=self.reject) # Layout self.mainLayout = QVBoxLayout() self.mainLayout.addLayout(self.form) self.mainLayout.addWidget(self.buttonBox) self.setLayout(self.mainLayout) self.textChanged() def textChanged(self): if self.nameEdit.validator().validate(self.nameEdit.text(), 0)[0] \ == QValidator.Acceptable: b = True else: b = False self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(b)
class RepoRemoveDialog(QDialog): def __init__(self, github, name, parent=None): super(RepoRemoveDialog, self).__init__( parent, windowTitle="Remove Repo") self.github = github self.login = self.github.get_user().login self.name = name self.label = QLabel(''' <p>Are you sure?</p> <p>This action <b>CANNOT</b> be undone.</p> <p>This will delete the <b>{}/{}</b> repository, wiki, issues, and comments permanently.</p> <p>Please type in the name of the repository to confirm.</p> '''.format(self.login, self.name)) self.label.setTextFormat(Qt.RichText) validator = QRegExpValidator( QRegExp(r'{}/{}'.format(self.login, self.name))) self.nameEdit = QLineEdit(textChanged=self.textChanged) self.nameEdit.setValidator(validator) # Form self.form = QFormLayout() self.form.addRow(self.label) self.form.addRow(self.nameEdit) # ButtonBox self.buttonBox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, accepted=self.accept, rejected=self.reject) # Layout self.mainLayout = QVBoxLayout() self.mainLayout.addLayout(self.form) self.mainLayout.addWidget(self.buttonBox) self.setLayout(self.mainLayout) self.textChanged() def textChanged(self): if self.nameEdit.validator().validate(self.nameEdit.text(), 0)[0] \ == QValidator.Acceptable: b = True else: b = False self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(b)
def __init__(self): super(NewSessionPageExamAnswers, self).__init__() self.setTitle(_('Selection of correct answers')) self.setSubTitle(_('Select the correct answers for each exam model')) layout = QFormLayout() self.setLayout(layout) self.tabs = QTabWidget() layout.addRow(self.tabs) self.paramNAlts = None self.paramNCols = None self.paramNPerm = None
def __init__(self, parent=None): QWidget.__init__(self, parent) layout = QFormLayout() self.setLayout(layout) self.feedbackLabel = QLabel("Feedback") self.feedbackComboBox = QComboBox() self.feedbackComboBox.addItem("autoaudiosink") self.feedbackComboBox.addItem("alsasink") layout.addRow(self.feedbackLabel, self.feedbackComboBox)
def __init__(self, parent=None): super().__init__(parent) self.data = None self._invalidated = False self._pca = None self._variance_ratio = None self._cumulative = None self._line = False box = gui.widgetBox(self.controlArea, "Components Selection") form = QFormLayout() box.layout().addLayout(form) self.components_spin = gui.spin(box, self, "max_components", 0, 1000, callback=self._update_selection, keyboardTracking=False) self.components_spin.setSpecialValueText("All") self.variance_spin = gui.spin(box, self, "variance_covered", 1, 100, callback=self._update_selection, keyboardTracking=False) self.variance_spin.setSuffix("%") form.addRow("Max components", self.components_spin) form.addRow("Variance covered", self.variance_spin) self.controlArea.layout().addStretch() box = gui.widgetBox(self.controlArea, "Commit") cb = gui.checkBox(box, self, "auto_commit", "Commit on any change") b = gui.button(box, self, "Commit", callback=self.commit, default=True) gui.setStopper(self, b, cb, "_invalidated", callback=self.commit) self.plot = pg.PlotWidget(background="w") axis = self.plot.getAxis("bottom") axis.setLabel("Principal Components") axis = self.plot.getAxis("left") axis.setLabel("Proportion of variance") self.plot.getViewBox().setMenuEnabled(False) self.plot.showGrid(True, True, alpha=0.5) self.plot.setRange(xRange=(0.0, 1.0), yRange=(0.0, 1.0)) self.mainArea.layout().addWidget(self.plot)
def __init__(self, path="", name="", parent=None, confirm_overwrite=False): super(FileWidget, self).__init__(name, parent) layout = QFormLayout(self) browse_button = QPushButton("File Path") self.filename_edit = QLineEdit(path) layout.addRow(browse_button, self.filename_edit) browse_button.clicked.connect(self.set_path) self.dialog_options = QFileDialog.Options() if not confirm_overwrite: self.dialog_options |= QFileDialog.DontConfirmOverwrite self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
def build_post_processor_form(self, parameters): """Build Post Processor Tab. :param parameters: A Dictionary containing element of form :type parameters: dict """ # create postprocessors tab tab = QWidget() form_layout = QFormLayout(tab) form_layout.setLabelAlignment(Qt.AlignLeft) self.tabWidget.addTab(tab, self.tr('Postprocessors')) self.tabWidget.tabBar().setVisible(True) # create element for the tab values = OrderedDict() for label, options in parameters.items(): input_values = OrderedDict() # NOTE (gigih) : 'params' is assumed as dictionary if 'params' in options: group_box = QGroupBox() group_box.setCheckable(True) group_box.setTitle(get_postprocessor_human_name(label)) # NOTE (gigih): is 'on' always exist?? # (MB) should always be there group_box.setChecked(options.get('on')) input_values['on'] = self.bind(group_box, 'checked', bool) layout = QFormLayout(group_box) group_box.setLayout(layout) # create widget element from 'params' input_values['params'] = OrderedDict() for key, value in options['params'].items(): input_values['params'][key] = self.build_widget( layout, key, value) form_layout.addRow(group_box, None) elif 'on' in options: checkbox = QCheckBox() checkbox.setText(get_postprocessor_human_name(label)) checkbox.setChecked(options['on']) input_values['on'] = self.bind(checkbox, 'checked', bool) form_layout.addRow(checkbox, None) else: raise NotImplementedError('This case is not handled for now') values[label] = input_values self.values['postprocessors'] = values
def __init__(self, parent, params): QDialog.__init__(self, parent) self.parent = parent self.params = params self.setMinimumWidth(min_width) # self.setMinimumHeight(min_height) # Build dialog self.setWindowTitle('Options - Quality') # TODO: softcode self.setWindowModality(QtCore.Qt.ApplicationModal) self.fra_form = QFrame(self) fra_form_lay = QFormLayout(self.fra_form) fra_form_lay.setContentsMargins(10, 10, 10, 10) self.lbl_parameter = QLabel('Parameter:') # TODO: softocode self.cbo_parameter = QComboBox() fra_form_lay.addRow(self.lbl_parameter, self.cbo_parameter) self.lbl_mass_units = QLabel('Mass units:') # TODO: softocode self.cbo_mass_units = QComboBox() fra_form_lay.addRow(self.lbl_mass_units, self.cbo_mass_units) self.lbl_rel_diff = QLabel('Relative diffusivity:') # TODO: softocode self.txt_rel_diff = QLineEdit() fra_form_lay.addRow(self.lbl_rel_diff, self.txt_rel_diff) self.lbl_trace_node = QLabel('Trace node:') # TODO: softocode self.txt_trace_node = QLineEdit() fra_form_lay.addRow(self.lbl_trace_node, self.txt_trace_node) self.lbl_quality_tol = QLabel('Quality tolerance:') # TODO: softocode self.txt_quality_tol = QLineEdit() fra_form_lay.addRow(self.lbl_quality_tol, self.txt_quality_tol) # Buttons self.fra_buttons = QFrame(self) fra_buttons_lay = QHBoxLayout(self.fra_buttons) self.btn_Ok = QPushButton('OK') self.btn_Cancel = QPushButton('Cancel') fra_buttons_lay.addWidget(self.btn_Ok) fra_buttons_lay.addWidget(self.btn_Cancel) # Add to main fra_main_lay = QVBoxLayout(self) fra_main_lay.setContentsMargins(0, 0, 0, 0) fra_main_lay.addWidget(self.fra_form) fra_main_lay.addWidget(self.fra_buttons) self.setup()
def __init__(self, parent, params): QDialog.__init__(self, parent) self.parent = parent self.params = params self.setMinimumWidth(min_width) # self.setMinimumHeight(min_height) # Build dialog self.setWindowTitle('Options - Report') # TODO: softcode self.setWindowModality(QtCore.Qt.ApplicationModal) self.fra_form = QFrame(self) fra_form_lay = QFormLayout(self.fra_form) fra_form_lay.setContentsMargins(10, 10, 10, 10) self.lbl_status = QLabel('Hydraulic status:') # TODO: softocode self.cbo_status = QComboBox() fra_form_lay.addRow(self.lbl_status, self.cbo_status) self.lbl_summary = QLabel('Summary') # TODO: softocode self.cbo_summary = QComboBox() fra_form_lay.addRow(self.lbl_summary, self.cbo_summary) self.lbl_energy = QLabel('Energy') # TODO: softocode self.cbo_energy = QComboBox() fra_form_lay.addRow(self.lbl_energy, self.cbo_energy) self.lbl_nodes = QLabel('Nodes') # TODO: softocode self.cbo_nodes = QComboBox() fra_form_lay.addRow(self.lbl_nodes, self.cbo_nodes) self.lbl_links = QLabel('Links') # TODO: softocode self.cbo_links = QComboBox() fra_form_lay.addRow(self.lbl_links, self.cbo_links) # Buttons self.fra_buttons = QFrame(self) fra_buttons_lay = QHBoxLayout(self.fra_buttons) self.btn_Ok = QPushButton('OK') self.btn_Cancel = QPushButton('Cancel') fra_buttons_lay.addWidget(self.btn_Ok) fra_buttons_lay.addWidget(self.btn_Cancel) # Add to main fra_main_lay = QVBoxLayout(self) fra_main_lay.setContentsMargins(0, 0, 0, 0) fra_main_lay.addWidget(self.fra_form) fra_main_lay.addWidget(self.fra_buttons) self.setup()
def __init__(self, url, username, password): MustChooseDialog.__init__(self, None) self.setWindowTitle(m18n('Create User Account') + ' - Kajongg') self.buttonBox = KDialogButtonBox(self) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) vbox = QVBoxLayout(self) grid = QFormLayout() self.lbServer = QLabel() self.lbServer.setText(url) grid.addRow(m18n('Game server:'), self.lbServer) self.lbUser = QLabel() grid.addRow(m18n('Username:'******'Password:'******'Repeat password:'), self.edPassword2) vbox.addLayout(grid) vbox.addWidget(self.buttonBox) pol = QSizePolicy() pol.setHorizontalPolicy(QSizePolicy.Expanding) self.lbUser.setSizePolicy(pol) self.edPassword.textChanged.connect(self.passwordChanged) self.edPassword2.textChanged.connect(self.passwordChanged) StateSaver(self) self.username = username self.password = password self.passwordChanged() self.edPassword2.setFocus()
def __init__(self): SimulationConfigPanel.__init__(self, EnsembleExperiment()) layout = QFormLayout() case_model = CaseSelectorModel() case_selector = ComboChoice(case_model, "Current case", "init/current_case_selection") layout.addRow(case_selector.getLabel(), case_selector) runpath_model = RunPathModel() runpath_label = ActiveLabel(runpath_model, "Runpath", "config/simulation/runpath") layout.addRow(runpath_label.getLabel(), runpath_label) number_of_realizations_model = EnsembleSizeModel() number_of_realizations_label = ActiveLabel(number_of_realizations_model, "Number of realizations", "config/ensemble/num_realizations") layout.addRow(number_of_realizations_label.getLabel(), number_of_realizations_label) active_realizations_model = ActiveRealizationsModel() self.active_realizations_field = StringBox(active_realizations_model, "Active realizations", "config/simulation/active_realizations") self.active_realizations_field.setValidator(RangeStringArgument(number_of_realizations_model.getValue())) layout.addRow(self.active_realizations_field.getLabel(), self.active_realizations_field) self.active_realizations_field.validationChanged.connect(self.simulationConfigurationChanged) self.setLayout(layout)
def __init__(self, parent=None): super(GithubCredentialsWizardPage, self).__init__(parent, title="Credentials", subTitle="Enter your username/password or token") # Radio Buttons self.userPassRadioButton = QRadioButton() self.userPassRadioButton.toggled.connect(self.changeMode) self.userPassRadioButton.toggled.connect(self.completeChanged.emit) self.tokenRadioButton = QRadioButton() self.tokenRadioButton.toggled.connect(self.changeMode) self.tokenRadioButton.toggled.connect(self.completeChanged.emit) # LineEdits # usernameEdit self.usernameEdit = QLineEdit(textChanged=self.completeChanged.emit) # Username may only contain alphanumeric characters or dash # and cannot begin with a dash self.usernameEdit.setValidator( QRegExpValidator(QRegExp('[A-Za-z\d]+[A-Za-z\d-]+'))) # passwordEdit self.passwordEdit = QLineEdit(textChanged=self.completeChanged.emit) self.passwordEdit.setValidator(QRegExpValidator(QRegExp('.+'))) self.passwordEdit.setEchoMode(QLineEdit.Password) # tokenEdit self.tokenEdit = QLineEdit(textChanged=self.completeChanged.emit) # token may only contain alphanumeric characters self.tokenEdit.setValidator(QRegExpValidator(QRegExp('[A-Za-z\d]+'))) self.tokenEdit.setEchoMode(QLineEdit.Password) # Form form = QFormLayout() form.addRow("<b>username/password</b>", self.userPassRadioButton) form.addRow("username: "******"password: "******"<b>token</b>", self.tokenRadioButton) form.addRow("token: ", self.tokenEdit) # Layout self.mainLayout = QVBoxLayout() self.mainLayout.addLayout(form) self.setLayout(self.mainLayout) # Fields self.registerField("username", self.usernameEdit) self.registerField("password", self.passwordEdit) self.registerField("token", self.tokenEdit) self.userPassRadioButton.toggle() self.require_2fa = False
def __init__(self, parent=None): QWidget.__init__(self, parent) layout = QFormLayout() self.setLayout(layout) self.desktopLabel = QLabel("Record Desktop") self.desktopButton = QRadioButton() layout.addRow(self.desktopLabel, self.desktopButton) # Record Area of Desktop areaGroup = QHBoxLayout() self.areaLabel = QLabel("Record Region") self.areaButton = QRadioButton() self.setAreaButton = QPushButton("Select Region") areaGroup.addWidget(self.areaButton) areaGroup.addWidget(self.setAreaButton) layout.addRow(self.areaLabel, areaGroup) self.regionLabel = QLabel("") self.regionLabel.setStyleSheet( "QLabel { background-color: #ADADAD; border: 1px solid gray }") layout.addRow(QLabel(""), self.regionLabel) # Select screen to record self.screenLabel = QLabel("Screen") self.screenSpinBox = QSpinBox() layout.addRow(self.screenLabel, self.screenSpinBox)
def __init__(self, sid, mid, parent=None): super(EditDialog, self).__init__(parent) self.sid = sid self.mid = mid displayInfo = self.pullSubjects() dis = self.pullOne(self.mid) self.l1 = QLabel("Assessment Types") self.le = QComboBox() for dd in displayInfo: self.le.addItem(str(dd['name']).upper(), dd['id']) self.le.setObjectName("name") #self.le.setCurrentIndex(2) self.l2 = QLabel("Max Score") self.le2 = QLineEdit() self.le2.setObjectName("maxscore") if dis: self.le2.setText(dis['abbrv']) else: pass self.pb = QPushButton() self.pb.setObjectName("Submit") self.pb.setText("Submit") self.pb1 = QPushButton() self.pb1.setObjectName("Cancel") self.pb1.setText("Cancel") layout = QFormLayout() layout.addRow(self.l1, self.le) layout.addRow(self.l2, self.le2) layout.addRow(self.pb1, self.pb) groupBox = QGroupBox('Add Assessment') groupBox.setLayout(layout) grid = QGridLayout() grid.addWidget(groupBox, 0, 0) self.setLayout(grid) self.connect(self.pb, SIGNAL("clicked()"), lambda: self.button_click(self)) self.connect(self.pb1, SIGNAL("clicked()"), lambda: self.button_close(self)) self.setWindowTitle(self.pagetitle)
def __init__(self): super(NewSessionPageExamParams, self).__init__() self.setTitle(_('Configuration of exam params')) self.setSubTitle(_('Enter the configuration parameters of the exam')) layout = QFormLayout(self) self.setLayout(layout) self.paramNEIDs = widgets.InputInteger(initial_value=8) self.registerField("paramNEIDs", self.paramNEIDs) self.paramNAlts = widgets.InputInteger(initial_value=3) self.registerField("paramNAlts", self.paramNAlts) self.paramNCols = widgets.InputCustomPattern( fixed_size=250, regex=r'[1-9][0-9]?(\,[1-9][0-9]?)+', placeholder=_('num,num,...')) self.registerField("paramNCols", self.paramNCols) self.paramNPerm = widgets.InputInteger(min_value=1, initial_value=2) self.registerField("paramNPerm", self.paramNPerm) ## self.paramTPerm = widgets.CustomComboBox(parent=self) ## self.paramTPerm.set_items([ ## _('No (recommended)'), ## _('Yes (experimental)'), ## ]) ## self.paramTPerm.setCurrentIndex(0) ## self.registerField("paramTPerm", self.paramTPerm) layout.addRow(_('Number of digits of the student ID'), self.paramNEIDs) layout.addRow(_('Number of choices per question'), self.paramNAlts) layout.addRow(_('Number of questions per answer box'), self.paramNCols) layout.addRow(_('Number of models of the exam'), self.paramNPerm)
def __init__(self, parent, params, old_diam=None): QDialog.__init__(self, parent) self.params = params self.new_diameter = None self.setWindowTitle(params.plug_in_name) self.setModal(True) main_lay = QVBoxLayout(self) # Frame form self.fra_form = QFrame(self) fra_form_lay = QFormLayout(self.fra_form) # Old diameter self.lbl_diam_old = QLabel('Current diameter:') # TODO: softcode self.txt_diam_old = QLineEdit() self.txt_diam_old.setEnabled(False) if old_diam is None: old_diam = '-' self.txt_diam_old.setText(str(old_diam)) # self.txt_diam_old.setReadOnly(True) fra_form_lay.addRow(self.lbl_diam_old, self.txt_diam_old) # New diameter self.lbl_diameter = QLabel('New diameter:') # TODO: softcode self.txt_diameter = QLineEdit() self.txt_diameter.setValidator(RegExValidators.get_pos_decimals()) if self.params.new_diameter: self.new_diameter = self.params.new_diameter self.txt_diameter.setText(str(self.new_diameter)) fra_form_lay.addRow(self.lbl_diameter, self.txt_diameter) # Buttons self.buttons_form = QFrame(self) buttons_form_lay = QHBoxLayout(self.buttons_form) self.btn_ok = QPushButton('OK') self.btn_cancel = QPushButton('Cancel') self.btn_cancel.clicked.connect(self.btn_cancel_clicked) self.btn_ok.clicked.connect(self.btn_ok_clicked) buttons_form_lay.addWidget(self.btn_ok) buttons_form_lay.addWidget(self.btn_cancel) main_lay.addWidget(self.fra_form) main_lay.addWidget(self.buttons_form)
def __init__(self): SimulationConfigPanel.__init__(self, EnsembleExperiment) layout = QFormLayout() case_selector = CaseSelector() layout.addRow("Current case:", case_selector) run_path_label = QLabel("<b>%s</b>" % getRunPath()) addHelpToWidget(run_path_label, "config/simulation/runpath") layout.addRow("Runpath:", run_path_label) number_of_realizations_label = QLabel("<b>%d</b>" % getRealizationCount()) addHelpToWidget(number_of_realizations_label, "config/ensemble/num_realizations") layout.addRow(QLabel("Number of realizations:"), number_of_realizations_label) self._active_realizations_model = ActiveRealizationsModel() self._active_realizations_field = StringBox( self._active_realizations_model, "config/simulation/active_realizations") self._active_realizations_field.setValidator( RangeStringArgument(getRealizationCount())) layout.addRow("Active realizations", self._active_realizations_field) self._active_realizations_field.getValidationSupport( ).validationChanged.connect(self.simulationConfigurationChanged) self.setLayout(layout)