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 make_layout(): if newstyle: return QVBoxLayout() else: layout = QFormLayout() layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) return layout
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
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, title="Title", description="Description", parent=None): QDialog.__init__(self, parent) self.__option_list = [] """ :type: list of HelpedWidget """ self.setModal(True) self.setWindowTitle(title) # self.setMinimumWidth(250) # self.setMinimumHeight(150) self.layout = QFormLayout() self.layout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow) self.layout.setSizeConstraint(QLayout.SetFixedSize) label = QLabel(description) label.setAlignment(Qt.AlignHCenter) self.layout.addRow(self.createSpace(5)) self.layout.addRow(label) self.layout.addRow(self.createSpace(10)) self.ok_button = None self.setLayout(self.layout)
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=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
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, 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 _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): 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): 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 __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, 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=None): super(Form, self).__init__(parent) self.ql = QLabel("Enter Specification for Doctor:") self.le = QLineEdit() self.le.setObjectName("Specification") self.ql1 = QLabel("Enter city:") self.le1 = QLineEdit() self.le1.setObjectName("City") self.pb = QPushButton() self.pb.setObjectName("Create") self.pb.setText("CREATE") self.pb1 = QPushButton() self.pb1.setObjectName("Show") self.pb1.setText("SHOW") layout = QFormLayout() layout.addWidget(self.ql) layout.addWidget(self.le) layout.addWidget(self.ql1) layout.addWidget(self.le1) layout.addWidget(self.pb) layout.addWidget(self.pb1) self.setLayout(layout) self.connect(self.pb, SIGNAL("clicked()"), self.create_click) self.connect(self.pb1, SIGNAL("clicked()"), self.show_click) self.setWindowTitle("HOSPITAL MANAGEMENT SYSTEM")
def setupUi(self): """create all Ui elements but do not fill them""" buttonBox = KDialogButtonBox(self) buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) # Ubuntu 11.10 unity is a bit strange - without this, it sets focus on # the cancel button (which it shows on the left). I found no obvious # way to use setDefault and setAutoDefault for fixing this. buttonBox.button(QDialogButtonBox.Ok).setFocus(True) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject) vbox = QVBoxLayout(self) self.grid = QFormLayout() self.cbServer = QComboBox() self.cbServer.setEditable(True) self.grid.addRow(m18n('Game server:'), self.cbServer) self.cbUser = QComboBox() self.cbUser.setEditable(True) self.grid.addRow(m18n('Username:'******'Password:'******'kajongg', 'Ruleset:'), self.cbRuleset) vbox.addLayout(self.grid) vbox.addWidget(buttonBox) pol = QSizePolicy() pol.setHorizontalPolicy(QSizePolicy.Expanding) self.cbUser.setSizePolicy(pol)
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 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 __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, recipe=None, parent=None): super(RecipeEditionDialog, self).__init__(parent) self.setWindowTitle('Recipe edition') self.name = QLineEdit() self.description = QPlainTextEdit() self.tags = QLineEdit() buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) l = QFormLayout(self) l.addRow('Name', self.name) l.addRow('Description', self.description) l.addRow('Tags', self.tags) l.addWidget(buttons) if recipe: self.recipe = recipe self.name.setText(recipe.name) self.description.setPlainText(recipe.description) self.tags.setText(';'.join(t.name for t in recipe.tags)) else: self.recipe = Recipe('') self.accepted.connect(self.save_recipe)
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 __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, 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 createPlotRangePanel(self): frame = QFrame() #frame.setMaximumHeight(150) #frame.setFrameShape(QFrame.StyledPanel) #frame.setFrameShadow(QFrame.Plain) layout = QFormLayout() self.x_min = DisableableSpinner(self.plotView.setMinXLimit) self.x_max = DisableableSpinner(self.plotView.setMaxXLimit) layout.addRow("X min:", self.x_min) layout.addRow("X max:", self.x_max) self.y_min = DisableableSpinner(self.plotView.setMinYLimit) self.y_max = DisableableSpinner(self.plotView.setMaxYLimit) layout.addRow("Y min:", self.y_min) layout.addRow("Y max:", self.y_max) layout.addWidget(ert_gui.widgets.util.createSeparator()) self.plot_compare_to_case = QtGui.QComboBox() self.plot_compare_to_case.setToolTip("Select case to compare members against.") self.connect(self.plot_compare_to_case, SIGNAL("currentIndexChanged(QString)"), self.select_case) layout.addRow("Case:", self.plot_compare_to_case) frame.setLayout(layout) return frame
def __init__(self, parent=None): super(Form, self).__init__(parent) did_file = open("loggedin.txt") did = did_file.readline() print(did) if did[-1] == '\n': did = did[:-1] now = datetime.datetime.now() command = "SELECT * FROM Appointment WHERE doc_ID=\"" + did + "\";" print(command) cur.execute(command) res = cur.fetchall() rep = 'Patient ID Doctor ID Hospital ID Appointment DateTime Token Number\n' for row in res: print(row) rep = rep + str(row[0]).upper() + " " rep = rep + str(row[1]).upper() + " " rep = rep + str(row[2]).upper() + " " rep = rep + str(row[3]).upper() + " " rep = rep + str(row[4]).upper() rep += "\n" self.ql = QLabel(rep) layout = QFormLayout() layout.addWidget(self.ql) self.setLayout(layout) self.setWindowTitle("HOSPITAL MANAGEMENT SYSTEM")
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)
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 __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): 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, 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 addToLayout(self, layout): filler = QLabel(self) label = QLabel(self) label.setText("Changes take affect only after restart.") layout.addWidget(label) formLayout = QFormLayout() formLayout.setAlignment(Qt.AlignTop) layout.addLayout(formLayout) self.nmeaButton = QRadioButton("nmea", self) formLayout.addRow(self.nmeaButton, filler) self.nmeaButton.setChecked(self.useNmea) label = QLabel(self) label.setText("GPS Device:") self.deviceText = QLineEdit(self) formLayout.addRow(label, self.deviceText) self.deviceText.setToolTip('NMEA GPS device path.') if self.device != None: self.deviceText.setText(self.device) self.gpsdButton = QRadioButton("gpsd", self) formLayout.addRow(self.gpsdButton, filler) self.gpsdButton.setChecked(self.useGpsd)
def __init__(self, edge, line_name, proc_ev): super(Dialog_edge, self).__init__() # Entry window name self.setWindowTitle("Line {}-{}".format(line_name[0], line_name[1])) # Entry forms self.entry_susceptance = QLineEdit() self.entry_susceptance.setText(str(edge["susceptance"])) self.entry_susceptance.setValidator(QDoubleValidator(0.01, 10, 2)) self.entry_status = QCheckBox() self.entry_status.setChecked(edge["status"]) self.layout = QFormLayout() self.layout.addRow("Susceptance", self.entry_susceptance) self.layout.addRow("Connected", self.entry_status) # Entry window set button self.button = QPushButton() self.button.setText("Set") self.button.clicked.connect(partial(self.button_click, edge)) self.layout.addWidget(self.button) # Set entry window layout self.setLayout(self.layout) self.proc_ev = proc_ev self.show()
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 _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, displaykey=False): QWidget.__init__(self) self.layout = QFormLayout() self.layout.setMargin(0) self.widgets = {} self.displaykey = displaykey self.setLayout(self.layout) self.translation()
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 __init__(self): super(NewSessionPageScores, self).__init__() self.setTitle(_('Scores for correct and incorrect answers')) self.setSubTitle(_('Enter the scores of correct and incorrect ' 'answers. The program will compute scores based ' 'on them. Setting these scores is optional.')) form_widget = QWidget(parent=self) table_widget = QWidget(parent=self) main_layout = QVBoxLayout(self) form_layout = QFormLayout(form_widget) table_layout = QVBoxLayout(table_widget) self.setLayout(main_layout) form_widget.setLayout(form_layout) table_widget.setLayout(table_layout) main_layout.addWidget(form_widget) main_layout.addWidget(table_widget) main_layout.setAlignment(table_widget, Qt.AlignHCenter) self.combo = widgets.CustomComboBox(parent=self) self.combo.set_items([ _('No scores'), _('Same score for all the questions'), _('Base score plus per-question weight'), ]) self.combo.currentIndexChanged.connect(self._update_combo) self.correct_score = widgets.InputScore(is_positive=True) correct_score_label = QLabel(_('Score for correct answers')) incorrect_score_label = QLabel(_('Score for incorrect answers')) blank_score_label = QLabel(_('Score for blank answers')) self.incorrect_score = widgets.InputScore(is_positive=False) self.blank_score = widgets.InputScore(is_positive=False) self.button_reset = QPushButton(_('Reset question weights')) button_defaults = QPushButton(_('Compute default scores')) self.weights_table = widgets.CustomTableView() weights_table_label = QLabel(_('Per-question score weights:')) form_layout.addRow(self.combo) form_layout.addRow(correct_score_label, self.correct_score) form_layout.addRow(incorrect_score_label, self.incorrect_score) form_layout.addRow(blank_score_label, self.blank_score) table_layout.addWidget(weights_table_label) table_layout.addWidget(self.weights_table) table_layout.addWidget(self.button_reset) table_layout.addWidget(button_defaults) table_layout.setAlignment(weights_table_label, Qt.AlignHCenter) table_layout.setAlignment(self.weights_table, Qt.AlignHCenter) table_layout.setAlignment(self.button_reset, Qt.AlignHCenter) table_layout.setAlignment(button_defaults, Qt.AlignHCenter) self.button_reset.clicked.connect(self._reset_weights) button_defaults.clicked.connect(self._compute_default_values) self.base_score_widgets = [ self.correct_score, correct_score_label, self.incorrect_score, incorrect_score_label, self.blank_score, blank_score_label, button_defaults, ] self.weights_widgets = [ self.weights_table, weights_table_label, ] self.current_mode = None
def __init__(self, title="Title", description="Description", unique_names=None, choose_from_list=False): QDialog.__init__(self) self.setModal(True) self.setWindowTitle(title) # self.setMinimumWidth(250) # self.setMinimumHeight(150) if unique_names is None: unique_names = [] self.unique_names = unique_names self.choose_from_list = choose_from_list self.layout = QFormLayout() self.layout.setSizeConstraint(QLayout.SetFixedSize) label = QLabel(description) label.setAlignment(Qt.AlignHCenter) self.layout.addRow(self.createSpace(5)) self.layout.addRow(label) self.layout.addRow(self.createSpace(10)) buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) self.ok_button = buttons.button(QDialogButtonBox.Ok) self.ok_button.setEnabled(False) if choose_from_list: self.param_name_combo = QComboBox() self.connect(self.param_name_combo, SIGNAL('currentIndexChanged(QString)'), self.validateChoice) for item in unique_names: self.param_name_combo.addItem(item) self.layout.addRow("Job:", self.param_name_combo) else: self.param_name = QLineEdit(self) self.param_name.setFocus() self.connect(self.param_name, SIGNAL('textChanged(QString)'), self.validateName) self.validColor = self.param_name.palette().color( self.param_name.backgroundRole()) self.layout.addRow("Name:", self.param_name) self.layout.addRow(self.createSpace(10)) self.layout.addRow(buttons) self.connect(buttons, SIGNAL('accepted()'), self.accept) self.connect(buttons, SIGNAL('rejected()'), self.reject) self.setLayout(self.layout)
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 __init__(self, data, comment="", parent=None): QWidget.__init__(self, parent) from copy import deepcopy self.data = deepcopy(data) self.widgets = [] self.formlayout = QFormLayout(self) if comment: self.formlayout.addRow(QLabel("<b>%s</b>" % comment)) self.formlayout.addRow(QLabel(" "))
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.devicesLabel = QLabel("Video Device") self.devicesCombobox = QComboBox() self.devicesCombobox.setMinimumWidth(150) layout.addRow(self.devicesLabel, self.devicesCombobox)
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.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 setup_gui(self): layout = QVBoxLayout() self.setLayout(layout) self.main_form = QFormLayout() self.main_form.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) layout.addLayout(self.main_form) self._setup_gui_name() self._setup_gui_labels()
def _setupUi(self): self.setWindowTitle(tr("Enter your registration key")) self.resize(365, 126) self.verticalLayout = QVBoxLayout(self) self.promptLabel = QLabel(self) appname = str(QCoreApplication.instance().applicationName()) prompt = tr("Type the key you received when you contributed to $appname, as well as the " "e-mail used as a reference for the purchase.").replace('$appname', appname) self.promptLabel.setText(prompt) self.promptLabel.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop) self.promptLabel.setWordWrap(True) self.verticalLayout.addWidget(self.promptLabel) self.formLayout = QFormLayout() self.formLayout.setSizeConstraint(QLayout.SetNoConstraint) self.formLayout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow) self.formLayout.setLabelAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter) self.formLayout.setFormAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop) self.label2 = QLabel(self) self.label2.setText(tr("Registration key:")) self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label2) self.label3 = QLabel(self) self.label3.setText(tr("Registered e-mail:")) self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label3) self.codeEdit = QLineEdit(self) self.formLayout.setWidget(0, QFormLayout.FieldRole, self.codeEdit) self.emailEdit = QLineEdit(self) self.formLayout.setWidget(1, QFormLayout.FieldRole, self.emailEdit) self.verticalLayout.addLayout(self.formLayout) self.horizontalLayout = QHBoxLayout() self.contributeButton = QPushButton(self) self.contributeButton.setText(tr("Contribute")) self.contributeButton.setAutoDefault(False) self.horizontalLayout.addWidget(self.contributeButton) spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.cancelButton = QPushButton(self) sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.cancelButton.sizePolicy().hasHeightForWidth()) self.cancelButton.setSizePolicy(sizePolicy) self.cancelButton.setText(tr("Cancel")) self.cancelButton.setAutoDefault(False) self.horizontalLayout.addWidget(self.cancelButton) self.submitButton = QPushButton(self) sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.submitButton.sizePolicy().hasHeightForWidth()) self.submitButton.setSizePolicy(sizePolicy) self.submitButton.setText(tr("Submit")) self.submitButton.setAutoDefault(False) self.submitButton.setDefault(True) self.horizontalLayout.addWidget(self.submitButton) self.verticalLayout.addLayout(self.horizontalLayout)
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 buildAntispam(self, layout, row, col): antispam = QGroupBox(self) antispam.setTitle(tr('Antispam')) antispam_layout = QFormLayout(antispam) antispam_enable = QCheckBox() info = QLabel(tr("This will add an <code>X-Spam-Score:</code> header " "field to all the messages and add a <code>Subject:</code> line " "beginning with *<i>SPAM</i>* and containing the original subject " "to the messages detected as spam.")) info.setWordWrap(True) antispam_layout.addRow(info) antispam_layout.addRow(tr('Activate the antispam'), antispam_enable) mark_spam_level = QDoubleSpinBox(self) mark_spam_level.setDecimals(1) antispam_layout.addRow(tr('Mark the message as spam if its score is greater than'), mark_spam_level) deny_spam_level = QDoubleSpinBox(self) deny_spam_level.setDecimals(1) antispam_layout.addRow(tr('Refuse the message if its score is greater than'), deny_spam_level) # enable/disable spam levels self.connect(antispam_enable, SIGNAL('toggled(bool)'), mark_spam_level.setEnabled) self.connect(antispam_enable, SIGNAL('toggled(bool)'), deny_spam_level.setEnabled) # update config self.connect(mark_spam_level, SIGNAL('valueChanged(double)'), self.setMarkSpamLevel) self.connect(deny_spam_level, SIGNAL('valueChanged(double)'), self.setDenySpamLevel) self.connect(antispam_enable, SIGNAL('clicked(bool)'), self.setAntispamEnabled) layout.addWidget(antispam, row, col) self.mainwindow.writeAccessNeeded(mark_spam_level, deny_spam_level) return antispam_enable, mark_spam_level, deny_spam_level
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): 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)
def __init__(self, recipe = None, parent = None): super(RecipeEditionDialog, self).__init__(parent) self.setWindowTitle('Recipe edition') self.name = QLineEdit() self.description = QPlainTextEdit() self.tags = QLineEdit() buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) l = QFormLayout(self) l.addRow('Name', self.name) l.addRow('Description', self.description) l.addRow('Tags', self.tags) l.addWidget(buttons) if recipe: self.recipe = recipe self.name.setText(recipe.name) self.description.setPlainText(recipe.description) self.tags.setText(';'.join(t.name for t in recipe.tags)) else: self.recipe = Recipe('') self.accepted.connect(self.save_recipe)
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): 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): 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)