def createWidgets(self): """ """ self.readButton = QPushButton("&Read SeleniumIDE\n(HTML File)") self.exportButton = QPushButton( "&Import in %s" % Settings.instance().readValue(key='Common/product-name')) self.exportButton.setEnabled(False) self.actsTable = ActionsTableView(self, core=self.core()) rightLayout = QVBoxLayout() rightLayout.addWidget(QLabel("Controls")) rightLayout.addWidget(self.readButton) rightLayout.addWidget(self.exportButton) rightLayout.addStretch(1) leftLayout = QVBoxLayout() leftLayout.addWidget(QLabel("Actions")) leftLayout.addWidget(self.actsTable) mainLayout = QHBoxLayout() mainLayout.addLayout(leftLayout) mainLayout.addLayout(rightLayout) self.setLayout(mainLayout)
def __init__(self, *args): PluginBase.__init__(self, BrickletAnalogOutV2, *args) self.ao = self.device self.input_voltage_label = VoltageLabel() self.output_voltage_label = QLabel('Output Voltage [mV]: ') self.output_voltage_box = QSpinBox() self.output_voltage_box.setMinimum(0) self.output_voltage_box.setMaximum(12000) self.output_voltage_box.setSingleStep(1) layout_h1 = QHBoxLayout() layout_h1.addStretch() layout_h1.addWidget(self.output_voltage_label) layout_h1.addWidget(self.output_voltage_box) layout_h1.addStretch() layout_h2 = QHBoxLayout() layout_h2.addStretch() layout_h2.addWidget(self.input_voltage_label) layout_h2.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h2) layout.addLayout(layout_h1) layout.addStretch() self.output_voltage_box.editingFinished.connect(self.voltage_finished) self.cbe_input_voltage = CallbackEmulator(self.ao.get_input_voltage, self.cb_get_input_voltage, self.increase_error_count)
def build_post_processor_form(self, form_elements): """Build Post Processor Tab. :param form_elements: A Dictionary containing element of form. :type form_elements: dict """ scroll_layout = QVBoxLayout() scroll_widget = QWidget() scroll_widget.setLayout(scroll_layout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(scroll_widget) main_layout = QVBoxLayout() main_layout.addWidget(scroll) main_widget = QWidget() main_widget.setLayout(main_layout) self.tabWidget.addTab(main_widget, self.tr('Postprocessors')) self.tabWidget.tabBar().setVisible(True) # create elements for the tab values = OrderedDict() for label, parameters in form_elements.items(): parameter_container = ParameterContainer(parameters) parameter_container.setup_ui(must_scroll=False) scroll_layout.addWidget(parameter_container) input_values = parameter_container.get_parameters values[label] = input_values self.values['postprocessors'] = values scroll_layout.addStretch()
def __init__(self, parent=None): super(MTestForm, self).__init__(parent) self.model = SnapshotTableModel() self.model.addSnapshot('test.h5') self.tablev = QTableView() self.tablev.setModel(self.model) self.tablev.setItemDelegate(SnapshotItemDelegate(self)) #for i in range(self.model.columnCount()): self.tablev.resizeColumnsToContents() self.tablev.setColumnHidden(1, True) hb1 = QHBoxLayout() vb2 = QVBoxLayout() vb2.addWidget(ApPlotWidget(), 1.0) vb3a = QVBoxLayout() cb = QCheckBox("show PV") self.connect(cb, SIGNAL("stateChanged(int)"), self._set_pv_view) vb3a.addWidget(cb) vb3a.addStretch() vb3b = QVBoxLayout() vb3b.addWidget(QPushButton("Refresh")) vb3b.addWidget(QPushButton("Plot")) vb3b.addWidget(QPushButton("Ramp")) vb3b.addStretch() hb2 = QHBoxLayout() hb2.addLayout(vb3a, 1.0) hb2.addLayout(vb3b) vb2.addLayout(hb2) hb1.addWidget(self.tablev, .6) hb1.addLayout(vb2, 0.4) self.setLayout(hb1)
def __init__(self, ipcon, uid): PluginBase.__init__(self, ipcon, uid) self.dr = bricklet_dual_relay.DualRelay(self.uid) self.ipcon.add_device(self.dr) self.version = '.'.join(map(str, self.dr.get_version()[1])) dr1_label = QLabel("Relay 1:") self.dr1_button = QPushButton("Off") dr1_layout = QHBoxLayout() dr1_layout.addStretch() dr1_layout.addWidget(dr1_label) dr1_layout.addWidget(self.dr1_button) dr1_layout.addStretch() dr2_label = QLabel("Relay 2:") self.dr2_button = QPushButton("Off") dr2_layout = QHBoxLayout() dr2_layout.addStretch() dr2_layout.addWidget(dr2_label) dr2_layout.addWidget(self.dr2_button) dr2_layout.addStretch() self.dr1_button.pressed.connect(self.dr1_pressed) self.dr2_button.pressed.connect(self.dr2_pressed) layout = QVBoxLayout(self) layout.addLayout(dr1_layout) layout.addLayout(dr2_layout) layout.addStretch()
def createInfoLayout(): info_layout = QVBoxLayout() ert = QLabel() ert.setAlignment(Qt.AlignHCenter) title_font = QFont() title_font.setPointSize(40) ert.setFont(title_font) ert.setText("ERT") info_layout.addWidget(ert) info_layout.addStretch(1) ert_title = QLabel() ert_title.setAlignment(Qt.AlignHCenter) ert_title.setText("Ensemble based Reservoir Tool") info_layout.addWidget(ert_title) version = QLabel() version.setAlignment(Qt.AlignHCenter) version.setText( "Versions: ecl:%s res:%s ert:%s" % (ecl.__version__, res.__version__, ert_gui.__version__)) info_layout.addWidget(version) info_layout.addStretch(5) return info_layout
def __init__(self, parent = None): QWidget.__init__(self, parent) def hbox(*widgets): box = QHBoxLayout() [box.addWidget(z) for z in widgets] box.addStretch() return box vbox = QVBoxLayout() startlabel = QLabel(translate('Autonumbering Wizard', "&Start: ")) self._start = QSpinBox() startlabel.setBuddy(self._start) self._start.setValue(1) self._start.setMaximum(65536) vbox.addLayout(hbox(startlabel, self._start)) label = QLabel(translate('Autonumbering Wizard', 'Max length after padding with zeroes: ')) self._padlength = QSpinBox() label.setBuddy(self._padlength) self._padlength.setValue(1) self._padlength.setMaximum(65535) self._padlength.setMinimum(1) vbox.addLayout(hbox(label, self._padlength)) self._restart_numbering = QCheckBox(translate('Autonumbering Wizard', "&Restart numbering at each directory.")) vbox.addWidget(self._restart_numbering) vbox.addStretch() self.setLayout(vbox)
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 addWidgets(self): layout = QVBoxLayout() self.setLayout(layout) layout.addSpacing(10) label = QLabel(self) label.setTextFormat(Qt.RichText) label.setText('<p>There are currently no vaults.</p>' '<p>To store passwords in Bluepass, ' 'you need to create a vault first.</p>') label.setWordWrap(True) layout.addWidget(label) layout.addSpacing(10) hbox = QHBoxLayout() layout.addLayout(hbox) newbtn = QPushButton('Create New Vault', self) newbtn.clicked.connect(self.newVault) hbox.addStretch(100) hbox.addWidget(newbtn) hbox.addStretch(100) hbox = QHBoxLayout() layout.addLayout(hbox) connectbtn = QPushButton('Connect to Existing Vault', self) connectbtn.clicked.connect(self.connectVault) hbox.addStretch(100) hbox.addWidget(connectbtn) hbox.addStretch(100) width = max(newbtn.sizeHint().width(), connectbtn.sizeHint().width()) + 40 newbtn.setFixedWidth(width) connectbtn.setFixedWidth(width) layout.addStretch(100)
def __init__(self, *args): PluginBase.__init__(self, BrickletAnalogOutV2, *args) self.ao = self.device self.input_voltage_label = VoltageLabel() self.output_voltage_label = QLabel('Output Voltage [mV]:') self.output_voltage_box = QSpinBox() self.output_voltage_box.setMinimum(0) self.output_voltage_box.setMaximum(12000) self.output_voltage_box.setSingleStep(1) layout_h1 = QHBoxLayout() layout_h1.addStretch() layout_h1.addWidget(self.output_voltage_label) layout_h1.addWidget(self.output_voltage_box) layout_h1.addStretch() layout_h2 = QHBoxLayout() layout_h2.addStretch() layout_h2.addWidget(self.input_voltage_label) layout_h2.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h2) layout.addLayout(layout_h1) layout.addStretch() self.output_voltage_box.editingFinished.connect(self.voltage_finished) self.cbe_input_voltage = CallbackEmulator(self.ao.get_input_voltage, self.cb_get_input_voltage, self.increase_error_count)
def __init__(self, parent=None): super(MTestForm, self).__init__(parent) self.model = SnapshotTableModel() self.model.addSnapshot('test.h5') self.tablev = QTableView() self.tablev.setModel(self.model) self.tablev.setItemDelegate(SnapshotItemDelegate(self)) #for i in range(self.model.columnCount()): self.tablev.resizeColumnsToContents() self.tablev.setColumnHidden(1, True) hb1 = QHBoxLayout() vb2 = QVBoxLayout() vb2.addWidget(ApPlotWidget(), 1.0) vb3a = QVBoxLayout() cb = QCheckBox("show PV") self.connect(cb, SIGNAL("stateChanged(int)"), self._set_pv_view) vb3a.addWidget(cb) vb3a.addStretch() vb3b = QVBoxLayout() vb3b.addWidget(QPushButton("Refresh")) vb3b.addWidget(QPushButton("Plot")) vb3b.addWidget(QPushButton("Ramp")) vb3b.addStretch() hb2 = QHBoxLayout() hb2.addLayout(vb3a, 1.0) hb2.addLayout(vb3b) vb2.addLayout(hb2) hb1.addWidget(self.tablev, .6) hb1.addLayout(vb2, 0.4) self.setLayout(hb1)
def setup_mpl_canvas(self): ''' setup matplotlib manipulation pane widget for displaying and editing lattice graph ''' self.dpi = 100 self.fig = Figure((5.0, 5.0), dpi=self.dpi) self.canvas = FigureCanvas(self.fig) self.ax = self.fig.gca(projection='3d') self.fig.subplots_adjust(left=0, bottom=0, right=1, top=1) self.canvas.setParent(self.mplWidget) self.mplLayout.addWidget(self.canvas) self.canvas.setFocusPolicy(Qt.ClickFocus) self.canvas.setFocus() # add aniation button self.btnPlay = QPushButton("Animate") self.btnPlay.setStatusTip("Open animation manager.") self.btnPlay.clicked.connect(self.exportAnim_callback) self.btnPlay.setFocusPolicy(Qt.NoFocus) mplHbox = QHBoxLayout() mplHbox.addWidget(self.btnPlay) mplHbox.addStretch() mplVbox = QVBoxLayout() mplVbox.addLayout(mplHbox) mplVbox.addStretch() self.canvas.setLayout(mplVbox)
def init_view(self): field_group = QGroupBox('Field') field_layout = QVBoxLayout() field_layout.addWidget(self) field_layout.addStretch(1) field_group.setLayout(field_layout) return field_group
def __init__(self, iface, parent=None): super(AccuratePCISettingDlg, self).__init__() self.iface = iface self.parent = parent self.setWindowTitle(u"PCI规划(高级)") self.setWindowFlags(Qt.WindowStaysOnTopHint) label = QLabel(u"请选择算法循环次数:") self.Cycles = QLineEdit() validator = QIntValidator(0, 999, self) self.Cycles.setValidator(validator) setting_grid = QGridLayout() setting_grid.setSpacing(15) setting_grid.addWidget(label, 0, 0) setting_grid.addWidget(self.Cycles, 0, 1) ok = QPushButton(u"确定") self.connect(ok, SIGNAL("clicked()"), self.run) cancel = QPushButton(u"取消") self.connect(cancel, SIGNAL("clicked()"), self.accept) btn_hbox = QHBoxLayout() btn_hbox.setSpacing(10) btn_hbox.addStretch(1) btn_hbox.addWidget(ok) btn_hbox.addWidget(cancel) btn_hbox.addStretch(1) vbox = QVBoxLayout() vbox.addLayout(setting_grid) vbox.addStretch(1) vbox.addLayout(btn_hbox) self.setLayout(vbox) self.resize(180, 80)
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, help_center_name, parent=None): QMainWindow.__init__(self, parent, Qt.WindowStaysOnTopHint) palette = self.palette() palette.setColor(self.backgroundRole(), QColor(255, 255, 224)) self.setPalette(palette) self.setAutoFillBackground(True) self.setMinimumWidth(300) self.setMinimumHeight(250) self.setWindowTitle("Help") self.setObjectName("ert-gui-help") central_widget = QWidget() layout = QVBoxLayout() central_widget.setLayout(layout) self.link_widget = QLabel() self.link_widget.setStyleSheet("font-weight: bold") self.link_widget.setMinimumHeight(20) self.help_widget = QLabel(HelpWindow.default_help_string) self.help_widget.setWordWrap(True) self.help_widget.setTextFormat(Qt.RichText) self.help_widget.linkActivated.connect(self.openHelpURL) layout.addWidget(self.link_widget) layout.addWidget(self.help_widget) layout.addStretch(1) HelpCenter.getHelpCenter(help_center_name).addListener(self) self.__position = None self.__geometry = None self.setCentralWidget(central_widget)
def __init__(self, parent): QScrollArea.__init__(self, parent) self.setFrameShape(QScrollArea.NoFrame) self.setAutoFillBackground(False) self.setWidgetResizable(True) self.setMouseTracking(True) #self.verticalScrollBar().setMaximumWidth(10) widget = QWidget(self) # define custom properties self._rolloutStyle = AccordionWidget.Rounded self._dragDropMode = AccordionWidget.NoDragDrop self._scrolling = False self._scrollInitY = 0 self._scrollInitVal = 0 self._itemClass = AccordionItem self._items = {} layout = QVBoxLayout() layout.setContentsMargins(2, 2, 2, 2) layout.setSpacing(2) layout.addStretch(1) widget.setLayout(layout) self.setWidget(widget)
def __init__(self, name, stringlist=None, parent=None): super(StringListDlg, self).__init__(parent) self.name = name self.listWidget = QListWidget() if stringlist is not None: self.listWidget.addItems(stringlist) self.listWidget.setCurrentRow(0) buttonLayout = QVBoxLayout() for text, slot in (("&Add...", self.add), ("&Edit...", self.edit), ("&Remove...", self.remove), ("&Up", self.up), ("&Down", self.down), ("&Sort", self.listWidget.sortItems), ("Close", self.accept)): button = QPushButton(text) if not MAC: button.setFocusPolicy(Qt.NoFocus) if text == "Close": buttonLayout.addStretch() buttonLayout.addWidget(button) self.connect(button, SIGNAL("clicked()"), slot) layout = QHBoxLayout() layout.addWidget(self.listWidget) layout.addLayout(buttonLayout) self.setLayout(layout) self.setWindowTitle("Edit {0} List".format(self.name))
def build_post_processor_form(self, form_elements): """Build Post Processor Tab. :param form_elements: A Dictionary containing element of form. :type form_elements: dict """ scroll_layout = QVBoxLayout() scroll_widget = QWidget() scroll_widget.setLayout(scroll_layout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(scroll_widget) main_layout = QVBoxLayout() main_layout.addWidget(scroll) main_widget = QWidget() main_widget.setLayout(main_layout) self.tabWidget.addTab(main_widget, self.tr('Postprocessors')) self.tabWidget.tabBar().setVisible(True) # create elements for the tab values = OrderedDict() for label, parameters in form_elements.items(): parameter_container = ParameterContainer(parameters) parameter_container.setup_ui(must_scroll=False) scroll_layout.addWidget(parameter_container) input_values = parameter_container.get_parameters values[label] = input_values self.values['postprocessors'] = values scroll_layout.addStretch()
class CustomCodesWidget(QWidget): poke_code = pyqtSignal(str, int, QByteArray) # code_set_label, code_id, new_bytes log = pyqtSignal(str, str) # msg, color def __init__(self, data_store, parent=None): super(CustomCodesWidget, self).__init__(parent) self.d = data_store self.entries = [] self.btn_add = QPushButton('Add Entry', self) self.btn_add.clicked.connect(self.onAdd) self.layout = QVBoxLayout(self) self.layout.addWidget(self.btn_add) self.layout.addStretch() self.layout.setSpacing(0) self.setStyleSheet('CustomCodesWidget {background-color: white}') @pyqtSlot() def onAdd(self): entry_id = len(self.entries) + 1 new_cs = CodeSet('__CUSTOM__%d' % entry_id) self.d.custom_codes[new_cs.label] = new_cs new_entry = CustomCodeFrame(new_cs, self) new_entry.poke_code.connect(self.poke_code) new_entry.log.connect(self.log) self.entries.append(new_entry) if entry_id % 2 == 0: new_entry.setAlternateBGColor() self.layout.insertWidget(len(self.entries), new_entry)
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, ipcon, uid, version): PluginBase.__init__(self, ipcon, uid, 'Sound Intensity Bricklet', version) self.si = BrickletSoundIntensity(uid, ipcon) self.qtcb_intensity.connect(self.cb_intensity) self.si.register_callback(self.si.CALLBACK_INTENSITY, self.qtcb_intensity.emit) self.intensity_label = IntensityLabel() self.current_value = None self.thermo = TuningThermo() # plot_list = [['', Qt.red, self.get_current_value]] # self.plot_widget = PlotWidget('Intensity', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.intensity_label) layout_h.addStretch() layout_h2 = QHBoxLayout() layout_h2.addStretch() layout_h2.addWidget(self.thermo) layout_h2.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addLayout(layout_h2) layout.addStretch()
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 setup_page(self): simulation_group = QGroupBox("Simulation") sim_dateedit = self.create_dateedit("Date de la simulation", 'datesim', min_date=QDate(2002, 01, 01), max_date=QDate(2010, 12, 31)) nmen_spinbox = self.create_spinbox(u'Nombre de ménages', '', 'nmen', min_=1, max_=10001, step=100) xaxis_choices = [(u'Salaires', 'sal'), (u'Chômage', 'cho'), (u'Retraites', 'rst')] xaxis_combo = self.create_combobox('Axe des abscisses', xaxis_choices, 'xaxis') maxrev_spinbox = self.create_spinbox("Revenu maximum", 'euros', 'maxrev', min_=0, max_=10000000, step=1000) simulation_layout = QVBoxLayout() simulation_layout.addWidget(sim_dateedit) simulation_layout.addWidget(nmen_spinbox) simulation_layout.addWidget(xaxis_combo) simulation_layout.addWidget(maxrev_spinbox) simulation_group.setLayout(simulation_layout) vlayout = QVBoxLayout() vlayout.addWidget(simulation_group) vlayout.addStretch(1) self.setLayout(vlayout)
def __init__(self, broker, parent=None): super(BrokerWidget, self).__init__(parent) self.broker = broker self.dataTable = TableView() self.dataTable.setModel(self.broker.dataModel) self.dataTable.horizontalHeader().setResizeMode(QHeaderView.Stretch) #self.dataTable.resizeColumnsToContents() dataLabel = QLabel('Price Data') dataLabel.setBuddy(self.dataTable) dataLayout = QVBoxLayout() dataLayout.addWidget(dataLabel) dataLayout.addWidget(self.dataTable) addButton = QPushButton("&Add Symbol") saveDataButton = QPushButton("&Save Data") #deleteButton = QPushButton("&Delete") buttonLayout = QVBoxLayout() buttonLayout.addWidget(addButton) buttonLayout.addWidget(saveDataButton) buttonLayout.addStretch() layout = QHBoxLayout() layout.addLayout(dataLayout) layout.addLayout(buttonLayout) self.setLayout(layout) self.connect(addButton, SIGNAL('clicked()'), self.addSubscription) self.connect(saveDataButton, SIGNAL('clicked()'), self.saveData)
def __init__(self, parent=None): super(ObjectWidget, self).__init__(parent) l_nbr_steps = QLabel("Nbr Steps ") self.nbr_steps = QSpinBox() self.nbr_steps.setMinimum(3) self.nbr_steps.setMaximum(100) self.nbr_steps.setValue(6) self.nbr_steps.valueChanged.connect(self.update_param) l_cmap = QLabel("Cmap ") self.cmap = sorted(get_colormaps().keys()) self.combo = QComboBox(self) self.combo.addItems(self.cmap) self.combo.currentIndexChanged.connect(self.update_param) gbox = QGridLayout() gbox.addWidget(l_cmap, 0, 0) gbox.addWidget(self.combo, 0, 1) gbox.addWidget(l_nbr_steps, 1, 0) gbox.addWidget(self.nbr_steps, 1, 1) vbox = QVBoxLayout() vbox.addLayout(gbox) vbox.addStretch(1.0) self.setLayout(vbox)
def __init__(self, parent=None, param=None): super(SphereWidget, self).__init__(parent) if param is None: self.param = SphereParam() else: self.param = param gbC_lay = QVBoxLayout() l_cmap = QLabel("Cmap ") self.cmap = list(get_colormaps().keys()) self.combo = QComboBox(self) self.combo.addItems(self.cmap) self.combo.currentIndexChanged.connect(self.updateParam) self.param.dict["colormap"] = self.cmap[0] hbox = QHBoxLayout() hbox.addWidget(l_cmap) hbox.addWidget(self.combo) gbC_lay.addLayout(hbox) self.sp = [] # subdiv lL = QLabel("subdiv") self.sp.append(QSpinBox()) self.sp[-1].setMinimum(0) self.sp[-1].setMaximum(6) self.sp[-1].setValue(self.param.dict["subdiv"]) # Layout hbox = QHBoxLayout() hbox.addWidget(lL) hbox.addWidget(self.sp[-1]) gbC_lay.addLayout(hbox) # signal's self.sp[-1].valueChanged.connect(self.updateParam) # Banded self.gbBand = QGroupBox(u"Banded") self.gbBand.setCheckable(True) hbox = QGridLayout() lL = QLabel("nbr band", self.gbBand) self.sp.append(QSpinBox(self.gbBand)) self.sp[-1].setMinimum(0) self.sp[-1].setMaximum(100) # Layout hbox = QHBoxLayout() hbox.addWidget(lL) hbox.addWidget(self.sp[-1]) self.gbBand.setLayout(hbox) gbC_lay.addWidget(self.gbBand) # signal's self.sp[-1].valueChanged.connect(self.updateParam) self.gbBand.toggled.connect(self.updateParam) gbC_lay.addStretch(1.0) hbox = QHBoxLayout() hbox.addLayout(gbC_lay) self.setLayout(hbox) self.updateMenu()
def createMemberSelectionPanel(self): frame = QFrame() #frame.setMinimumHeight(100) #frame.setMaximumHeight(100) #frame.setFrameShape(QFrame.StyledPanel) #frame.setFrameShadow(QFrame.Plain) layout = QVBoxLayout() self.selected_member_label = QtGui.QLabel() self.selected_member_label.setWordWrap(True) layout.addWidget(QtGui.QLabel("Selected members:")) layout.addWidget(self.selected_member_label) layout.addStretch(1) self.clear_button = QtGui.QPushButton() self.clear_button.setText("Clear selection") layout.addWidget(self.clear_button) self.connect(self.clear_button, QtCore.SIGNAL('clicked()'), self.plotView.clearSelection) layout.addStretch(1) frame.setLayout(layout) return frame
def __init__( self, parent = None ): super(XQueryBuilderWidget, self).__init__( parent ) # load the user interface projexui.loadUi(__file__, self) self.setMinimumWidth(470) # define custom properties self._rules = {} self._defaultQuery = [] self._completionTerms = [] self._minimumCount = 1 # set default properties self._container = QWidget(self) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(2) layout.addStretch(1) self._container.setLayout(layout) self.uiQueryAREA.setWidget(self._container) # create connections self.uiResetBTN.clicked.connect( self.emitResetRequested ) self.uiSaveBTN.clicked.connect( self.emitSaveRequested ) self.uiCancelBTN.clicked.connect( self.emitCancelRequested ) self.resetRequested.connect( self.reset )
def __init__(self, parent=None): super(CreditCard, self).__init__(parent) fileLabel = QLabel("Excel files:") self.fileList = FileList(self) self.connect(self.fileList, QtCore.SIGNAL("dropped"), self.fileDrop) self.cashdepo = QPushButton("&Cash Depo") self.cashdepo.show() self.crediCard = QPushButton("C&redit Card") self.crediCard.show() self.cashdepo.clicked.connect(self.getCashDepo) self.crediCard.clicked.connect(self.getCreditCard) buttonLayout1 = QVBoxLayout() buttonLayout1.addWidget(self.cashdepo, QtCore.Qt.AlignTop) buttonLayout1.addWidget(self.crediCard) buttonLayout1.addStretch() mainLayout = QGridLayout() mainLayout.addWidget(fileLabel, 0, 0) mainLayout.addWidget(self.fileList, 1, 0) mainLayout.addLayout(buttonLayout1, 1, 1) self.setLayout(mainLayout) self.setWindowTitle("Credit Card & Cash Depo XL")
def __init__(self, template, character, parent=None): super(FlawWidget, self).__init__(parent) self.__storage = template self.__character = character self.__layout = QVBoxLayout() self.setLayout( self.__layout ) self.__toolBox = QToolBox() ## Die Auflistung der Merits soll auch unter Windows einen transparenten Hintergrund haben. self.__toolBox.setObjectName("transparentWidget") ## \todo Sollte nicht vom Betriebssystem, sondern vom verwendeten Style abhängen. if os.name == "nt": self.__toolBox.setStyleSheet( "QScrollArea{ background: transparent; } QWidget#transparentWidget { background: transparent; }" ) self.__layout.addWidget(self.__toolBox) self.__typ = "Flaw" categories = [] categories.extend(Config.CATEGORIES_FLAWS) categories.extend(self.__storage.categories(self.__typ)) # Duplikate werden entfernt. Dadurch wird die in der Config-Klasse vorgegebene Reihenfolge eingehalten und zusätzliche, dort nicht erwähnte Kategorien werden hinterher angehängt. categories = ListTools.uniqify_ordered(categories) # Diese Liste speichert den Index der ToolBox-Seite bei den unterschiedlichen Kategorien self.__categoryIndex = {} # Flaws werden in einer Spalte heruntergeschrieben, aber mit vertikalem Platz dazwischen. for item in categories: # Für jede Kategorie wird ein eigener Abschnitt erzeugt. widgetFlawCategory = QWidget() ## Dank des Namens übernimmt dieses Widget den Stil des Eltern-Widgets. widgetFlawCategory.setObjectName("transparentWidget") layoutFlawCategory = QVBoxLayout() widgetFlawCategory.setLayout( layoutFlawCategory ) self.__toolBox.addItem( widgetFlawCategory, item ) self.__categoryIndex[item] = self.__toolBox.count() - 1 #Debug.debug(self.__categoryIndex) __list = list( self.__character.traits[self.__typ][item].items() ) __list.sort() for flaw in __list: # Anlegen des Widgets, das diese Eigenschaft repräsentiert. traitWidget = CheckTrait( flaw[1], self ) if not flaw[1].custom: traitWidget.setDescriptionHidden(True) layoutFlawCategory.addWidget( traitWidget ) flaw[1].valueChanged.connect(self.countItems) self.__character.speciesChanged.connect(traitWidget.hideOrShowTrait) # Stretch einfügen, damit die Eigenschaften besser angeordnet sind. layoutFlawCategory.addStretch() self.setMinimumWidth(Config.TRAIT_WIDTH_MIN)
def multi_mpk_dialog(self, xpub_hot, n): vbox = QVBoxLayout() scroll = QScrollArea() scroll.setEnabled(True) scroll.setWidgetResizable(True) vbox.addWidget(scroll) w = QWidget() scroll.setWidget(w) innerVbox = QVBoxLayout() w.setLayout(innerVbox) vbox0 = seed_dialog.show_seed_box(MSG_SHOW_MPK, xpub_hot, 'hot') innerVbox.addLayout(vbox0) entries = [] for i in range(n): msg = _("Please enter the master public key of cosigner") + ' %d' % (i + 1) vbox2, seed_e2 = seed_dialog.enter_seed_box(msg, self, 'cold') innerVbox.addLayout(vbox2) entries.append(seed_e2) vbox.addStretch(1) button = OkButton(self, _('Next')) vbox.addLayout(Buttons(CancelButton(self), button)) button.setEnabled(False) f = lambda: button.setEnabled( map(lambda e: Wallet.is_xpub( self.get_seed_text(e)), entries) == [True] * len(entries)) for e in entries: e.textChanged.connect(f) self.set_layout(vbox) if not self.exec_(): return return map(lambda e: self.get_seed_text(e), entries)
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 multi_seed_dialog(self, n): vbox = QVBoxLayout() scroll = QScrollArea() scroll.setEnabled(True) scroll.setWidgetResizable(True) vbox.addWidget(scroll) w = QWidget() scroll.setWidget(w) innerVbox = QVBoxLayout() w.setLayout(innerVbox) vbox1, seed_e1 = seed_dialog.enter_seed_box(MSG_ENTER_SEED_OR_MPK, self, 'hot') innerVbox.addLayout(vbox1) entries = [seed_e1] for i in range(n): vbox2, seed_e2 = seed_dialog.enter_seed_box(MSG_ENTER_SEED_OR_MPK, self, 'cold') innerVbox.addLayout(vbox2) entries.append(seed_e2) vbox.addStretch(1) button = OkButton(self, _('Next')) vbox.addLayout(Buttons(CancelButton(self), button)) button.setEnabled(False) f = lambda: button.setEnabled( map(lambda e: self.is_any( self.get_seed_text(e)), entries) == [True] * len(entries)) for e in entries: e.textChanged.connect(f) self.set_layout(vbox) if not self.exec_(): return return map(lambda e: self.get_seed_text(e), entries)
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 choice(self, title, msg, choices): vbox = QVBoxLayout() self.set_layout(vbox) vbox.addWidget(QLabel(title)) gb2 = QGroupBox(msg) vbox.addWidget(gb2) vbox2 = QVBoxLayout() gb2.setLayout(vbox2) group2 = QButtonGroup() for i, c in enumerate(choices): button = QRadioButton(gb2) button.setText(c[1]) vbox2.addWidget(button) group2.addButton(button) group2.setId(button, i) if i == 0: button.setChecked(True) vbox.addStretch(1) vbox.addLayout(Buttons(CancelButton(self), OkButton(self, _('Next')))) if not self.exec_(): return wallet_type = choices[group2.checkedId()][0] return wallet_type
def build_form(self, parameters): """Build a form from impact functions parameter. .. note:: see http://tinyurl.com/pyqt-differences :param parameters: Parameters to be edited """ scroll_layout = QVBoxLayout() scroll_widget = QWidget() scroll_widget.setLayout(scroll_layout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(scroll_widget) self.configLayout.addWidget(scroll) for key, value in parameters.items(): if key == 'postprocessors': self.build_post_processor_form(value) elif key == 'minimum needs': self.build_minimum_needs_form(value) else: self.build_widget(scroll_layout, key, value) if scroll_layout.count() == 0: # Rizky: in case empty impact function, let's show some messages label = QLabel() message = tr('This impact function does not have any options to ' 'configure') label.setText(message) scroll_layout.addWidget(label) scroll_layout.addStretch()
def __init__(self, help_center_name, parent=None): QMainWindow.__init__(self, parent, Qt.WindowStaysOnTopHint) palette = self.palette() palette.setColor(self.backgroundRole(), QColor(255, 255, 224)) self.setPalette(palette) self.setAutoFillBackground(True) self.setMinimumWidth(300) self.setMinimumHeight(250) self.setWindowTitle("Help") self.setObjectName("ert-gui-help") central_widget = QWidget() layout = QVBoxLayout() central_widget.setLayout(layout) self.link_widget = QLabel() self.link_widget.setStyleSheet("font-weight: bold") self.link_widget.setMinimumHeight(20) self.help_widget = QLabel(HelpWindow.default_help_string) self.help_widget.setWordWrap(True) self.help_widget.setTextFormat(Qt.RichText) self.help_widget.linkActivated.connect(self.openHelpURL) layout.addWidget(self.link_widget) layout.addWidget(self.help_widget) layout.addStretch(1) HelpCenter.getHelpCenter(help_center_name).addListener(self) self.__position = None self.__geometry = None self.setCentralWidget(central_widget)
def __init__(self, content, max_widgets, parent=None, **kwargs): """ Initialise layout of the widget. Arguments: content - Content for the widget max_widgets - Maximum widgets per column parent - Parent widget (default None) Returns: None """ super(SettingsContainer, self).__init__(parent) # Layout layout_v_global = QVBoxLayout(self) layout_v_global.setContentsMargins(0, 0, 0, 0) self.layout = QHBoxLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.layout_v = None self.idx = 0 self.max_widgets = max_widgets # Global content self.content = {} self.group = {} # Add to v global layout layout_v_global.addLayout(self.layout, stretch=0) layout_v_global.addStretch(1) # Add to layout for entry in content: for widget in entry: for key in widget: if self.idx % self.max_widgets == 0: if self.layout_v is not None: self.layout.addWidget( Separator(typ='vertical', color='lightgrey')) self.layout_v.addStretch(1) self.layout_v = QVBoxLayout() self.layout_v.setContentsMargins(0, 0, 0, 0) self.layout.addLayout(self.layout_v) name = widget[key][1]['name'] group = widget[key][1]['group'] widget = SettingsWidget(content=widget[key], parent=self) if group: group, state = group.split(':') self.group.setdefault(group, []) self.group[group].append([widget, state, name]) self.content[name] = widget self.layout_v.addWidget(widget) self.idx += 1 for key in self.group: self.content[key].sig_index_changed.connect(self.change_state) self.change_state(name=key) self.layout_v.addStretch(1) self.layout.addStretch(1)
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,broker,parent = None ): super(BrokerWidget,self).__init__(parent) self.broker = broker self.dataTable = TableView() self.dataTable.setModel(self.broker.dataModel) self.dataTable.horizontalHeader().setResizeMode(QHeaderView.Stretch) #self.dataTable.resizeColumnsToContents() dataLabel = QLabel('Price Data') dataLabel.setBuddy(self.dataTable) dataLayout = QVBoxLayout() dataLayout.addWidget(dataLabel) dataLayout.addWidget(self.dataTable) addButton = QPushButton("&Add Symbol") saveDataButton = QPushButton("&Save Data") #deleteButton = QPushButton("&Delete") buttonLayout = QVBoxLayout() buttonLayout.addWidget(addButton) buttonLayout.addWidget(saveDataButton) buttonLayout.addStretch() layout = QHBoxLayout() layout.addLayout(dataLayout) layout.addLayout(buttonLayout) self.setLayout(layout) self.connect(addButton,SIGNAL('clicked()'),self.addSubscription) self.connect(saveDataButton,SIGNAL('clicked()'),self.saveData)
def addWidgets(self): layout = QVBoxLayout() self.setLayout(layout) layout.addSpacing(10) label = QLabel(self) label.setTextFormat(Qt.RichText) label.setText('<p>There are currently no vaults.</p>' '<p>To store passwords in Bluepass, ' 'you need to create a vault first.</p>') label.setWordWrap(True) layout.addWidget(label) layout.addSpacing(10) hbox = QHBoxLayout() layout.addLayout(hbox) newbtn = QPushButton('Create New Vault', self) newbtn.clicked.connect(self.newVault) hbox.addStretch(100); hbox.addWidget(newbtn) hbox.addStretch(100) hbox = QHBoxLayout() layout.addLayout(hbox) connectbtn = QPushButton('Connect to Existing Vault', self) connectbtn.clicked.connect(self.connectVault) hbox.addStretch(100) hbox.addWidget(connectbtn) hbox.addStretch(100) width = max(newbtn.sizeHint().width(), connectbtn.sizeHint().width()) + 40 newbtn.setFixedWidth(width) connectbtn.setFixedWidth(width) layout.addStretch(100)
def __init__(self): QWidget.__init__(self) self.__filter_popup = FilterPopup(self) self.__filter_popup.filterSettingsChanged.connect(self.onItemChanged) layout = QVBoxLayout() self.model = DataTypeKeysListModel() self.filter_model = DataTypeProxyModel(self.model) filter_layout = QHBoxLayout() self.search_box = SearchBox() self.search_box.filterChanged.connect(self.setSearchString) filter_layout.addWidget(self.search_box) filter_popup_button = QToolButton() filter_popup_button.setIcon(util.resourceIcon("ide/cog_edit.png")) filter_popup_button.clicked.connect(self.showFilterPopup) filter_layout.addWidget(filter_popup_button) layout.addLayout(filter_layout) self.data_type_keys_widget = QListView() self.data_type_keys_widget.setModel(self.filter_model) self.data_type_keys_widget.selectionModel().selectionChanged.connect(self.itemSelected) layout.addSpacing(15) layout.addWidget(self.data_type_keys_widget, 2) layout.addStretch() # layout.addWidget(Legend("Default types", DataTypeKeysListModel.DEFAULT_DATA_TYPE)) layout.addWidget(Legend("Observations available", DataTypeKeysListModel.HAS_OBSERVATIONS)) self.setLayout(layout)
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 build_minimum_needs_form(self, parameters): """Build minimum needs tab. :param parameters: A list containing element of form :type parameters: list """ # create minimum needs tab scroll_layout = QVBoxLayout() scroll_widget = QWidget() scroll_widget.setLayout(scroll_layout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(scroll_widget) main_layout = QVBoxLayout() main_layout.addWidget(scroll) tab = QWidget() tab.setLayout(main_layout) extra_parameters = [(ResourceParameter, ResourceParameterWidget)] parameter_container = ParameterContainer(parameters, extra_parameters) scroll_layout.addWidget(parameter_container) self.tabWidget.addTab(tab, self.tr('Minimum Needs')) self.tabWidget.tabBar().setVisible(True) self.values['minimum needs'] = parameter_container.get_parameters scroll_layout.addStretch()
def __init__(self, *args): PluginBase.__init__(self, BrickletSoundIntensity, *args) self.si = self.device self.cbe_intensity = CallbackEmulator(self.si.get_intensity, self.cb_intensity, self.increase_error_count) self.intensity_label = IntensityLabel() self.current_value = None self.thermo = TuningThermo() #plot_list = [['', Qt.red, self.get_current_value]] #self.plot_widget = PlotWidget('Intensity Value', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.intensity_label) layout_h.addStretch() layout_h2 = QHBoxLayout() layout_h2.addStretch() layout_h2.addWidget(self.thermo) layout_h2.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addLayout(layout_h2) layout.addStretch()
def __init__(self, *args): PluginBase.__init__(self, BrickletSoundIntensity, *args) self.si = self.device self.cbe_intensity = CallbackEmulator(self.si.get_intensity, self.cb_intensity, self.increase_error_count) self.intensity_label = IntensityLabel() self.current_value = None self.thermo = TuningThermo() #plot_list = [['', Qt.red, self.get_current_value]] #self.plot_widget = PlotWidget('Intensity Value', plot_list) layout_h = QHBoxLayout() layout_h.addStretch() layout_h.addWidget(self.intensity_label) layout_h.addStretch() layout_h2 = QHBoxLayout() layout_h2.addStretch() layout_h2.addWidget(self.thermo) layout_h2.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h) layout.addLayout(layout_h2) layout.addStretch()
def add_to_layout(layout, *items): """Add items to QVBox and QHBox layouts easily. Keyword arguments: layout -- a layout oject (QVBoxLayout or QHBoxLayout) or a string if "v" or "h" create a QVBox or QHBox respectively *items -- list with items to be added """ if isinstance(layout, str): if layout == "v": layout = QVBoxLayout() elif layout == "h": layout = QHBoxLayout() else: raise TypeError("Invalid layout!") for item in items: if isinstance(item, QWidget): layout.addWidget(item) elif isinstance(item, QLayout): layout.addLayout(item) elif isinstance(item, QSpacerItem): layout.addItem(item) elif item is None: layout.addStretch() else: raise TypeError("Argument of wrong type!") return layout
def __init__(self, title, widget, 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!!! layout.addWidget(widget) self.__button_layout = QHBoxLayout() self.close_button = QPushButton("Close") self.close_button.setObjectName("CLOSE") self.close_button.clicked.connect(self.accept) self.__button_layout.addStretch() self.__button_layout.addWidget(self.close_button) layout.addStretch() layout.addLayout(self.__button_layout) 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, title, widget, 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!!! layout.addWidget(widget) self.__button_layout = QHBoxLayout() self.close_button = QPushButton("Close") self.close_button.setObjectName("CLOSE") self.close_button.clicked.connect(self.accept) self.__button_layout.addStretch() self.__button_layout.addWidget(self.close_button) layout.addStretch() layout.addLayout(self.__button_layout) self.setLayout(layout)
def __init__( self, parent ): QScrollArea.__init__( self, parent ) self.setFrameShape( QScrollArea.NoFrame ) self.setAutoFillBackground( False ) self.setWidgetResizable( True ) self.setMouseTracking(True) self.verticalScrollBar().setMaximumWidth(10) from PyQt4.QtGui import QWidget widget = QWidget( self ) # define custom properties self._rolloutStyle = AccordianWidget.Rounded self._dragDropMode = AccordianWidget.NoDragDrop self._scrolling = False self._scrollInitY = 0 self._scrollInitVal = 0 self._itemClass = AccordianItem # create the layout from PyQt4.QtGui import QVBoxLayout layout = QVBoxLayout() layout.setContentsMargins( 3, 3, 3, 3 ) layout.setSpacing( 3 ) layout.addStretch(1) widget.setLayout( layout ) self.setWidget( widget )
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(990, 720) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.ui = QtGui.QLabel(self.centralwidget) self.ui.setGeometry(QtCore.QRect(20, 20, 988, 174)) pixmap = QPixmap('./banner_nuevo_2016.png') self.ui.setPixmap(pixmap) ################################################## self.webView = QtWebKit.QWebView(self.centralwidget) self.webView.setGeometry(QtCore.QRect(20, 250, 950, 421)) self.webView.load(QtCore.QUrl("recorrido.html")) self.webView.setObjectName(_fromUtf8("webView")) MainWindow.setCentralWidget(self.centralwidget) MainWindow.setWindowTitle( _translate("Form", "Posición: Histórico", None)) self.la = QVBoxLayout() self.la.addStretch() self.la.addWidget(self.ui) self.la.addWidget(self.webView) self.centralwidget.setLayout(self.la) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, crypto): QDialog.__init__(self) # Set the title and icon self.setWindowTitle("Verify Key Integrity") self.setWindowIcon(QIcon("images/placeholder.png")) helpLabel = QLabel("In order to ensure that no one is listening in on your conversation it's\n" "best to verify the following information with your friend over a secure\n" "line of communication, like a telephone. It's okay if someone sees or\n" "hears this info; it just matters if what they see here matches what\n" "you see. If not, someone could be listening to your communcations!") localLabel = QLabel("You read to them:") localFingerprintLabel = QLabel(crypto.getLocalFingerprint()) remoteLabel = QLabel("They read to you:") remoteFingerprintLabel = QLabel(crypto.getRemoteFingerprint()) vbox = QVBoxLayout() vbox.addStretch(1) vbox.addWidget(helpLabel) vbox.addSpacing(15) vbox.addWidget(QLine()) vbox.addSpacing(15) vbox.addWidget(localLabel) vbox.addWidget(localFingerprintLabel, alignment=Qt.AlignHCenter) vbox.addSpacing(45) vbox.addWidget(remoteLabel) vbox.addWidget(remoteFingerprintLabel, alignment=Qt.AlignHCenter) vbox.addStretch(1) self.setLayout(vbox)
def build_form(self, parameters): """Build a form from impact functions parameter. .. note:: see http://tinyurl.com/pyqt-differences :param parameters: Parameters to be edited """ scroll_layout = QVBoxLayout() scroll_widget = QWidget() scroll_widget.setLayout(scroll_layout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(scroll_widget) self.configLayout.addWidget(scroll) for key, value in parameters.items(): if key == 'postprocessors': self.build_post_processor_form(value) elif key == 'minimum needs': self.build_minimum_needs_form(value) else: self.build_widget(scroll_layout, key, value) if scroll_layout.count() == 0: # Rizky: in case empty impact function, let's show some messages label = QLabel() message = tr('This impact function does not have any options to ' 'configure') label.setText(message) scroll_layout.addWidget(label) scroll_layout.addStretch()
def create_layout(self): grid = QGridLayout() grid.addWidget(self.pid, 0, 0) grid.addWidget(self.pid_edit, 0, 1) grid.addWidget(self.pid_button, 0, 2) grid.addWidget(self.elements, 1, 0) grid.addWidget(self.elements_edit, 1, 1) grid.addWidget(self.elements_button, 1, 2) grid.addWidget(self.theta, 2, 0) grid.addWidget(self.theta_edit, 2, 1) grid.addWidget(self.theta_button, 2, 2) ok_cancel_box = QHBoxLayout() ok_cancel_box.addWidget(self.apply_button) ok_cancel_box.addWidget(self.ok_button) ok_cancel_box.addWidget(self.cancel_button) vbox = QVBoxLayout() vbox.addLayout(grid) vbox.addStretch() vbox.addLayout(ok_cancel_box) self.setLayout(vbox)
def __init__(self): QDockWidget.__init__(self, "Help") self.setObjectName("HelpDock") widget = QWidget() widget.setStyleSheet("background-color: #ffffe0") layout = QVBoxLayout() widget.setLayout(layout) self.link_widget = QLabel() self.link_widget.setStyleSheet("font-weight: bold") self.link_widget.setMinimumHeight(20) self.help_widget = QLabel(HelpDock.default_help_string) self.help_widget.setWordWrap(True) self.help_widget.setTextFormat(Qt.RichText) self.validation_widget = QLabel("") self.validation_widget.setWordWrap(True) self.validation_widget.setScaledContents(True) self.validation_widget.setAlignment(Qt.AlignHCenter) self.validation_widget.setTextFormat(Qt.RichText) layout.addWidget(self.link_widget) layout.addWidget(self.help_widget) layout.addStretch(1) layout.addWidget(self.validation_widget) self.setWidget(widget) self.help_messages = {} MessageCenter().addHelpMessageListeners(self)
def _set_layout(self): """ Set layout of this widget """ layout = QVBoxLayout() layout.addStretch() self.setLayout(layout)