def __init__(self, parent=None, emphasized=False): super().__init__(parent) self.setProperty('emphasized', emphasized) self.tab1 = QWidget() self.tab1.setProperty('emphasized', emphasized) self.tab2 = QWidget() self.tab2.setProperty('emphasized', emphasized) self.addTab(self.tab1, "Tab 1") self.addTab(self.tab2, "Tab 2") layout = QFormLayout() layout.addRow("Height", QSpinBox()) layout.addRow("Weight", QDoubleSpinBox()) self.setTabText(0, "Tab 1") self.tab1.setLayout(layout) layout2 = QFormLayout() sex = QHBoxLayout() sex.addWidget(QRadioButton("Male")) sex.addWidget(QRadioButton("Female")) layout2.addRow(QLabel("Sex"), sex) layout2.addRow("Date of Birth", QLineEdit()) self.setTabText(1, "Tab 2") self.tab2.setLayout(layout2) self.setWindowTitle("tab demo")
def get_orbitdetails_widget(self, parent): """.""" grp_bx = QWidget(parent) grp_bx.setLayout(QVBoxLayout()) lbl = CALabel('OfflineOrb:', grp_bx) combo = OfflineOrbControl( grp_bx, self.device, self.ctrls, prefix=self.prefix, acc=self.acc) rules = ( '[{"name": "EnblRule", "property": "Visible", ' + '"expression": "not ch[0]", "channels": [{"channel": "' + self.devpref.substitute(propty='SOFBMode-Sts') + '", "trigger": true}]}]') combo.rules = rules lbl.rules = rules fbl = QFormLayout() grp_bx.layout().addLayout(fbl) fbl.addRow(lbl, combo) grp_bx.layout().addStretch() hbl = QHBoxLayout() grp_bx.layout().addLayout(hbl) fbl = QFormLayout() hbl.addItem(fbl) lbl = QLabel('Orbit [Hz]', grp_bx, alignment=Qt.AlignCenter) wid = self.create_pair(grp_bx, 'OrbAcqRate') fbl.addRow(lbl, wid) lbl = QLabel('Kicks [Hz]', grp_bx, alignment=Qt.AlignCenter) wid = self.create_pair(grp_bx, 'KickAcqRate') fbl.addRow(lbl, wid) wid = QWidget(grp_bx) wid.setStyleSheet('max-width:6em;') hbl.addWidget(wid) vbl = QVBoxLayout(wid) vbl.setContentsMargins(0, 0, 0, 0) lab = QLabel('Sync. Injection', wid, alignment=Qt.AlignCenter) vbl.addWidget(lab) hbl = QHBoxLayout() hbl.setContentsMargins(0, 0, 0, 0) vbl.addItem(hbl) spt = PyDMStateButton( wid, self.devpref.substitute(propty='SyncWithInjection-Sel')) rdb = SiriusLedState( wid, self.devpref.substitute(propty='SyncWithInjection-Sts')) hbl.addWidget(spt) hbl.addWidget(rdb) grp_bx.layout().addStretch() fbl = QFormLayout() grp_bx.layout().addLayout(fbl) lbl = QLabel('Smooth Method', grp_bx, alignment=Qt.AlignCenter) wid = self.create_pair_sel(grp_bx, 'SmoothMethod') fbl.addRow(lbl, wid) if self.isring: lbl = QLabel('Extend Ring', grp_bx, alignment=Qt.AlignCenter) wid = self.create_pair(grp_bx, 'RingSize') fbl.addRow(lbl, wid) return grp_bx
def connection_changed(self, connected): build = (self._node is None) and (self._connected != connected and connected is True) super(RunControl, self).connection_changed(connected) if not build: return self._node = nodeFromAddress(self.channel) self._path = self.channel vb = QVBoxLayout() self.setLayout(vb) gb = QGroupBox('Run Control ({})'.format(self._node.name)) vb.addWidget(gb) vb = QVBoxLayout() gb.setLayout(vb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vb.addLayout(fl) w = PyDMEnumComboBox(parent=None, init_channel=self._path + '.runRate') w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Run Rate:', w) hb = QHBoxLayout() vb.addLayout(hb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) hb.addLayout(fl) w = PyDMEnumComboBox(parent=None, init_channel=self._path + '.runState') w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Run State:', w) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) hb.addLayout(fl) w = PyDMLabel(parent=None, init_channel=self._path + '.runCount') w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Run Count:', w)
def setupUi(self): self.resize(350, 280) self.gridLayout = QGridLayout(self) self.levelNameLabel = QLabel("Level name", self) self.gridLayout.addWidget(self.levelNameLabel, 0, 0) self.levelNameLine = QLineEdit(self) self.gridLayout.addWidget(self.levelNameLine, 1, 0, 1, 0) self.groupBox = QGroupBox("Light mode", self) self.gridLayout.addWidget(self.groupBox, 2, 0) self.groupBoxDark = QGroupBox("Dark mode", self) self.gridLayout.addWidget(self.groupBoxDark, 2, 1) self.formLayout = QFormLayout(self.groupBox) self.groupBox.setLayout(self.formLayout) self.fgColorPreview = QLineEdit(self) self.formLayout.addRow("Foreground", self.fgColorPreview) self.bgColorPreview = QLineEdit(self) self.formLayout.addRow("Background", self.bgColorPreview) self.boldCheckBox = QCheckBox(self.groupBox) self.formLayout.addRow("Bold", self.boldCheckBox) self.italicCheckBox = QCheckBox(self.groupBox) self.formLayout.addRow("Italic", self.italicCheckBox) self.underlineCheckBox = QCheckBox(self.groupBox) self.formLayout.addRow("Underline", self.underlineCheckBox) self.formLayoutDark = QFormLayout(self.groupBoxDark) self.groupBoxDark.setLayout(self.formLayoutDark) self.fgColorPreviewDark = QLineEdit(self) self.formLayoutDark.addRow("Foreground", self.fgColorPreviewDark) self.bgColorPreviewDark = QLineEdit(self) self.formLayoutDark.addRow("Background", self.bgColorPreviewDark) self.boldCheckBoxDark = QCheckBox(self.groupBoxDark) self.formLayoutDark.addRow("Bold", self.boldCheckBoxDark) self.italicCheckBoxDark = QCheckBox(self.groupBox) self.formLayoutDark.addRow("Italic", self.italicCheckBoxDark) self.underlineCheckBoxDark = QCheckBox(self.groupBox) self.formLayoutDark.addRow("Underline", self.underlineCheckBoxDark) self.spacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridLayout.addItem(self.spacer, 3, 0, 1, 2) self.previewLabel = QLabel("Preview", self) self.gridLayout.addWidget(self.previewLabel, 4, 0, 1, 2) self.previewLine = QLineEdit(self) self.gridLayout.addWidget(self.previewLine, 5, 0) self.previewLineDark = QLineEdit(self) self.gridLayout.addWidget(self.previewLineDark, 5, 1) buttons = QDialogButtonBox.Reset | QDialogButtonBox.Save | QDialogButtonBox.Cancel self.buttonBox = QDialogButtonBox(buttons, self) self.resetButton = self.buttonBox.button(QDialogButtonBox.Reset) self.gridLayout.addWidget(self.buttonBox, 6, 0, 1, 2) self.setup_widget_attributes() self.setup_widget_connections()
def __init__(self): SimulationConfigPanel.__init__(self, EnsembleExperiment) layout = QFormLayout() self._case_selector = CaseSelector() layout.addRow("Current case:", self._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_field = StringBox( ActiveRealizationsModel(), "config/simulation/active_realizations", ) self._active_realizations_field.setValidator( RangeStringArgument(getRealizationCount()), ) layout.addRow("Active realizations", self._active_realizations_field) self.setLayout(layout) self._active_realizations_field.getValidationSupport( ).validationChanged.connect(self.simulationConfigurationChanged) self._case_selector.currentIndexChanged.connect( self._realizations_from_fs) self._realizations_from_fs() # update with the current case
def _get_size_widget(self, parent): gb_size = QGroupBox('Size [px / mm]', parent) fl_size = QFormLayout(gb_size) wid = QWidget(gb_size) wid.setLayout(QHBoxLayout()) xave = SiriusLabel(wid, init_channel=self._dev+':BeamSizeX-Mon') xavemm = SiriusLabel(wid, init_channel=self._dev+':BeamSizemmX-Mon') xave.setAlignment(Qt.AlignVCenter | Qt.AlignRight) xavemm.setAlignment(Qt.AlignVCenter | Qt.AlignLeft) sep = QLabel('/', wid) sep.setStyleSheet('max-width:0.7em;') wid.layout().addWidget(xave) wid.layout().addWidget(sep) wid.layout().addWidget(xavemm) fl_size.addRow(QLabel( 'X =', gb_size, alignment=Qt.AlignBottom), wid) wid = QWidget(gb_size) wid.setLayout(QHBoxLayout()) yave = SiriusLabel(wid, init_channel=self._dev+':BeamSizeY-Mon') yavemm = SiriusLabel(wid, init_channel=self._dev+':BeamSizemmY-Mon') yave.setAlignment(Qt.AlignVCenter | Qt.AlignRight) yavemm.setAlignment(Qt.AlignVCenter | Qt.AlignLeft) sep = QLabel('/', wid) sep.setStyleSheet('max-width:0.7em;') wid.layout().addWidget(yave) wid.layout().addWidget(sep) wid.layout().addWidget(yavemm) fl_size.addRow(QLabel( 'Y =', gb_size, alignment=Qt.AlignBottom), wid) return gb_size
def __init__(self, parent=None): super().__init__(parent=parent) self.animation: Animation = self.parentWidget().animation self.animation.key_frames.selection.events.active.connect( self._on_active_keyframe_changed) # init steps self.stepsSpinBox = QSpinBox() self.stepsSpinBox.setRange(1, 100000) self.stepsSpinBox.setValue(15) # init ease self.easeComboBox = QComboBox() self.easeComboBox.addItems([e.name.lower() for e in Easing]) self.easeComboBox.setCurrentText("linear") # add callbacks self.stepsSpinBox.valueChanged.connect(self._update_animation_steps) self.easeComboBox.currentIndexChanged.connect( self._update_animation_ease) # layout self.setLayout(QFormLayout()) self.layout().addRow("Steps", self.stepsSpinBox) self.layout().addRow("Ease", self.easeComboBox)
def _specViewLayout(self): dev = self.device.substitute(dev='TuneProc') # Mode lbl_mode = QLabel('Mode', self) self.cb_mode = PyDMEnumComboBox(self, dev.substitute(propty='SpecMode-Sel')) self.lb_mode = PyDMLabel(self, dev.substitute(propty='SpecMode-Sts')) hbox_mode = QHBoxLayout() hbox_mode.addWidget(self.cb_mode) hbox_mode.addWidget(self.lb_mode) # Time window lbl_timewdw = QLabel('Time Window [ms]', self) self.le_timewdw = PyDMLineEdit(self, dev.substitute(propty='SpecTime-SP')) self.le_timewdw.precisionFromPV = True self.lb_timewdw = PyDMLabel(self, dev.substitute(propty='SpecTime-RB')) hbox_timewdw = QHBoxLayout() hbox_timewdw.addWidget(self.le_timewdw) hbox_timewdw.addWidget(self.lb_timewdw) lay = QFormLayout() lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) lay.addRow(lbl_mode, hbox_mode) lay.addRow(lbl_timewdw, hbox_timewdw) return lay
def __init__(self, parent=None): super().__init__(parent=parent) self.animation = self.parentWidget().animation self._layout = QFormLayout(parent=self) self._init_steps() self._init_ease() self._add_callbacks()
def _device(self, node, channel): attrs = ['name', 'path', 'description', 'hidden', 'groups'] msgBox = QDialog() msgBox.setWindowTitle("Device Information For {}".format(node.name)) msgBox.setMinimumWidth(400) vb = QVBoxLayout() msgBox.setLayout(vb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vb.addLayout(fl) pb = QPushButton('Close') pb.pressed.connect(msgBox.close) vb.addWidget(pb) for a in attrs: le = QLineEdit() le.setReadOnly(True) le.setText(str(getattr(node,a))) fl.addRow(a,le) le = QLineEdit() le.setReadOnly(True) le.setText(channel.address) fl.addRow('PyDM Path',le) msgBox.exec()
def _setupLEDLayout(self): label_LedPwrLvl = QLabel('Intensity [%]: ', self) hbox_LedPwrLvl = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='LEDPwrLvl', propty_type='sprb') label_LedPwrScaleFactor = QLabel('Power Scale Factor: ', self) hbox_LedPwrScaleFactor = _create_propty_layout( parent=self, prefix=self.scrn_prefix, propty='LEDPwrScaleFactor', propty_type='sprb') label_LedThold = QLabel('Voltage Threshold [V]: ', self) hbox_LedThold = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='LEDThold', propty_type='sprb') flay_LED = QFormLayout() flay_LED.addItem( QSpacerItem(1, 10, QSzPlcy.Fixed, QSzPlcy.MinimumExpanding)) flay_LED.addRow(label_LedPwrLvl, hbox_LedPwrLvl) flay_LED.addRow(label_LedPwrScaleFactor, hbox_LedPwrScaleFactor) flay_LED.addRow(label_LedThold, hbox_LedThold) flay_LED.addItem( QSpacerItem(1, 10, QSzPlcy.Fixed, QSzPlcy.MinimumExpanding)) flay_LED.setLabelAlignment(Qt.AlignRight) flay_LED.setFormAlignment(Qt.AlignCenter) return flay_LED
def __init__(self, parent: MainWindow, plotter: pv.Plotter, show: bool = True) -> None: """Initialize the scaling dialog.""" super(ScaleAxesDialog, self).__init__(parent) self.setGeometry(300, 300, 50, 50) self.setMinimumWidth(500) self.signal_close.connect(self.close) self.plotter = plotter self.plotter.app_window.signal_close.connect(self.close) self.x_slider_group = RangeGroup(parent, self.update_scale, value=plotter.scale[0]) self.y_slider_group = RangeGroup(parent, self.update_scale, value=plotter.scale[1]) self.z_slider_group = RangeGroup(parent, self.update_scale, value=plotter.scale[2]) form_layout = QFormLayout(self) form_layout.addRow("X Scale", self.x_slider_group) form_layout.addRow("Y Scale", self.y_slider_group) form_layout.addRow("Z Scale", self.z_slider_group) self.setLayout(form_layout) if show: # pragma: no cover self.show()
def _setupConfigurationWidget(self): statebutton_Test = PyDMStateButton( self, self.dcct_prefix.substitute(propty='Test-Sel')) statebutton_Test.shape = 1 statebutton_Test.setStyleSheet('min-width:6em; max-width:6em;') label_Test = PyDMLabel(self, self.dcct_prefix.substitute(propty='Test-Sts')) hlay_test = QHBoxLayout() hlay_test.addWidget(statebutton_Test) hlay_test.addWidget(label_Test) self.bt_dl = PyDMPushButton( parent=self, pressValue=1, icon=qta.icon('fa5s.sync'), init_channel=self.dcct_prefix.substitute(propty='Download-Cmd')) self.bt_dl.setObjectName('bt_dl') self.bt_dl.setStyleSheet( '#bt_dl{min-width:25px; max-width:25px; icon-size:20px;}') gbox_test = QGroupBox('Configurations') lay = QFormLayout(gbox_test) lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) lay.addRow('Enable test current: ', hlay_test) lay.addRow('Download Configurations: ', self.bt_dl) return gbox_test
def setup_mainwidget(self): lblRunFile = QLabel('Run File') self.lineRunFile = QLineEdit() lblOpenFile = QLabel('Open File') self.lineOpenFile = QLineEdit() fbox = QFormLayout() fbox.addRow(lblRunFile, self.lineRunFile) fbox.addRow(lblOpenFile, self.lineOpenFile) text = "# myprint(self.database) \n" +\ "# myprint(self.treebase)" self.code_view = QPlainTextEdit(text, self) # font = QFont() # font.setFamily(_fromUtf8("FreeMono")) # self.code_view.setFont(font) vbox = QVBoxLayout() vbox.addLayout(fbox) vbox.addWidget(self.code_view) self.mainwidget = QWidget(self) self.mainwidget.setLayout(vbox) # connect syntax highlighter self.pyhigh = PythonHighlighter(self.code_view.document()) self.code_view.textChanged.connect(self.highlightWhileTyping)
def __init__(self): QDialog.__init__(self) # setup UI self.form = QFormLayout(self) self.editPosition = QLineEdit('') self.form.addRow(QLabel('Position'), self.editPosition) self.editVelocity = QLineEdit('') self.form.addRow(QLabel('Velocity'), self.editVelocity) # configure network (take first available servo) self._net, self._servo = il.lucky(il.NET_PROT.EUSB) # create data model model = QStandardItemModel() pos = QStandardItem() vel = QStandardItem() model.appendRow([pos, vel]) # configure and start watcher self._watcher = RegisterWatcher(self._servo) self._watcher.add(POS_ACT, 500, pos) self._watcher.add(VEL_ACT, 100, vel) self._watcher.start(100) # map model fields to widgets self._mapper = QDataWidgetMapper() self._mapper.setModel(model) self._mapper.addMapping(self.editPosition, 0) self._mapper.addMapping(self.editVelocity, 1) self._mapper.toFirst()
def __init__(self, parent=None): super(UiUnitChangeDialog, self).__init__(parent) # Dialog settings self.setWindowTitle("Change Plot Units") self.layout_vertical = QVBoxLayout(self) self.form_layout = QFormLayout() self.layout_vertical.addLayout(self.form_layout) # Flux unit self.label_flux_unit = QLabel(self) self.line_edit_flux_unit = QLineEdit(self) self.label_flux_unit.setText("Flux Unit") self.form_layout.addRow(self.label_flux_unit, self.line_edit_flux_unit) # Dispersion unit self.label_disp_unit = QLabel(self) self.line_edit_disp_unit = QLineEdit(self) self.label_disp_unit.setText("Dispersion Unit") self.form_layout.addRow(self.label_disp_unit, self.line_edit_disp_unit) self.button_box = QDialogButtonBox(self) self.button_box.setOrientation(Qt.Horizontal) self.button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.layout_vertical.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject)
def setupUi(self, lista, query): formLayout = QFormLayout() groupBox = QGroupBox(f"Resultado de la búsqueda: {query}") labelLis = [] comboList = [] for i in range(len(lista)): f = open(lista[i]['name'], 'r', encoding='utf-8') jsonData = json.loads(f.read()) f.close() labelLis.append( QLabel( f'{jsonData["title"]} --- {round(float(lista[i]["distance"])*100, 2)}% --- {jsonData["categoria"]}' )) buttonOpen = QPushButton("Abrir noticia") buttonOpen.clicked.connect(self.make_openFile(lista[i]["name"])) comboList.append(buttonOpen) formLayout.addRow(labelLis[i], comboList[i]) groupBox.setLayout(formLayout) scroll = QScrollArea(self) scroll.setWidget(groupBox) scroll.setWidgetResizable(True) scroll.setMinimumHeight(600) scroll.setMinimumWidth(1200) layout = QVBoxLayout(self) layout.addWidget(scroll) self.setWindowTitle("Noticias") self.resize(1200, 600) self.show() self.exec_()
def __init__(self, parent=None): QWidget.__init__(self) self.tfPlot = TransferFunctionPlot() self.modelCombo = QComboBox() self.modelCombo.addItems(AvailableModels) self.quantityCombo = QComboBox() self.quantityCombo.addItems(['Impedance', 'Admittance']) self.fMinSb = QDoubleSpinBox() self.fMinSb.setRange(0.1, 1E6) self.fMaxSb = QDoubleSpinBox() self.fMaxSb.setRange(10, 1E6) self.fMinSb.setKeyboardTracking(False) self.fMaxSb.setKeyboardTracking(False) self.fMinSb.valueChanged.connect(self.fMinSb.setMinimum) self.fMaxSb.valueChanged.connect(self.fMaxSb.setMaximum) self.fMinSb.setValue(1) self.fMaxSb.setValue(250E3) self.shuntSb = QDoubleSpinBox() self.shuntSb.setDecimals(4) self.shuntSb.setKeyboardTracking(False) self.shuntSb.setRange(0.010, 10) self.shuntSb.setSuffix(u' m\u03A9') self.shuntSb.setValue(0.257) l = QFormLayout() l.addRow('Model', self.modelCombo) l.addRow('Quantity', self.quantityCombo) l.addRow('f (min)', self.fMinSb) l.addRow('f (max)', self.fMaxSb) l.addRow('Shunt resistance', self.shuntSb) self.setLayout(l)
def _command(self, node, channel): attrs = ['name', 'path', 'description', 'hidden', 'groups', 'enum', 'typeStr', 'disp'] if node.isinstance(pyrogue.RemoteCommand): attrs += ['offset', 'bitSize', 'bitOffset', 'varBytes'] msgBox = QDialog() msgBox.setWindowTitle("Command Information For {}".format(node.name)) msgBox.setMinimumWidth(400) vb = QVBoxLayout() msgBox.setLayout(vb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vb.addLayout(fl) pb = QPushButton('Close') pb.pressed.connect(msgBox.close) vb.addWidget(pb) for a in attrs: le = QLineEdit() le.setReadOnly(True) le.setText(str(getattr(node,a))) fl.addRow(a,le) le = QLineEdit() le.setReadOnly(True) le.setText(channel.address) fl.addRow('PyDM Path',le) msgBox.exec()
def __init__(self, main_display, parent=None): super(AxisSettingsDisplay, self).__init__(parent=parent) self.main_layout = QFormLayout() self.main_display = main_display self.chart = self.main_display.chart self.app = self.main_display.app self.x_axis_lbl = QLabel("x-axis Label") self.x_axis_label_line_edt = QLineEdit() current_x_label = self.chart.labels["bottom"] if current_x_label: current_x_label = current_x_label[current_x_label. find(X_AXIS_LABEL_SEPARATOR) + len(X_AXIS_LABEL_SEPARATOR):] self.x_axis_label_line_edt.setText(current_x_label) self.x_axis_label_line_edt.textChanged.connect( partial(self.handle_axis_label_change, "bottom")) self.x_axis_unit_lbl = QLabel("x-axis Unit") self.x_axis_unit_edt = QLineEdit() self.x_axis_unit_edt.setText(self.chart.units["bottom"]) self.x_axis_unit_edt.textChanged.connect( partial(self.handle_axis_label_change, "bottom", is_unit=True)) self.y_axis_lbl = QLabel("y-axis Label") self.y_axis_label_line_edt = QLineEdit() self.y_axis_label_line_edt.setText(self.chart.labels["left"]) self.y_axis_label_line_edt.textChanged.connect( partial(self.handle_axis_label_change, "left")) self.y_axis_unit_lbl = QLabel("y-axis Unit") self.y_axis_unit_edt = QLineEdit() self.y_axis_unit_edt.setText(self.chart.units["left"]) self.y_axis_unit_edt.textChanged.connect( partial(self.handle_axis_label_change, "left", is_unit=True)) self.right_y_axis_label_line_edt = QLineEdit() self.right_y_axis_lbl = QLabel("Right y-axis Label") self.display_right_y_axis_chk = QCheckBox("Display the right y-axis") self.display_right_y_axis_chk.setChecked(self.chart.getShowRightAxis()) self.display_right_y_axis_chk.clicked.connect( self.handle_right_y_axis_checkbox_changed) self.display_right_y_axis_chk.setChecked(self.chart.getShowRightAxis()) self.right_y_axis_lbl = None self.right_y_axis_unit_edt = None self.right_y_axis_unit_lbl = None self.right_y_axis_unit_edt = None self.close_dialog_btn = QPushButton("Close") self.close_dialog_btn.clicked.connect(self.handle_close_button_clicked) self.setWindowTitle("Axis Settings") self.setFixedSize(QSize(300, 250)) self.setWindowModality(Qt.ApplicationModal) self.setup_ui()
def _setupStrengthWidget(self): scrollarea = QScrollArea() self.nconfig_data = QWidget() flay_configdata = QFormLayout() psnames = self._get_PSNames() self._map_psnames2wigdets = dict() for ps in psnames: ps = SiriusPVName(ps) if ps in ramp.BoosterRamp.PSNAME_DIPOLES: ps_value = QLabel(str(self.norm_config[ps])+' GeV', self) flay_configdata.addRow(QLabel(ps + ': ', self), ps_value) else: ps_value = QDoubleSpinBoxPlus(self.nconfig_data) ps_value.setDecimals(6) ps_value.setMinimum(-10000) ps_value.setMaximum(10000) ps_value.setValue(self.norm_config[ps]) ps_value.valueChanged.connect(self._handleStrenghtsSet) if ps.dev in {'QD', 'QF', 'QS'}: unit_txt = '1/m' elif ps.dev in {'SD', 'SF'}: unit_txt = '1/m²' else: unit_txt = 'urad' label_unit = QLabel(unit_txt, self) label_unit.setStyleSheet("min-width:2.5em; max-width:2.5em;") hb = QHBoxLayout() hb.addWidget(ps_value) hb.addWidget(label_unit) flay_configdata.addRow(QLabel(ps + ': ', self), hb) ps_value.setObjectName(ps) ps_value.setStyleSheet("min-height:1.29em; max-height:1.29em;") self._map_psnames2wigdets[ps] = ps_value self.nconfig_data.setObjectName('data') self.nconfig_data.setStyleSheet(""" #data{background-color: transparent;}""") self.nconfig_data.setLayout(flay_configdata) scrollarea.setWidget(self.nconfig_data) self.cb_checklims = QCheckBox('Set limits according to energy', self) self.cb_checklims.setChecked(False) self.cb_checklims.stateChanged.connect(self._handleStrengtsLimits) self.bt_graph = QPushButton(qta.icon('mdi.chart-line'), '', self) self.bt_graph.clicked.connect(self._show_kicks_graph) gbox = QGroupBox() gbox.setObjectName('strengths') gbox.setStyleSheet('#strengths{min-width:20em;}') glay = QGridLayout() glay.addWidget(scrollarea, 0, 0, 1, 2) glay.addWidget(self.cb_checklims, 1, 0, alignment=Qt.AlignLeft) glay.addWidget(self.bt_graph, 1, 1, alignment=Qt.AlignRight) gbox.setLayout(glay) return gbox
def __init__(self): SimulationConfigPanel.__init__(self, IteratedEnsembleSmoother) 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) # The num_iterations_spinner does not track any external changes (will that ever happen?) num_iterations_spinner = QSpinBox() num_iterations_spinner.setMinimum(1) num_iterations_spinner.setMaximum(100) num_iterations_spinner.setValue(getNumberOfIterations()) addHelpToWidget(num_iterations_spinner, "config/simulation/number_of_iterations") num_iterations_spinner.valueChanged[int].connect(setNumberOfIterations) layout.addRow("Number of iterations:", num_iterations_spinner) self._iterated_target_case_format_model = TargetCaseModel( format_mode=True) self._iterated_target_case_format_field = StringBox( self._iterated_target_case_format_model, "config/simulation/iterated_target_case_format", ) self._iterated_target_case_format_field.setValidator( ProperNameFormatArgument()) layout.addRow("Target case format:", self._iterated_target_case_format_field) self._analysis_module_selector = AnalysisModuleSelector( iterable=True, help_link="config/analysis/analysis_module") layout.addRow("Analysis Module:", self._analysis_module_selector) 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._iterated_target_case_format_field.getValidationSupport( ).validationChanged.connect(self.simulationConfigurationChanged) self._active_realizations_field.getValidationSupport( ).validationChanged.connect(self.simulationConfigurationChanged) self.setLayout(layout)
def _setup_status_wid(self): status_layout = QFormLayout(self.status_wid) status_layout.setHorizontalSpacing(20) status_layout.setVerticalSpacing(20) for bit, label in enumerate(_cstime.Const.HLTrigStatusLabels): led = SiriusLedAlert(self, self.get_pvname('Status-Mon'), bit) lab = QLabel(label, self) status_layout.addRow(led, lab)
def __init__(self, parent=None): super().__init__(parent=parent) self.setTitle("Select peak") layout = QFormLayout() layout.setFieldGrowthPolicy(0) self.peak_select = QComboBox() layout.addRow(QLabel("Peak"), self.peak_select) self.setLayout(layout)
def create_controls(self): """ Create UI controls. """ vbox = QVBoxLayout() form = QFormLayout() self.num_angle = QDoubleSpinBox() self.num_angle.setValue(0.0) self.num_angle.setMinimum(-360) self.num_angle.setMaximum(360) form.addRow(tr("Angle:"), self.num_angle) vbox.addLayout(form) self.gbo_preview = QGroupBox(tr("Preview")) self.gbo_preview.setCheckable(True) self.gbo_preview.setChecked(False) gbo_vbox = QVBoxLayout() self.chk_grid = QCheckBox(tr("Grid")) self.chk_grid.setChecked(False) self.num_grid = QSpinBox() self.num_grid.setValue(4) self.num_grid.setMinimum(1) self.num_grid.setEnabled(False) self.chk_grid.toggled[bool].connect(self.num_grid.setEnabled) gbo_vbox.addWidget(self.chk_grid) gbo_vbox.addWidget(self.num_grid) self.gbo_preview.setLayout(gbo_vbox) vbox.addWidget(self.gbo_preview) self.gbo_preview.toggled[bool].connect(self.set_preview) self.gbo_output = QGroupBox(tr("Output")) self.opt_new = QRadioButton(tr("New signal")) self.opt_replace = QRadioButton(tr("In place")) self.opt_new.setChecked(True) gbo_vbox2 = QVBoxLayout() gbo_vbox2.addWidget(self.opt_new) gbo_vbox2.addWidget(self.opt_replace) self.gbo_output.setLayout(gbo_vbox2) vbox.addWidget(self.gbo_output) self.chk_reshape = QCheckBox(tr("Resize to fit")) self.chk_reshape.setChecked(False) vbox.addWidget(self.chk_reshape) self.btn_ok = QPushButton(tr("&OK")) self.btn_ok.setDefault(True) self.btn_ok.clicked.connect(self.accept) self.btn_cancel = QPushButton(tr("&Cancel")) self.btn_cancel.clicked.connect(self.reject) hbox = QHBoxLayout() hbox.addWidget(self.btn_ok) hbox.addWidget(self.btn_cancel) vbox.addLayout(hbox) vbox.addStretch(1) self.setLayout(vbox)
def __init__(self, parent): super(GUIConfigFrame, self).__init__(parent) self.widget_layout = QVBoxLayout(self) self.setLayout(self.widget_layout) self.gui_conf_label = QLabel(self) self.gui_conf_label.setText("GUI server configuration") self.widget_layout.addWidget(self.gui_conf_label) self.desc_label = QLabel(self) self.desc_label.setWordWrap(True) self.desc_label.setText( "QtPyBotnet GUI if fully remote. This means that you can connect to C2 server and " "manage bots wherever you are. To authenticate when connecting to GUI server use the " "key below.") self.widget_layout.addWidget(self.desc_label) self.gui_config = QWidget(self) self.gui_config_layout = QFormLayout(self.gui_config) self.widget_layout.addWidget(self.gui_config) self.gui_ip_label = QLabel(self.gui_config) self.gui_ip_label.setObjectName("gui_ip_label") self.gui_ip_label.setText("GUI IP Address") self.gui_ip_combo = QComboBox(self.gui_config) self.gui_config_layout.addRow(self.gui_ip_label, self.gui_ip_combo) self.gui_port_label = QLabel(self.gui_config) self.gui_port_label.setObjectName("gui_port_label") self.gui_port_label.setText("GUI Port") self.gui_port_edit = QSpinBox(self.gui_config) self.gui_port_edit.setObjectName("gui_port_spin") self.gui_port_edit.setRange(1024, 65535) self.gui_port_edit.setValue(15692) self.gui_config_layout.addRow(self.gui_port_label, self.gui_port_edit) self.gui_key_label = QLabel(self.gui_config) self.gui_key_label.setObjectName("gui_key_label") self.gui_key_label.setText("GUI encryption key") self.gui_key_edit = QLineEdit(self.gui_config) self.gui_key_edit.setObjectName("gui_key_edit") self.gui_key_edit.setReadOnly(True) self.gui_config_layout.addRow(self.gui_key_label, self.gui_key_edit) self.gmaps_key_label = QLabel(self.gui_config) self.gmaps_key_label.setObjectName("gmaps_key_label") self.gmaps_key_label.setText("Google Maps API key") self.gmap_key_edit = QLineEdit(self.gui_config) self.gmap_key_edit.setObjectName("gmap_key_edit") self.gui_config_layout.addRow(self.gmaps_key_label, self.gmap_key_edit) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.widget_layout.addItem(spacerItem)
def __init__(self, parent): super(TaskKwargsGroupBox, self).__init__(parent) self.widgets = [] self.current_task = None self.widget_layout = QFormLayout(self) self.setLayout(self.widget_layout) self.setTitle("Options")
def __init__(self, dims, axis, reverse=False, fps=10, mode=LoopMode.LOOP): super().__init__() self.dims = dims self.axis = axis self.reverse = reverse self.fps = fps self.mode = mode self.setProperty('reverse', str(reverse)) # for styling self.setProperty('playing', 'False') # for styling # build popup modal form self.popup = QtPopup(self) form_layout = QFormLayout() self.popup.frame.setLayout(form_layout) fpsspin = QtCustomDoubleSpinBox(self.popup) fpsspin.setAlignment(Qt.AlignCenter) fpsspin.setValue(self.fps) if hasattr(fpsspin, 'setStepType'): # this was introduced in Qt 5.12. Totally optional, just nice. fpsspin.setStepType(QDoubleSpinBox.AdaptiveDecimalStepType) fpsspin.setMaximum(500) fpsspin.setMinimum(0) form_layout.insertRow(0, QLabel('frames per second:', parent=self.popup), fpsspin) self.fpsspin = fpsspin revcheck = QCheckBox(self.popup) form_layout.insertRow(1, QLabel('play direction:', parent=self.popup), revcheck) self.reverse_check = revcheck # THIS IS HERE TEMPORARILY UNTIL I CAN ADD FRAME_RANGE TO THE POPUP # dimsrange = dims.dims.range[axis] # minspin = QDoubleSpinBox(self.popup) # minspin.setAlignment(Qt.AlignCenter) # minspin.setValue(dimsrange[0]) # minspin.valueChanged.connect(self.set_minframe) # form_layout.insertRow( # 1, QLabel('start frame:', parent=self.popup), minspin # ) # maxspin = QDoubleSpinBox(self.popup) # maxspin.setAlignment(Qt.AlignCenter) # maxspin.setValue(dimsrange[1] * dimsrange[2]) # maxspin.valueChanged.connect(self.set_maxframe) # form_layout.insertRow( # 2, QLabel('end frame:', parent=self.popup), maxspin # ) mode_combo = QComboBox(self.popup) mode_combo.addItems([str(i).replace('_', ' ') for i in LoopMode]) form_layout.insertRow(2, QLabel('play mode:', parent=self.popup), mode_combo) mode_combo.setCurrentText(str(self.mode)) self.mode_combo = mode_combo
def __init__(self, bot, parent): super(AttributesWidget, self).__init__(parent) self.bot = bot self.widgets = [] self.widget_layout = QHBoxLayout(self) self.setLayout(self.widget_layout) # widget with labels self.info_widget = QWidget(self) self.info_widget_layout = QFormLayout(self.info_widget) self.info_widget.setLayout(self.info_widget_layout) self.widget_layout.addWidget(self.info_widget) # widget with actions - remote shell, powershell, remote screen... self.actions_widget = QWidget(self) self.actions_widget_layout = QFormLayout(self.actions_widget) self.actions_widget.setLayout(self.actions_widget_layout)
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.param_name.currentIndexChanged.connect(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.param_name.textChanged.connect(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) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) self.setLayout(self.layout)