def __init__(self, model, parent=None): super().__init__(parent) self._view = QTableView() self._view.setModel(model) cancelButton = QPushButton(_("cancel")) cancelButton.clicked.connect(self.reject) okButton = QPushButton(_("OK")) okButton.setDefault(True) okButton.clicked.connect(self.accept) addButton = QPushButton("+") addButton.clicked.connect(self.add) buttonBox = QHBoxLayout() buttonBox.addWidget(addButton) buttonBox.addStretch(1) buttonBox.addWidget(cancelButton) buttonBox.addWidget(okButton) layout = QVBoxLayout() layout.addWidget(self._view) layout.addLayout(buttonBox) self.setLayout(layout) self.accepted.connect(self.save) self.setWindowTitle(_("Admin.edit" + model.table)) self.resize(600, 300) self._view.resizeColumnsToContents()
def __init__(self, model, parent=None): super().__init__(parent) self._view = QTableView() self._view.setModel(model) cancelButton = QPushButton(_('cancel')) cancelButton.clicked.connect(self.reject) okButton = QPushButton(_('OK')) okButton.setDefault(True) okButton.clicked.connect(self.accept) addButton = QPushButton('+') addButton.clicked.connect(self.add) buttonBox = QHBoxLayout() buttonBox.addWidget(addButton) buttonBox.addStretch(1) buttonBox.addWidget(cancelButton) buttonBox.addWidget(okButton) layout = QVBoxLayout() layout.addWidget(self._view) layout.addLayout(buttonBox) self.setLayout(layout) self.accepted.connect(self.save) self.setWindowTitle(_('Admin.edit' + model.table)) self.resize(600, 300) self._view.resizeColumnsToContents()
def _create(self, base_frame): self.sliders = [] self.spinboxes = [] for i in range(len(self.dim_labels)): self.sliders.append(QSlider(QtCore.Qt.Horizontal)) self.sliders[i].setRange(0, self.n_slider_steps[i]) self.sliders[i].valueChanged.connect( partial(self._on_slide, i)) spinbox = QDoubleSpinBox() spinbox.setRange(*self.limits[i]) spinbox.setDecimals(3) spinbox.setSingleStep(0.001) self.spinboxes.append(spinbox) self.spinboxes[i].valueChanged.connect( partial(self._on_pos_edited, i)) slider_group = QGridLayout() slider_group.addWidget(QLabel("Position"), 0, 0, 1, 3, QtCore.Qt.AlignCenter) slider_group.addWidget(QLabel("Orientation (Euler angles)"), 0, 3, 1, 3, QtCore.Qt.AlignCenter) for i, slider in enumerate(self.sliders): slider_group.addWidget(QLabel(self.dim_labels[i]), 1, i) slider_group.addWidget(slider, 2, i) slider_group.addWidget(self.spinboxes[i], 3, i) slider_groupbox = QGroupBox("Transformation in frame '%s'" % base_frame) slider_groupbox.setLayout(slider_group) layout = QHBoxLayout() layout.addWidget(slider_groupbox) layout.addStretch(1) return layout
def __init__(self, *args): PluginBase.__init__(self, BrickletAnalogInV2, *args) self.ai = self.device self.cbe_voltage = CallbackEmulator(self.ai.get_voltage, self.cb_voltage, self.increase_error_count) self.current_voltage = None # float, V plots = [('Voltage', Qt.red, lambda: self.current_voltage, format_voltage)] self.plot_widget = PlotWidget('Voltage [V]', plots) self.spin_average = QSpinBox() self.spin_average.setMinimum(1) self.spin_average.setMaximum(50) self.spin_average.setSingleStep(1) self.spin_average.setValue(50) self.spin_average.editingFinished.connect(self.spin_average_finished) layout_h1 = QHBoxLayout() layout_h1.addWidget(QLabel('Moving Average Length:')) layout_h1.addWidget(self.spin_average) layout_h1.addStretch() line = QFrame() line.setFrameShape(QFrame.HLine) line.setFrameShadow(QFrame.Sunken) layout = QVBoxLayout(self) layout.addWidget(self.plot_widget) layout.addWidget(line) layout.addLayout(layout_h1)
def __init__(self, title, text, parent=None): QDialog.__init__(self, parent) self.setWindowTitle(title) self.setModal(True) self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) self.setWindowFlags(self.windowFlags() & ~Qt.WindowCloseButtonHint) self.setWindowFlags(self.windowFlags() & ~Qt.WindowCancelButtonHint) layout = QVBoxLayout() layout.setSizeConstraint(QLayout.SetFixedSize) # not resizable!!! label = QLabel(text) layout.addWidget(label) button_layout = QHBoxLayout() self.confirm_button = QPushButton("Confirm") self.confirm_button.clicked.connect(self.confirmButtonPressed.emit) self.reject_button = QPushButton("Reject") self.reject_button.clicked.connect(self.accept) button_layout.addWidget(self.confirm_button) button_layout.addStretch() button_layout.addWidget(self.reject_button) layout.addStretch() layout.addLayout(button_layout) self.setLayout(layout)
def __init__(self, caption, default_value=None, caption_size=None, text_size=None): QWidget.__init__(self) self.description = QLabel(caption) self.description.setWordWrap(True) if caption_size: self.description.setMaximumWidth(caption_size) self.line_edit = QLineEdit() if default_value: self.line_edit.setText(default_value) if text_size: self.line_edit.setMaximumWidth(text_size) hbox = QHBoxLayout() hbox.addWidget(self.description) hbox.addSpacing(10) hbox.addWidget(self.line_edit) if text_size: hbox.addStretch(1) hbox.setMargin(0) self.setLayout(hbox) self.setContentsMargins(0, 0, 0, 0)
class catMenu(object): def catMenu(self, MainWindow): self.kid = MainWindow.kid MainWindow.setGeometry(50, 50, 400, 450) # MainWindow.setFixedSize(400, 450) MainWindow.setWindowTitle("Category Menu") self.w = QWidget(MainWindow) self.l = QLabel("Select you meal type", self.w) self.normal = QPushButton("Normal", self.w) self.veggie = QPushButton("Vegetarian", self.w) self.vegan = QPushButton("Vegan", self.w) MainWindow.setCentralWidget(self.w) self.hbox = QHBoxLayout() self.hbox.addStretch() self.hbox.addWidget(self.l) self.hbox.addStretch() self.vbox = QVBoxLayout() self.vbox.addWidget(self.normal) self.vbox.addWidget(self.veggie) self.vbox.addWidget(self.vegan) self.vbox.addLayout(self.hbox) self.w.setLayout(self.vbox) self.veggie.clicked.connect(partial(self.kid.setVeggie)) self.vegan.clicked.connect(partial(self.kid.setVegan))
def __init__(self, panel): super(Spanners, self).__init__(panel) self.removemenu = QToolButton(self, autoRaise=True, popupMode=QToolButton.InstantPopup, icon=icons.get('edit-clear')) mainwindow = panel.parent().mainwindow() mainwindow.selectionStateChanged.connect(self.removemenu.setEnabled) self.removemenu.setEnabled(mainwindow.hasSelection()) ac = documentactions.DocumentActions.instance( mainwindow).actionCollection self.removemenu.addAction(ac.tools_quick_remove_slurs) layout = QHBoxLayout() layout.addWidget(self.removemenu) layout.addStretch(1) self.layout().addLayout(layout) self.layout().addWidget(ArpeggioGroup(self)) self.layout().addWidget(GlissandoGroup(self)) self.layout().addWidget(SpannerGroup(self)) self.layout().addWidget(GraceGroup(self)) self.layout().addStretch(1)
def __init__(self, ipcon, uid, version): PluginBase.__init__(self, ipcon, uid, 'Ambient Light Bricklet', version) self.al = BrickletAmbientLight(uid, ipcon) self.qtcb_illuminance.connect(self.cb_illuminance) self.al.register_callback(self.al.CALLBACK_ILLUMINANCE, self.qtcb_illuminance.emit) self.illuminance_label = IlluminanceLabel('Illuminance: ') self.alf = AmbientLightFrame() self.current_value = None plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Illuminance [lx]', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.illuminance_label) layout_h.addWidget(self.alf) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def __init__(self, ipcon, uid): PluginBase.__init__(self, ipcon, uid) self.lp = bricklet_linear_poti.LinearPoti(self.uid) self.ipcon.add_device(self.lp) self.version = '.'.join(map(str, self.lp.get_version()[1])) self.qtcb_position.connect(self.cb_position) self.lp.register_callback(self.lp.CALLBACK_POSITION, self.qtcb_position.emit) self.slider = QSlider(Qt.Horizontal) self.slider.setRange(0, 100) self.position_label = PositionLabel('Position: ') self.current_value = 0 plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Position', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.position_label) layout_h.addWidget(self.slider) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def __init__ (self, ipcon, uid): PluginBase.__init__(self, ipcon, uid) self.ai = bricklet_analog_in.AnalogIn(self.uid) self.ipcon.add_device(self.ai) self.version = '.'.join(map(str, self.ai.get_version()[1])) self.qtcb_voltage.connect(self.cb_voltage) self.ai.register_callback(self.ai.CALLBACK_VOLTAGE, self.qtcb_voltage.emit) self.voltage_label = VoltageLabel('Voltage: ') self.current_value = 0 plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Voltage [mV]', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.voltage_label) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def addWidgets(self): layout = QVBoxLayout() self.setLayout(layout) layout.addSpacing(10) preamble = QLabel('This vault is locked.', self) layout.addWidget(preamble) passwdedt = QLineEdit(self) passwdedt.setPlaceholderText('Type password to unlock') passwdedt.setEchoMode(QLineEdit.Password) passwdedt.textChanged.connect(self.passwordChanged) passwdedt.returnPressed.connect(self.unlockVault) layout.addSpacing(10) layout.addWidget(passwdedt) self.passwdedt = passwdedt unlockcb = QCheckBox('Try unlock other vaults too', self) unlockcb.stateChanged.connect(self.saveConfig) unlockcb.setVisible(False) layout.addWidget(unlockcb) self.unlockcb = unlockcb status = QLabel('', self) status.setVisible(False) status.setContentsMargins(0, 10, 0, 0) layout.addWidget(status) self.status = status hbox = QHBoxLayout() unlockbtn = QPushButton('Unlock', self) unlockbtn.setFixedSize(unlockbtn.sizeHint()) unlockbtn.clicked.connect(self.unlockVault) unlockbtn.setEnabled(False) hbox.addWidget(unlockbtn) self.unlockbtn = unlockbtn hbox.addStretch(100) layout.addSpacing(10) layout.addLayout(hbox) layout.addStretch(100)
def __init__(self, *args): COMCUPluginBase.__init__(self, BrickletTemperatureV2, *args) self.tem = self.device self.cbe_temperature = CallbackEmulator(self.tem.get_temperature, self.cb_temperature, self.increase_error_count) self.current_temperature = None # float, °C plots_temperature = [(u'Temperature', Qt.red, lambda: self.current_temperature, u'{} °C'.format)] self.plot_widget_temperature = PlotWidget(u'Temperature [°C]', plots_temperature) self.enable_heater = QCheckBox("Enable Heater") self.enable_heater.stateChanged.connect(self.enable_heater_changed) layout_plot = QHBoxLayout() layout_plot.addWidget(self.plot_widget_temperature) layout_config = QHBoxLayout() layout_config.addStretch() layout_config.addWidget(self.enable_heater) layout_config.addStretch() layout_main = QVBoxLayout(self) layout_main.addLayout(layout_plot) layout_main.addLayout(layout_config)
def __init__(self, parent, prefix = None, suffix = None, option = None, min_ = None, max_ = None, step = None, tip = None, value = None, changed =None): super(MyDoubleSpinBox, self).__init__(parent) if prefix: plabel = QLabel(prefix) else: plabel = None if suffix: slabel = QLabel(suffix) else: slabel = None spinbox = QDoubleSpinBox(parent) if min_ is not None: spinbox.setMinimum(min_) if max_ is not None: spinbox.setMaximum(max_) if step is not None: spinbox.setSingleStep(step) if tip is not None: spinbox.setToolTip(tip) layout = QHBoxLayout() for subwidget in (plabel, spinbox, slabel): if subwidget is not None: layout.addWidget(subwidget) if value is not None: spinbox.setValue(value) if changed is not None: self.connect(spinbox, SIGNAL('valueChanged(double)'), changed) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) self.spin = spinbox
def __init__(self, ipcon, uid): PluginBase.__init__(self, ipcon, uid) self.lp = bricklet_linear_poti.LinearPoti(self.uid) self.ipcon.add_device(self.lp) self.version = ".".join(map(str, self.lp.get_version()[1])) self.qtcb_position.connect(self.cb_position) self.lp.register_callback(self.lp.CALLBACK_POSITION, self.qtcb_position.emit) self.slider = QSlider(Qt.Horizontal) self.slider.setRange(0, 100) self.position_label = PositionLabel("Position: ") self.current_value = 0 plot_list = [["", Qt.red, self.get_current_value]] self.plot_widget = PlotWidget("Position", plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.position_label) layout_h.addWidget(self.slider) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def __init__(self, iterable=False, load_all = False, help_link=""): QWidget.__init__(self) self._iterable = iterable addHelpToWidget(self, help_link) layout = QHBoxLayout() analysis_module_combo = QComboBox() self._module_names = getAnalysisModuleNames(self._iterable) if load_all: self._module_names += getAnalysisModuleNames(not self._iterable) for module_name in self._module_names: analysis_module_combo.addItem(module_name) self._current_module_name = self._getCurrentAnalysisModuleName() if self._current_module_name is not None: analysis_module_combo.setCurrentIndex(self._module_names.index(self._current_module_name)) analysis_module_combo.currentIndexChanged[int].connect(self.analysisModuleChanged) variables_popup_button = QToolButton() variables_popup_button.setIcon(resourceIcon("ide/small/cog_edit.png")) variables_popup_button.clicked.connect(self.showVariablesPopup) variables_popup_button.setMaximumSize(20, 20) layout.addWidget(analysis_module_combo, 0, Qt.AlignLeft) layout.addWidget(variables_popup_button, 0, Qt.AlignLeft) layout.setContentsMargins(QMargins(0, 0, 0, 0)) layout.addStretch() self.setLayout(layout)
def __init__(self, type_key, title, time_spinner, min_value, minimum=-999999999999, maximum=999999999999): QWidget.__init__(self) self.__time_spinner = time_spinner if time_spinner: self.__time_map = ReportStepsModel().getList() self.__time_index_map = {} for index in range(len(self.__time_map)): time = self.__time_map[index] self.__time_index_map[time] = index self.__type_key = type_key self.__spinner = None layout = QHBoxLayout() layout.setMargin(0) self.setLayout(layout) self.__checkbox = QCheckBox(title) self.__checkbox.setChecked(False) layout.addWidget(self.__checkbox) layout.addStretch() if time_spinner: self.__spinner = self.createTimeSpinner(min_value) else: self.__spinner = self.createDoubleSpinner(minimum, maximum) layout.addWidget(self.__spinner) self.__checkbox.stateChanged.connect(self.toggleCheckbox) self.setLayout(layout)
def __init__(self, parent): QDialog.__init__(self, parent) layout = QVBoxLayout(self) self.setLayout(layout) layout.addWidget(QLabel('Enter the field name:', self)) self._field_name_edit = QLineEdit(self) self._field_name_edit.textChanged.connect(self._text_changed) layout.addWidget(self._field_name_edit) layout.addWidget(QLabel('Type:', self)) self._type_combo = QComboBox(self) self._type_combo.addItems(['int', 'float', 'bool', 'str']) layout.addWidget(self._type_combo) buttons = QWidget(self) buttons_layout = QHBoxLayout() buttons.setLayout(buttons_layout) buttons_layout.addStretch() self._ok_button = QPushButton("Ok") self._ok_button.setEnabled(False) cancel_button = QPushButton("Cancel") self._ok_button.clicked.connect(self.accept) cancel_button.clicked.connect(self.reject) buttons_layout.addWidget(self._ok_button) buttons_layout.addWidget(cancel_button) layout.addWidget(buttons)
def __init__(self, ipcon, uid, version): PluginBase.__init__(self, ipcon, uid, 'Heart Rate Bricklet', version) self.hr = BrickletHeartRate(uid, ipcon) self.qtcb_heart_rate.connect(self.cb_heart_rate) self.hr.register_callback(self.hr.CALLBACK_HEART_RATE, self.qtcb_heart_rate.emit) self.qtcb_beat_state_changed.connect(self.cb_beat_state_changed) self.hr.register_callback(self.hr.CALLBACK_BEAT_STATE_CHANGED, self.qtcb_beat_state_changed.emit) self.heart_rate_label = HeartRateLabel() self.heart_white_bitmap = bmp_to_pixmap('plugin_system/plugins/heart_rate/heart_white_small.bmp') self.heart_red_bitmap = bmp_to_pixmap('plugin_system/plugins/heart_rate/heart_red_small.bmp') self.heart_icon = QLabel() self.heart_icon.setPixmap(self.heart_white_bitmap) self.current_value = None plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Heart Rate [BPM]', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.heart_rate_label) layout_h.addWidget(self.heart_icon) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def addSpinBox(self, attribute_name, title, tool_tip=None, min_value=1, max_value=10, single_step=1): sb = QSpinBox() self[attribute_name] = sb sb.setMaximumHeight(25) sb_layout = QHBoxLayout() sb_layout.addWidget(sb) sb_layout.addStretch() self.addRow(title, sb_layout) if tool_tip is not None: sb.setToolTip(tool_tip) sb.setMinimum(min_value) sb.setMaximum(max_value) sb.setSingleStep(single_step) def getter(self): return self[attribute_name].value() def setter(self, value): self[attribute_name].setValue(value) self.updateProperty(attribute_name, getter, setter) return sb
def __init__(self, panel): super(Articulations, self).__init__(panel) self.shorthands = QCheckBox(self) self.shorthands.setChecked(True) self.removemenu = QToolButton(self, autoRaise=True, popupMode=QToolButton.InstantPopup, icon=icons.get('edit-clear')) mainwindow = panel.parent().mainwindow() mainwindow.selectionStateChanged.connect(self.removemenu.setEnabled) self.removemenu.setEnabled(mainwindow.hasSelection()) ac = documentactions.DocumentActions.instance( mainwindow).actionCollection self.removemenu.addAction(ac.tools_quick_remove_articulations) self.removemenu.addAction(ac.tools_quick_remove_ornaments) self.removemenu.addAction(ac.tools_quick_remove_instrument_scripts) layout = QHBoxLayout() layout.addWidget(self.shorthands) layout.addWidget(self.removemenu) layout.addStretch(1) self.layout().addLayout(layout) for cls in ( ArticulationsGroup, OrnamentsGroup, SignsGroup, OtherGroup, ): self.layout().addWidget(cls(self)) self.layout().addStretch(1) app.translateUI(self)
def __init__(self, *args): PluginBase.__init__(self, BrickletAmbientLight, *args) self.al = self.device self.cbe_illuminance = CallbackEmulator(self.al.get_illuminance, self.cb_illuminance, self.increase_error_count) self.illuminance_label = IlluminanceLabel('Illuminance: ') self.alf = AmbientLightFrame() self.current_value = None plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Illuminance [lx]', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.illuminance_label) layout_h.addWidget(self.alf) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def _init_ui(self, to_run_on_table_clicked): # Create record table - lists all the records in the store self._table = QTableWidget() self._table.setFixedWidth(440) self._table.setFixedHeight(600) self._table.setColumnCount(len(self.COLUMNS)) self._table.setHorizontalHeaderLabels(self.COLUMNS) self._table.setColumnWidth(0, 70) self._table.setColumnWidth(1, 55) self._table.setColumnWidth(2, 85) self._table.setColumnWidth(3, 70) self._table.setColumnWidth(4, 45) self._table.setColumnWidth(5, 50) self._table.setColumnWidth(6, 45) self._table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self._table.cellPressed.connect(to_run_on_table_clicked) self._table.cellPressed.connect(self._record_selected) # Delete button - deletes selected records btn_delete = QtGui.QPushButton('Delete') btn_delete.setToolTip('Delete selected scan/s') btn_delete.resize(btn_delete.sizeHint()) btn_delete.clicked.connect(self._delete_selected_records) hbox = QHBoxLayout() hbox.setSpacing(10) hbox.addWidget(btn_delete) hbox.addStretch(1) vbox = QVBoxLayout() vbox.addWidget(self._table) vbox.addLayout(hbox) self.setLayout(vbox)
def __init__(self, current_case): QWidget.__init__(self) self.__model = PlotCaseModel() self.__signal_mapper = QSignalMapper(self) self.__case_selectors = {} self.__case_selectors_order = [] layout = QVBoxLayout() add_button_layout = QHBoxLayout() self.__add_case_button = QToolButton() self.__add_case_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.__add_case_button.setText("Add case to plot") self.__add_case_button.setIcon(resourceIcon("ide/small/add")) self.__add_case_button.clicked.connect(self.addCaseSelector) add_button_layout.addStretch() add_button_layout.addWidget(self.__add_case_button) add_button_layout.addStretch() layout.addLayout(add_button_layout) self.__case_layout = QVBoxLayout() self.__case_layout.setMargin(0) layout.addLayout(self.__case_layout) self.addCaseSelector(disabled=True, current_case=current_case) layout.addStretch() self.setLayout(layout) self.__signal_mapper.mapped[QWidget].connect(self.removeWidget)
def __init__(self): QWidget.__init__(self) layout = QHBoxLayout() layout.addSpacing(10) workflow_model = WorkflowsModel() # workflow_model.observable().attach(WorkflowsModel.CURRENT_CHOICE_CHANGED_EVENT, self.showWorkflow) workflow_combo = ComboChoice(workflow_model, "Select Workflow", "run/workflow") layout.addWidget(QLabel(workflow_combo.getLabel()), 0, Qt.AlignVCenter) layout.addWidget(workflow_combo, 0, Qt.AlignVCenter) # simulation_mode_layout.addStretch() layout.addSpacing(20) self.run_button = QToolButton() self.run_button.setIconSize(QSize(32, 32)) self.run_button.setText("Start Workflow") self.run_button.setIcon(util.resourceIcon("ide/gear_in_play")) self.run_button.clicked.connect(self.startWorkflow) self.run_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) layout.addWidget(self.run_button) layout.addStretch(1) self.setLayout(layout) self.__running_workflow_dialog = None self.workflowSucceeded.connect(self.workflowFinished) self.workflowFailed.connect(self.workflowFinishedWithFail)
class BarreOutilsExEqDte(BarreOutils): def __init__(self, parent): self.parent = parent QWidget.__init__(self, parent) self._selected_button = None self.sizer = QHBoxLayout() if self.parent.param('afficher_boutons'): self.creer_boutons() self.sizer.addStretch() self.sizer.addWidget(QLabel(u"Utilisez cette barre d'outils pour construire les droites (dans le bon ordre).<br>" u"<i>Remarque :</i> pour créer une droite, il vous faudra deux points à coordonnées <i>entières</i>.")) self.sizer.addStretch() self.setLayout(self.sizer) self.adjustSize() def creer_boutons(self): self.add("F1", (u"Pointeur", u"fleche4", u"Déplacer ou modifier un objet.", self.curseur)).select() self.add("F3", (u"Droite", u"droite2", u"Créer une droite.", self.droite)) self.add("F4", (u"Gommer", u"gomme", u"Supprimer des objets.", self.gomme)) def rafraichir(self): pass
def __init__(self, parent, titre, contenu, fonction_modif): QDialog.__init__(self, parent) self.setWindowTitle(titre) sizer = QVBoxLayout() self.parent = parent self.fonction_modif = fonction_modif self.texte = PythonSTC(self) # self.texte.setMinimumSize(300, 10) self.texte.setText(contenu) ## self.texte.SetInsertionPointEnd() sizer.addWidget(self.texte) boutons = QHBoxLayout() self.btn_modif = QPushButton(u"Modifier - F5") boutons.addWidget(self.btn_modif) self.btn_esc = QPushButton(u"Annuler - ESC") boutons.addStretch() boutons.addWidget(self.btn_esc) sizer.addLayout(boutons) self.setLayout(sizer) self.btn_modif.clicked.connect(self.executer) self.btn_esc.clicked.connect(self.close) self.setMinimumSize(400, 500) self.texte.setFocus()
def showImageTab(self): items = ['Use Imageinfo', 'VistaSP0x64', 'VistaSP0x86', 'VistaSP1x64', 'VistaSP2x64', \ 'VistaSP2x86', 'Win2003SP0x86', 'Win2003SP1x64', 'Win2003SP1x86', 'Win2003SP2x64', \ 'Win2003SP2x86', 'Win2008R2SP0x64', 'Win2008R2SP1x64', 'Win2008SP1x64', 'Win2008SP1x86', \ 'Win2008SP2x64', 'Win7SP0x64', 'Win7SP0x86', 'Win7SP1x64', 'Win7SP1x86', 'WinXPSP1x64', \ 'WinXPSP2x64', 'WinXPSP2x86', 'WinXPSP3x86'] fileNameLabel = QLabel("Image: ") profileLabel = QLabel("Profile: ") fileName = QLabel(self.filename) self.profileSelector = QComboBox() self.profileSelector.addItems(items) # index = items.index(self.profile) self.profileSelector.setCurrentIndex(index) horizontalLayout = QHBoxLayout() grid = QGridLayout() grid.addWidget(fileNameLabel, 1, 0) grid.addWidget(fileName, 1, 1) grid.addWidget(profileLabel, 2, 0) grid.addWidget(self.profileSelector, 2, 1) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) grid.addItem(spacerItem) horizontalLayout.addItem(grid) horizontalLayout.addStretch() self.connect(self.profileSelector, SIGNAL("currentIndexChanged(QString)"), self.storeProfile) self.addTabFnc("Image", horizontalLayout) self.dirty = True
def __init__(self, current_case): QWidget.__init__(self) self.__model = PlotCaseModel() self.__signal_mapper = QSignalMapper(self) self.__case_selectors = {} self.__case_selectors_order = [] layout = QVBoxLayout() add_button_layout = QHBoxLayout() self.__add_case_button = QToolButton() self.__add_case_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.__add_case_button.setText("Add case to plot") self.__add_case_button.setIcon(resourceIcon("ide/small/add")) self.__add_case_button.clicked.connect(self.addCaseSelector) add_button_layout.addStretch() add_button_layout.addWidget(self.__add_case_button) add_button_layout.addStretch() layout.addLayout(add_button_layout) self.__case_layout = QVBoxLayout() self.__case_layout.setContentsMargins(0, 0, 0, 0) layout.addLayout(self.__case_layout) self.addCaseSelector(disabled=True, current_case=current_case) layout.addStretch() self.setLayout(layout) self.__signal_mapper.mapped[QWidget].connect(self.removeWidget)
def fill(self): logging.debug(__name__ + ': fill') self.setLayout(QVBoxLayout()) self._splitter = QSplitter() self.layout().addWidget(self._splitter) self._toolList = QListWidget(self._splitter) self.connect(self._toolList, SIGNAL("itemSelectionChanged()"), self.toolSelected) self._properties = PropertyView(self._splitter) bottom = QHBoxLayout() self.layout().addLayout(bottom) changedir = QPushButton("&Change tools directory...") bottom.addWidget(changedir) self.connect(changedir, SIGNAL('clicked()'), self.changedir) help = QPushButton("&Help") bottom.addWidget(help) self.connect(help, SIGNAL('clicked()'), self.help) bottom.addStretch() cancel = QPushButton('&Cancel') bottom.addWidget(cancel) self.connect(cancel, SIGNAL('clicked()'), self.reject) self.ok = QPushButton("&Apply") bottom.addWidget(self.ok) self.ok.setDefault(True) self.connect(self.ok, SIGNAL('clicked()'), self.apply)
def initialize(self, synchronizer, colors): self._synchronizer = synchronizer # set up layout layout = QHBoxLayout() # we need to keep a list of all ColorSelectorItems so we can # parse them later for their colors when saving as spf # or set their color when loading an spf. self.colorWidgets = [] for color in colors: newItem = ColorSelectorItem(color, synchronizer) layout.addWidget(newItem) self.colorWidgets.append(newItem) if color == QColor(Qt.white): synchronizer.select(newItem) colorButton = QPushButton("customize color") QObject.connect(colorButton, SIGNAL("pressed()"), self.customized_color_button_pressed) layout.addWidget(colorButton) layout.addStretch() self.setLayout(layout)
def __init__(self): super().__init__() text = QLabel('Choose a language: ') # intentionally English self._selection = QComboBox() okButton = QPushButton(_('OK')) layout = QVBoxLayout() inputBox = QHBoxLayout() buttonBox = QHBoxLayout() self._langs = get_langs() langs = list(self._langs.keys()) langs.sort() self._selection.addItems([lang for lang in langs]) self._selection.currentIndexChanged.connect(self._set_lang) self._lang = langs.index('English (United States)') self._selection.setCurrentIndex(self._lang) okButton.clicked.connect(self.accept) inputBox.addWidget(text) inputBox.addWidget(self._selection) buttonBox.addStretch(2) buttonBox.addWidget(okButton) layout.addLayout(inputBox) layout.addLayout(buttonBox) self.setLayout(layout)
def __init__(self, parent, app): super(QWidget, self).__init__() layout1 = QHBoxLayout() layout2 = QVBoxLayout() layout1.addStretch() layout1.addLayout(layout2) layout1.addStretch() label = QLabel(self) label.setText("Simple Project: <b>Display Environment Measurements on LCD</b>. Simply displays all measured values on LCD. Sources in all programming languages can be found <a href=\"http://www.tinkerforge.com/en/doc/Kits/WeatherStation/WeatherStation.html#display-environment-measurements-on-lcd\">here</a>.<br>") label.setTextFormat(Qt.RichText) label.setTextInteractionFlags(Qt.TextBrowserInteraction) label.setOpenExternalLinks(True) label.setWordWrap(True) label.setAlignment(Qt.AlignJustify) layout2.addSpacing(10) layout2.addWidget(label) layout2.addSpacing(10) self.lcdwidget = LCDWidget(self, app) layout2.addWidget(self.lcdwidget) layout2.addStretch() self.setLayout(layout1) self.qtcb_update_illuminance.connect(self.update_illuminance_data_slot) self.qtcb_update_air_pressure.connect(self.update_air_pressure_data_slot) self.qtcb_update_temperature.connect(self.update_temperature_data_slot) self.qtcb_update_humidity.connect(self.update_humidity_data_slot) self.qtcb_button_pressed.connect(self.button_pressed_slot)
def __init__(self, parent, fields): QDialog.__init__(self, parent) layout = QVBoxLayout(self) self._list_elements = QListWidget(self) self._fields = dict(fields) for field, ftype in fields.items(): self._list_elements.addItem(field + ' (' + ftype + ')') self._list_elements.setSelectionMode( QAbstractItemView.ExtendedSelection) layout.addWidget(self._list_elements) add_remove = AddRemoveButtonBar(self, 'Remove selected field(s)', self.remove, 'Add field', self.add) layout.addWidget(add_remove) buttons = QWidget(self) buttons_layout = QHBoxLayout() buttons.setLayout(buttons_layout) buttons_layout.addStretch() ok_button = QPushButton("Ok") cancel_button = QPushButton("Cancel") ok_button.clicked.connect(self.accept) cancel_button.clicked.connect(self.reject) buttons_layout.addWidget(ok_button) buttons_layout.addWidget(cancel_button) layout.addWidget(buttons) self.setLayout(layout)
def __init__(self, parent, title='', msg = '', width=None): QDialog.__init__(self, parent) self.setWindowTitle(title) self.setPalette(white_palette) sizer = QVBoxLayout() self.setLayout(sizer) texte = QTextEdit(self) texte.setPlainText(msg) texte.setMinimumHeight(500) texte.setReadOnly(True) if width is None: texte.setLineWrapMode(QTextEdit.NoWrap) doc = texte.document() width = doc.idealWidth() + 4*doc.documentMargin() texte.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) texte.setMinimumWidth(width) sizer.addWidget(texte) boutons = QHBoxLayout() boutons.addStretch() ok = QPushButton('OK', clicked=self.close) boutons.addWidget(ok) boutons.addStretch() sizer.addLayout(boutons)
def _init_ui(self): # Plate being displayed self._plate_lbl = QtGui.QLabel() # Create barcode table - lists all the barcodes in a record self._table = QtGui.QTableWidget() self._table.setFixedWidth(110) self._table.setFixedHeight(600) self._table.setColumnCount(1) self._table.setRowCount(10) self._table.setHorizontalHeaderLabels(['Barcode']) self._table.setColumnWidth(0, 100) # Clipboard button - copy the selected barcodes to the clipboard self._btn_clipboard = QtGui.QPushButton('Copy To Clipboard') self._btn_clipboard.setToolTip('Copy barcodes for the selected record to the clipboard') self._btn_clipboard.resize(self._btn_clipboard.sizeHint()) self._btn_clipboard.clicked.connect(self.copy_to_clipboard) hbox = QHBoxLayout() hbox.setSpacing(10) hbox.addWidget(self._btn_clipboard) hbox.addStretch(1) vbox = QVBoxLayout() vbox.addWidget(self._plate_lbl) vbox.addWidget(self._table) vbox.addLayout(hbox) self.setLayout(vbox)
def __init__(self, parent): QDialog.__init__(self, parent) self.setWindowTitle(u"Configuration systeme") self.setPalette(white_palette) panel = QWidget(self) panelSizer = QVBoxLayout() textes = informations_configuration().split(u"\n") for i, texte in enumerate(textes): if texte.startswith("+ "): textes[i] = '<i>' + texte + '</i>' t = QLabel('<br>'.join(textes), panel) panelSizer.addWidget(t) btnOK = QPushButton(u"OK", panel) btnOK.clicked.connect(self.close) btnCopier = QPushButton(u"Copier", panel) btnCopier.clicked.connect(self.copier) sizer = QHBoxLayout() sizer.addWidget(btnOK) sizer.addStretch() sizer.addWidget(btnCopier) panelSizer.addLayout(sizer) panel.setLayout(panelSizer) topSizer = QHBoxLayout() topSizer.addWidget(panel) self.setLayout(topSizer)
def add_buttons(self, classification): """Helper to setup 3 buttons. :param classification: The current classification. :type classification: dict """ # Note(IS): Until we have good behaviour, we will disable load # default and cancel button. # Add 3 buttons: Load default, Cancel, Save # load_default_button = QPushButton(tr('Load Default')) # cancel_button = QPushButton(tr('Cancel')) self.save_button = QPushButton(tr('Save')) # Action for buttons # cancel_button.clicked.connect(self.cancel_button_clicked) self.save_button.clicked.connect( partial(self.save_button_clicked, classification=classification)) button_layout = QHBoxLayout() # button_layout.addWidget(load_default_button) button_layout.addStretch(1) # button_layout.addWidget(cancel_button) button_layout.addWidget(self.save_button) button_layout.setStretch(0, 3) button_layout.setStretch(1, 1) # button_layout.setStretch(2, 1) # button_layout.setStretch(3, 1) self.right_layout.addLayout(button_layout)
def initGUI(self): self.setWindowTitle(QApplication.applicationName()) layout = QVBoxLayout() headerlayout = QHBoxLayout() homeBtn = QToolButton() homeBtn.setIcon(self.ih.homeButton) homeBtn.setFixedSize(64,64) homeBtn.clicked.connect(self.home) headerlayout.addWidget(homeBtn) label = QLabel("<b>Location</b>") label.setMargin(10) label.setFixedSize(label.sizeHint()) headerlayout.addWidget(label) self.currentLocation = ClickableLabel("") self.currentLocation.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) self.currentLocation.setWordWrap(True) self.currentLocation.setFixedSize(400,64) self.currentLocation.clicked.connect(self.back) headerlayout.addWidget(self.currentLocation) headerlayout.addStretch() layout.addLayout(headerlayout) self.view = QListView() self.view.setSelectionMode( QAbstractItemView.SingleSelection) self.view.setEditTriggers(QAbstractItemView.NoEditTriggers) self.view.setContextMenuPolicy(Qt.CustomContextMenu) self.view.customContextMenuRequested.connect(self.contextMenu) self.view.setModel(self.model) self.view.setModelColumn(0) #self.view.doubleClicked.connect(self.doubleClicked) self.view.activated.connect(self.activated) layout.addWidget(self.view) self.setLayout(layout)
def show_tx_qrcode(self, data, title): if not data: return d = QDialog(self.gui) d.setModal(1) d.setWindowTitle(title) d.setMinimumSize(250, 525) vbox = QVBoxLayout() qrw = QRCodeWidget(data) vbox.addWidget(qrw, 0) hbox = QHBoxLayout() hbox.addStretch(1) def print_qr(self): filename = "qrcode.bmp" electrum_gui.bmp.save_qrcode(qrw.qr, filename) QMessageBox.information( None, _('Message'), _("QR code saved to file") + " " + filename, _('OK')) b = QPushButton(_("Save")) hbox.addWidget(b) b.clicked.connect(print_qr) b = QPushButton(_("Close")) hbox.addWidget(b) b.clicked.connect(d.accept) b.setDefault(True) vbox.addLayout(hbox, 1) d.setLayout(vbox) d.exec_()
def __init__(self, ipcon, uid): PluginBase.__init__(self, ipcon, uid) self.vol = bricklet_voltage.Voltage(self.uid) self.ipcon.add_device(self.vol) self.version = '.'.join(map(str, self.vol.get_version()[1])) self.qtcb_voltage.connect(self.cb_voltage) self.vol.register_callback(self.vol.CALLBACK_VOLTAGE, self.qtcb_voltage.emit) self.voltage_label = CurrentLabel('Voltage: ') self.current_value = 0 plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Voltage [mV]', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.voltage_label) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def __init__(self, parent = None): self.parentWidget = parent super(FetchPDBDialog, self).__init__(parent) self.text = '' self.setWindowTitle("Fetch PDB") layout = QVBoxLayout() idLayout = QHBoxLayout() self.label = QLabel("Enter PDB ID:") self.lineEdit = QLineEdit() #self.lineEdit.setMaxLength(8) # Check with Piotr about this. idLayout.addWidget(self.label) idLayout.addWidget(self.lineEdit) self.okButton = QPushButton("&OK") self.cancelButton = QPushButton("Cancel") buttonLayout = QHBoxLayout() buttonLayout.addStretch() buttonLayout.addWidget(self.okButton) buttonLayout.addWidget(self.cancelButton) layout.addLayout(idLayout) layout.addLayout(buttonLayout) self.setLayout(layout) self.connect(self.lineEdit, SIGNAL("returnPressed()"), self.getProteinCode) self.connect(self.okButton, SIGNAL("clicked()"), self.getProteinCode) self.connect(self.cancelButton, SIGNAL("clicked()"), self, SLOT("reject()")) self.show() return
def __init__(self, *args): PluginBase.__init__(self, BrickletLinearPoti, *args) self.lp = self.device self.cbe_position = CallbackEmulator(self.lp.get_position, self.cb_position, self.increase_error_count) self.slider = QSlider(Qt.Horizontal) self.slider.setRange(0, 100) self.position_label = PositionLabel('Position: ') self.current_value = None plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Position', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.position_label) layout_h.addWidget(self.slider) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def initUI(self): self.topFiller = QTextEdit() self.topFiller.setReadOnly(True) self.topFiller.setMinimumSize(1000, 1000) text = self.scell_name + u" 的不对称小区有: " + str(self.count1) \ + u" 个,对称小区有: " + str(self.count2) + u" 个" + u"\n\n" for (i, info) in enumerate(self.info_list): text = text + info + u"\n" self.topFiller.setText(text) scroll = QScrollArea() scroll.setWidget(self.topFiller) scroll.setAutoFillBackground(True) scroll.setWidgetResizable(True) hbox = QHBoxLayout() ok = QPushButton(u"确定") self.connect(ok, SIGNAL('clicked()'), self.accept) hbox.addStretch(1) hbox.addWidget(ok) hbox.addStretch(1) vbox = QVBoxLayout() vbox.addWidget(scroll) vbox.addLayout(hbox) self.setLayout(vbox) self.setWindowTitle(u"所选服务小区信息") self.resize(680, 320)
def show_tx_qrcode(self, data, title): if not data: return d = QDialog(self.gui) d.setModal(1) d.setWindowTitle(title) d.setMinimumSize(250, 525) vbox = QVBoxLayout() qrw = QRCodeWidget(data) vbox.addWidget(qrw, 0) hbox = QHBoxLayout() hbox.addStretch(1) def print_qr(self): filename = "qrcode.bmp" electrum_gui.bmp.save_qrcode(qrw.qr, filename) QMessageBox.information(None, _('Message'), _("QR code saved to file") + " " + filename, _('OK')) b = QPushButton(_("Save")) hbox.addWidget(b) b.clicked.connect(print_qr) b = QPushButton(_("Close")) hbox.addWidget(b) b.clicked.connect(d.accept) b.setDefault(True) vbox.addLayout(hbox, 1) d.setLayout(vbox) d.exec_()
def create_doublespinbox(self, prefix, suffix, option, min_=None, max_=None, step=None, tip=None): if prefix: plabel = QLabel(prefix) else: plabel = None if suffix: slabel = QLabel(suffix) else: slabel = None spinbox = QDoubleSpinBox() if min_ is not None: spinbox.setMinimum(min_) if max_ is not None: spinbox.setMaximum(max_) if step is not None: spinbox.setSingleStep(step) if tip is not None: spinbox.setToolTip(tip) self.spinboxes[spinbox] = option layout = QHBoxLayout() for subwidget in (plabel, spinbox, slabel): if subwidget is not None: layout.addWidget(subwidget) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) widget = QWidget(self) widget.setLayout(layout) widget.spin = spinbox return widget
def fill(self): logging.debug(__name__ +': fill') self.setLayout(QVBoxLayout()) self._splitter=QSplitter() self.layout().addWidget(self._splitter) self._toolList = QListWidget(self._splitter) self.connect(self._toolList, SIGNAL("itemSelectionChanged()"), self.toolSelected) self._properties=PropertyView(self._splitter) bottom=QHBoxLayout() self.layout().addLayout(bottom) changedir=QPushButton("&Change tools directory...") bottom.addWidget(changedir) self.connect(changedir, SIGNAL('clicked()'), self.changedir) help=QPushButton("&Help") bottom.addWidget(help) self.connect(help, SIGNAL('clicked()'), self.help) bottom.addStretch() cancel = QPushButton('&Cancel') bottom.addWidget(cancel) self.connect(cancel, SIGNAL('clicked()'), self.reject) self.ok=QPushButton("&Apply") bottom.addWidget(self.ok) self.ok.setDefault(True) self.connect(self.ok, SIGNAL('clicked()'), self.apply)
def __init__(self, current_case): QWidget.__init__(self) self.__model = PlotCaseModel() self.__signal_mapper = QSignalMapper(self) self.__case_selectors = {} self.__case_selectors_order = [] layout = QVBoxLayout() add_button_layout = QHBoxLayout() button = QPushButton(util.resourceIcon("ide/small/add"), "Add case to plot") button.clicked.connect(self.addCaseSelector) add_button_layout.addStretch() add_button_layout.addWidget(button) add_button_layout.addStretch() layout.addLayout(add_button_layout) self.__case_layout = QVBoxLayout() self.__case_layout.setMargin(0) layout.addLayout(self.__case_layout) self.addCaseSelector(disabled=True, current_case=current_case) layout.addStretch() self.setLayout(layout) self.__signal_mapper.mapped[QWidget].connect(self.removeWidget)
def __init__(self, weboob, backend, parent=None): QFrame.__init__(self, parent) self.setFrameShape(QFrame.StyledPanel) self.setFrameShadow(QFrame.Raised) self.weboob = weboob self.backend = backend self.setLayout(QVBoxLayout()) self.timer = None head = QHBoxLayout() headw = QWidget() headw.setLayout(head) self.title = QLabel(u'<h1>%s — %s</h1>' % (backend.name, backend.DESCRIPTION)) self.body = QLabel() if backend.ICON: self.icon = QLabel() img = QImage(backend.ICON) self.icon.setPixmap(QPixmap.fromImage(img)) head.addWidget(self.icon) head.addWidget(self.title) head.addStretch() self.layout().addWidget(headw) if backend.has_caps(ICapAccount): self.body.setText(u'<i>Waiting...</i>') self.layout().addWidget(self.body) self.timer = self.weboob.repeat(60, self.updateStats)
def _align(widget, checkbox=None): l = QHBoxLayout() if checkbox is not None: checkbox.setMaximumWidth(23) l.addWidget(checkbox, 0) else: l.addSpacing(25) l.addStretch(0.5) if widget is not None: widget.setMinimumWidth(180) widget.setMaximumWidth(180) l.addWidget(widget) else: l.addSpacing(180) l.setContentsMargins(0, 0, 0, 0) l.addStretch(1) w = QWidget() w.setContentsMargins(0, 2, 0, 2) w.setLayout(l) return w
def __init__(self, name, data, scheme, parent=None): QWidget.__init__(self, parent) NodeWidget.__init__(self, name, data, scheme) self.layout = QVBoxLayout(self) self.layout.setMargin(0) self._listwidget = QListWidget(self) self.layout.addWidget(self._listwidget) hlayout = QHBoxLayout() self.layout.setMargin(0) self.layout.setContentsMargins(0,0,0,0) self.layout.addLayout(hlayout) self._plus_minus_widget = PlusMinusWidget(self.create_item, self.delete_item, self) hlayout.addWidget(self._plus_minus_widget) # self._edit_button = SmallSquareButton("edit", self) # hlayout.addWidget(self._edit_button) # self._edit_button.clicked.connect(self.edit_item) self._listwidget.itemDoubleClicked.connect(self.edit_item) hlayout.addStretch(1) self._listwidget.setEditTriggers(QAbstractItemView.EditKeyPressed) self._listwidget.itemChanged.connect(self.rename_item) self._listwidget.currentItemChanged.connect(self.current_item_changed) self.current_item_index = None
def setModel(self, model): """ Set model used to store the data. This method adds an extra row at the end, which is used to keep the "Add..." button. """ super( DatasetDetailedInfoTableView, self ).setModel(model) widget = QWidget() layout = QHBoxLayout(widget) self._addButton = button = AddFileButton(widget, new=True) button.addFilesRequested.connect( partial(self.addFilesRequested.emit, -1)) button.addStackRequested.connect( partial(self.addStackRequested.emit, -1)) button.addRemoteVolumeRequested.connect( partial(self.addRemoteVolumeRequested.emit, -1)) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(button) layout.addStretch() widget.setLayout(layout) lastRow = self.model().rowCount()-1 modelIndex = self.model().index( lastRow, 0 ) self.setIndexWidget( modelIndex, widget ) # the "Add..." button spans last row self.setSpan(lastRow, 0, 1, model.columnCount())
def __init__(self, dataset, title = '', settings = None, settingskey = None, parent = None): super(ParamWidget, self).__init__(parent = parent) self.settings = settings self.settingskey = settingskey self.mainLayout = QVBoxLayout() self.setLayout(self.mainLayout) if self.settings is not None and self.settingskey is not None: stored_list = self.settings.getValueOrDefault('storedParameters/'+self.settingskey, [ ]) h = QHBoxLayout() self.mainLayout.addLayout(h) h.addStretch(1) self.comboParam = QComboBox() h.addWidget(self.comboParam, 3) self.refreshCombo() self.comboParam.currentIndexChanged.connect(self.comboParamChanged) buttonSave = QPushButton(QIcon(':/list-add.png') ,'') buttonSave.setMaximumSize(25,25) h.addWidget(buttonSave) buttonSave.clicked.connect(self.saveNewParam) buttonDel = QPushButton(QIcon(':/list-remove.png') ,'') buttonDel.setMaximumSize(25,25) h.addWidget(buttonDel) buttonDel.clicked.connect(self.delSavedParam) self.params = DataSetEditGroupBox(title,dataset, show_button = False) self.mainLayout.addWidget( self.params ) self.default_dict = self.to_dict()
def __init__(self, ipcon, uid, version): PluginBase.__init__(self, ipcon, uid, 'Linear Poti Bricklet', version) self.lp = BrickletLinearPoti(uid, ipcon) self.qtcb_position.connect(self.cb_position) self.lp.register_callback(self.lp.CALLBACK_POSITION, self.qtcb_position.emit) self.slider = QSlider(Qt.Horizontal) self.slider.setRange(0, 100) self.position_label = PositionLabel('Position: ') self.current_value = None plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Position', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.position_label) layout_h.addWidget(self.slider) layout_h.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addWidget(self.plot_widget)
def __init__(self, *args): PluginBase.__init__(self, None, *args, override_base_name='Unknown') # All new released Bricklets will have a comcu self.has_comcu = True info = args[1] layout = QVBoxLayout() layout.addStretch() label = QLabel("""The {6} with * Device Identifier: {0} * UID: {1} * Position: {2} * FW Version: {3}.{4}.{5} is not yet supported. Please update Brick Viewer!""".format(info.device_identifier, info.uid, info.position.upper(), info.firmware_version_installed[0], info.firmware_version_installed[1], info.firmware_version_installed[2], 'Brick' if str(info.device_identifier).startswith('1') else 'Bricklet')) #label.setAlignment(Qt.AlignHCenter) layout.addWidget(label) layout.addStretch() hbox = QHBoxLayout(self) hbox.addStretch() hbox.addLayout(layout) hbox.addStretch()
def __init__(self, *args): PluginBase.__init__(self, BrickletCO2, *args) self.co2 = self.device self.cbe_co2_concentration = CallbackEmulator( self.co2.get_co2_concentration, self.cb_co2_concentration, self.increase_error_count) self.co2_concentration_label = CO2ConcentrationLabel( 'CO2 Concentration: ') self.current_value = None plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('CO2 Concentration [ppm]', plot_list) layout_h2 = QHBoxLayout() layout_h2.addStretch() layout_h2.addWidget(self.co2_concentration_label) layout_h2.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h2) layout.addWidget(self.plot_widget)
def __init__(self, parent=None): self.parentWidget = parent super(FetchPDBDialog, self).__init__(parent) self.text = '' self.setWindowTitle("Fetch PDB") layout = QVBoxLayout() idLayout = QHBoxLayout() self.label = QLabel("Enter PDB ID:") self.lineEdit = QLineEdit() #self.lineEdit.setMaxLength(8) # Check with Piotr about this. idLayout.addWidget(self.label) idLayout.addWidget(self.lineEdit) self.okButton = QPushButton("&OK") self.cancelButton = QPushButton("Cancel") buttonLayout = QHBoxLayout() buttonLayout.addStretch() buttonLayout.addWidget(self.okButton) buttonLayout.addWidget(self.cancelButton) layout.addLayout(idLayout) layout.addLayout(buttonLayout) self.setLayout(layout) self.connect(self.lineEdit, SIGNAL("returnPressed()"), self.getProteinCode) self.connect(self.okButton, SIGNAL("clicked()"), self.getProteinCode) self.connect(self.cancelButton, SIGNAL("clicked()"), self, SLOT("reject()")) self.show() return