def setupUI(self): # self.bttnAddEmployee.setMinimumSize(100, 30) # self.bttnCancel.setMinimumSize(100, 30) # self.id.setMaximumWidth(800) # self.name.setMaximumWidth(800) # self.designation.setMaximumWidth(800) # self.originalPay.setMaximumWidth(800) # self.originalPayGrade.setMaximumWidth(800) # self.DOJ.setMaximumWidth(800) # self.pan.setMaximumWidth(800) layout = QVBoxLayout() layout.setContentsMargins(20, 20, 20, 10) form = QFormLayout() form.setSpacing(20) form.addRow(QLabel("ID No."), self.id) form.addRow(QLabel("Name"), self.name) form.addRow(QLabel("Designation"), self.designation) form.addRow(QLabel("Original Pay"), self.originalPay) form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade) form.addRow(QLabel("Date of joining"), self.DOJ) form.addRow(QLabel("Pan No."), self.pan) layout.addLayout(form) layout.addStretch() bttnLayout = QHBoxLayout() bttnLayout.addStretch() bttnLayout.addWidget(self.bttnCancel) bttnLayout.addWidget(self.bttnAddEmployee) layout.addLayout(bttnLayout) self.setLayout(layout)
def setupUI(self): """Arranges GUI elements inside the widget properly""" layout = QVBoxLayout() layout.setContentsMargins(20, 20, 20, 10) form = QFormLayout() form.setSpacing(20) form.addRow(QLabel("Deignation"), self.designation) form.addRow(QLabel("Dearness Allowance"), self.da) form.addRow(QLabel("House Rent Allowance"), self.hra) form.addRow(QLabel("Transport Allowance"), self.ta) form.addRow(QLabel("Income Tax"), self.it) form.addRow(QLabel("Professional Tax"), self.pt) layout.addLayout(form) layout.addStretch() bttnLayout = QHBoxLayout() bttnLayout.addStretch() bttnLayout.addWidget(self.bttnCancel) bttnLayout.addWidget(self.bttnAddDesignation) layout.addLayout(bttnLayout) self.setLayout(layout)
def create_spinbox(self, prefix, suffix, option, default=NoDefault, 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 = QSpinBox() 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[option] = spinbox 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) return widget
def __init__(self, group_name, name_list, param_dict, help_instance = None, handler = None, help_dict = None): QGroupBox.__init__(self, group_name) the_layout = QVBoxLayout() the_layout.setSpacing(5) the_layout.setContentsMargins(1, 1, 1, 1) self.setLayout(the_layout) self.widget_dict = {} self.is_popup = False self.param_dict = param_dict for txt in name_list: qh = QHBoxLayout() cb = QCheckBox(txt) qh.addWidget(cb) cb.setFont(QFont('SansSerif', 12)) param_widgets = {} for key, val in param_dict.items(): if type(val) == list: # param_widgets[key] = qHotField(key, type(val[0]), val[0], value_list=val, pos="top") else: param_widgets[key] = qHotField(key, type(val), val, pos="top") qh.addWidget(param_widgets[key]) qh.addStretch() the_layout.addLayout(qh) if handler != None: cb.toggled.connect(handler) self.widget_dict[txt] = [cb, param_widgets] if (help_dict != None) and (help_instance != None): if txt in help_dict: help_button_widget = help_instance.create_button(txt, help_dict[txt]) qh.addWidget(help_button_widget) return
def __init__(self, parent=None): super(TreeContainer, self).__init__(parent) self._soln = None self.tree_loaded.connect(self._handleTreeLoaded) self._stacksize_compound = StackSizeCompound() self.combobox_compound = BoardComboCompound() self.dofp_compound = DoFPCompound() self.treeview_game = GameTreeView(self.combobox_compound.combobox_board) self.treeview_game.tree_updated.connect(self._handleTreeUpdated) self._stacksize_compound.spinbox_stacksize.setValue(500) self._stacksize_compound.spinbox_stacksize.valueChanged.connect(self._handleSpinboxChange) self.dofp_compound.button_execute.setEnabled(False) self.dofp_compound.button_execute.clicked.connect(self._executeFP) selection_model = self.treeview_game.selectionModel() selection_model.selectionChanged.connect(self._handleSelectionChanged) layout = QGridLayout() control_layout = QHBoxLayout() control_layout.addWidget(self._stacksize_compound) control_layout.addWidget(self.combobox_compound) control_layout.addWidget(self.dofp_compound) control_layout.addStretch() row = 0; col = 0; layout.addLayout(control_layout, row, col, 1, 2) row += 1; col = 0 layout.addWidget(self.treeview_game, row, col, 1, 2) self.setLayout(layout) self.setWindowTitle("Game Tree Viewer") self._setupContextMenu()
def __init__(self, parent=None): super(QtReducePreferencePane, self).__init__(parent) self.__createContents() self.toolBar = QtReducePreferencesToolBar(self) self.worksheet = QtReducePreferencesWorksheet(self) self.computation = QtReducePreferencesComputation(self) self.pagesWidget = QStackedWidget() self.pagesWidget.addWidget(self.toolBar) self.pagesWidget.addWidget(self.worksheet) self.pagesWidget.addWidget(self.computation) self.pagesWidget.setCurrentIndex( self.contentsWidget.row(self.contentsWidget.currentItem())) closeButton = QPushButton(self.tr("Close")) closeButton.clicked.connect(self.close) horizontalLayout = QHBoxLayout() horizontalLayout.addWidget(self.contentsWidget) horizontalLayout.addWidget(self.pagesWidget) buttonsLayout = QHBoxLayout() buttonsLayout.addStretch(1) buttonsLayout.addWidget(closeButton) mainLayout = QVBoxLayout() mainLayout.addLayout(horizontalLayout) mainLayout.addLayout(buttonsLayout) self.setLayout(mainLayout) self.setWindowTitle(self.tr("QReduce Preferences"))
def initUI(self): mainlay = QVBoxLayout() mainlay.addWidget(QLabel('<b>Deformers ({0})</b>'.format(len(self.mdl.deformers)))) def_list = QListWidget() for index, el in enumerate(self.mdl.deformers): def_list.addItem('{0} - {1}'.format(index, el)) #def_list.addItems(self.mdl.deformers) mainlay.addWidget(def_list) self.def_list = def_list btns = QHBoxLayout() btns.addStretch() save = QPushButton('Save') save.clicked.connect(self.save) close = QPushButton('Close') close.clicked.connect(self.close) btns.addWidget(save) btns.addWidget(close) mainlay.addLayout(btns) self.setLayout(mainlay) self.setGeometry(340, 340, 200, 400) self.setWindowTitle('MSH Suite - {0} Deformers'.format(self.mdl.name)) self.show()
def __init__(self): super(STM32FProgrammerDialog, self).__init__(CWMainGUI.getInstance()) # self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint) self.stm32f = STM32FProgrammer() self.setWindowTitle("Serial STM32F Programmer") layout = QVBoxLayout() layoutFW = QHBoxLayout() self.flashLocation = QtFixes.QLineEdit() flashFileButton = QPushButton("Find") flashFileButton.clicked.connect(self.findFlash) layoutFW.addWidget(QLabel("FLASH File")) layoutFW.addWidget(self.flashLocation) layoutFW.addWidget(flashFileButton) layout.addLayout(layoutFW) self.flashLocation.setText(QSettings().value("stm32f-flash-location")) # Add buttons readSigBut = QPushButton("Check Signature") readSigBut.clicked.connect(self.readSignature) verifyFlashBut = QPushButton("Verify FLASH") verifyFlashBut.clicked.connect(self.verifyFlash) verifyFlashBut.setEnabled(False) progFlashBut = QPushButton("Erase/Program/Verify FLASH") progFlashBut.clicked.connect(self.writeFlash) layoutBut = QHBoxLayout() layoutBut.addWidget(readSigBut) layoutBut.addWidget(verifyFlashBut) layoutBut.addWidget(progFlashBut) layout.addLayout(layoutBut) layoutsetting = QHBoxLayout() mode = QComboBox() mode.addItem("fast", False) mode.addItem("slow", True) mode.currentIndexChanged.connect(self.modechanged) layoutsetting.addWidget(QLabel("Speed:")) layoutsetting.addWidget(mode) blocksize = QComboBox() blocksize.addItem("256", False) blocksize.addItem("64", True) blocksize.currentIndexChanged.connect(self.blocksizechanged) layoutsetting.addStretch() layoutsetting.addWidget(QLabel("Read Block Size:")) layoutsetting.addWidget(blocksize) layout.addLayout(layoutsetting) # Add status stuff self.statusLine = QPlainTextEdit() self.statusLine.setReadOnly(True) # self.statusLine.setFixedHeight(QFontMetrics(self.statusLine.font()).lineSpacing() * 5 + 10) self.stm32f.newTextLog.connect(self.append) layout.addWidget(self.statusLine) # Set dialog layout self.setLayout(layout)
def __init__(self, widget): super(CenterH, self).__init__() layout = QHBoxLayout() self.setLayout(layout) layout.addStretch() layout.addWidget(widget) layout.addStretch()
def setupUI(self): layout = QVBoxLayout() layout.setContentsMargins(20, 20, 20, 10) selectGroup = QGroupBox("Select") form1 = QFormLayout() form1.addRow(QLabel("Name"), self.nameSearch) form1.addRow(QLabel("ID No."), self.id) selectGroup.setLayout(form1) editGroup = QGroupBox("Edit below") form = QFormLayout() form.setSpacing(20) form.addRow(QLabel("Name"), self.nameEdit) form.addRow(QLabel("Designation"), self.designation) form.addRow(QLabel("Original Pay"), self.originalPay) form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade) form.addRow(QLabel("Date of joining"), self.DOJ) form.addRow(QLabel("Pan No."), self.pan) editGroup.setLayout(form) layout.addWidget(selectGroup) layout.addWidget(editGroup) layout.addStretch() bttnLayout = QHBoxLayout() bttnLayout.addStretch() bttnLayout.addWidget(self.bttnCancel) bttnLayout.addWidget(self.bttnSave) layout.addLayout(bttnLayout) self.setLayout(layout)
def layoutWidgets(self): layout = QVBoxLayout() form = QFormLayout() form.addRow("C&reator", self.creatorLineEdit) form.addRow("&Initials", self.initialsLineEdit) layout.addLayout(form) form = QFormLayout() form.addRow("For This Index", self.thisLanguageComboBox) form.addRow("Default", self.defaultLanguageComboBox) self.languageGroupBox.setLayout(form) layout.addWidget(self.languageGroupBox) form = QFormLayout() form.addRow("&Highest Page Number", self.highestPageSpinBox) form.addRow("Largest &Page Range Span", self.largestPageRangeSpinBox) form.addRow("&Most Pages per Entry", self.mostPagesSpinBox) self.limitsGroupBox.setLayout(form) hbox = QHBoxLayout() hbox.addWidget(self.limitsGroupBox) hbox.addStretch() layout.addLayout(hbox) layout.addStretch() self.setLayout(layout)
def __init__(self,title,parent,right_layout=None): super(SubTitleWidget,self).__init__(parent) self.title = QLabel() self.title.setObjectName("subtitle") self.title.setScaledContents(True) self.set_title(title) hlayout = QHBoxLayout() hlayout.setAlignment(Qt.AlignTop) # hlayout.addWidget(TitleBox(self)) hlayout.addWidget(self.title) hlayout.addStretch() if right_layout: if isinstance(right_layout,QLayout): hlayout.addLayout(right_layout) else: hlayout.addWidget(right_layout) # hlayout.setStretch(1,1) top_layout = QVBoxLayout() top_layout.addLayout(hlayout) top_layout.addSpacing(10) top_layout.setContentsMargins(0,0,0,0) self.setLayout(top_layout) self.setContentsMargins(0,0,0,0)
def __init__(self, parent, change_tracker: ChangeTracker): super(CommentsWidget, self).__init__(parent) self._change_tracker = change_tracker #self.setObjectName("zwhite") layout = QVBoxLayout() self.comments_list_widget = QFrame( self ) # If you use QWidget, the background won't be set; don't know why :-( self.comments_list_widget.setStyleSheet("background: white;") self.comments_list_widget.setAutoFillBackground(True) #self.comments_list_widget.setObjectName("zwhite") self._comments_layout = QVBoxLayout() self.comments_list_widget.setLayout(self._comments_layout) self.comments_list_widget.hide() self.text_edit = QTextEdit(self) self.submit_button = QPushButton(("Add"), self) layout.addWidget(self.comments_list_widget) layout.addWidget(self.text_edit) hlayout = QHBoxLayout() hlayout.addStretch() hlayout.addWidget(self.submit_button) layout.addLayout(hlayout) self.setLayout(layout) self.submit_button.clicked.connect(self.submit_comment)
def __init__(self,parent): global dao super(CreateNewOrderDialog,self).__init__(parent) self.current_customer = None title = _("Create new order") self.setWindowTitle(title) top_layout = QVBoxLayout() self.title_widget = TitleWidget(title,self) top_layout.addWidget(self.title_widget) self.customer_plate_widget = CustomerPlateWidget(self) self.buttons = QDialogButtonBox() self.buttons.addButton( QDialogButtonBox.StandardButton.Cancel) self.buttons.addButton( QDialogButtonBox.Ok) hlayout = QHBoxLayout() self.customer_select = AutoCompleteComboBox(None, self, None) self.customer_select.section_width = None # [300] view = [] keys = [] ref = [] customers = dao.customer_dao.all() for c in customers: view.append([c.fullname]) keys.append(c.fullname) ref.append(c) session().close() # FIXME bad data layer / presentation layer separation here self.customer_select.make_model( view, keys, ref ) self.customer_plate_widget.set_customer(customers[0]) hlayout.addWidget(QLabel(_("Customer")), 0, Qt.AlignTop) hlayout.addWidget(self.customer_select, 0, Qt.AlignTop) hlayout.addWidget(self.customer_plate_widget, 1000, Qt.AlignTop) hlayout.addStretch() top_layout.addLayout(hlayout) # hlayout = QHBoxLayout() # self.order_select = AutoCompleteComboBox() # self.order_select.setEnabled(False) # self.order_select.section_width = [100,300] # hlayout.addWidget(QLabel(_("Clone order"))) # self.enable_clone = QCheckBox() # hlayout.addWidget(self.enable_clone) # hlayout.addWidget(self.order_select) # hlayout.addStretch() # top_layout.addLayout(hlayout) top_layout.addStretch() top_layout.addWidget(self.buttons) self.setLayout(top_layout) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) # self.customer_select.activated.connect(self.customer_selected) self.customer_select.list_view.itemSelected.connect(self.customer_selected)
def layoutWidgets(self): layout = QVBoxLayout() hbox = QHBoxLayout() hbox.addWidget(self.filenameLabelLabel) hbox.addWidget(self.filenameLabel, 1) hbox.addWidget(self.filenameButton) layout.addLayout(hbox) grid = QGridLayout() grid.addWidget(self.configCheckBox, 0, 0) grid.addWidget(self.autoReplaceCheckBox, 0, 1) grid.addWidget(self.spellWordsCheckBox, 1, 0) grid.addWidget(self.ignoredFirstWordsCheckBox, 1, 1) grid.addWidget(self.groupsCheckBox, 2, 0) grid.addWidget(self.customMarkupCheckBox, 2, 1) hbox = QHBoxLayout() hbox.addLayout(grid) hbox.addStretch() self.copyGroupBox.setLayout(hbox) layout.addWidget(self.copyGroupBox) layout.addStretch() buttonBox = QDialogButtonBox() buttonBox.addButton(self.newCopyButton, QDialogButtonBox.AcceptRole) buttonBox.addButton(self.cancelButton, QDialogButtonBox.RejectRole) buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole) layout.addWidget(buttonBox) self.setLayout(layout)
def _init_widgets(self): # current function function_label = QLabel() self._function_label = function_label # options button option_btn = QPushButton() option_btn.setText('Options') option_btn.setMenu(self._options_menu.qmenu()) # Save image button saveimage_btn = QPushButton() saveimage_btn.setText('Save image to...') saveimage_btn.clicked.connect(self._on_saveimage_btn_clicked) layout = QHBoxLayout() layout.setContentsMargins(2, 2, 2, 2) layout.addWidget(function_label) layout.addStretch(0) layout.addWidget(saveimage_btn) layout.addWidget(option_btn) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout)
def __init__(self, group_name, name_list, param_type = int, default_param = None, help_instance = None, handler = None, help_dict = None): QGroupBox.__init__(self, group_name) the_layout = QVBoxLayout() the_layout.setSpacing(5) the_layout.setContentsMargins(1, 1, 1, 1) self.setLayout(the_layout) self.widget_dict = OrderedDict([]) self.mytype= param_type self.is_popup = False if default_param == None: default_param = "" self.default_param = default_param for txt in name_list: qh = QHBoxLayout() cb = QCheckBox(txt) cb.setFont(QFont('SansSerif', 12)) efield = QLineEdit(str(default_param)) efield.setFont(QFont('SansSerif', 10)) efield.setMaximumWidth(25) qh.addWidget(cb) qh.addStretch() qh.addWidget(efield) the_layout.addLayout(qh) if handler != None: cb.toggled.connect(handler) self.widget_dict[txt] = [cb, efield] if (help_dict != None) and (help_instance != None): if txt in help_dict: help_button_widget = help_instance.create_button(txt, help_dict[txt]) qh.addWidget(help_button_widget) return
def layoutWidgets(self): layout = QVBoxLayout() entryLayout = QHBoxLayout() entryLayout.setSpacing(0) entryLayout.addWidget(self.entryLabel) entryLayout.addWidget(self.termLabel) entryLayout.addStretch() layout.addLayout(entryLayout) eidLayout = QVBoxLayout() eidLayout.addWidget(self.moveToTopRadioButton) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.grandParentRadioButton) hbox.addWidget(self.grandParentLabel, 1) eidLayout.addLayout(hbox) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.filteredRadioButton) hbox.addWidget(self.filteredLabel, 1) eidLayout.addLayout(hbox) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.circledRadioButton) hbox.addWidget(self.circledLabel, 1) eidLayout.addLayout(hbox) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.recentRadioButton) hbox.addWidget(self.recentComboBox, 1) eidLayout.addLayout(hbox) eidLayout.addStretch() self.eidGroup.setLayout(eidLayout) layout.addWidget(self.eidGroup) layout.addWidget(self.buttonBox) self.setLayout(layout)
def __init__(self, parameter, parent=None): _ParameterWidget.__init__(self, parameter, parent) # Variables model = _LayerModel() self._material_class = Material # Actions act_add = QAction(getIcon("list-add"), "Add layer", self) act_remove = QAction(getIcon("list-remove"), "Remove layer", self) act_clean = QAction(getIcon('edit-clear'), "Clear", self) # Widgets self._cb_unit = UnitComboBox('m') self._cb_unit.setUnit('um') self._tbl_layers = QTableView() self._tbl_layers.setModel(model) self._tbl_layers.setItemDelegate(_LayerDelegate()) header = self._tbl_layers.horizontalHeader() header.setResizeMode(QHeaderView.Stretch) header.setStyleSheet('color: blue') self._tlb_layers = QToolBar() spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self._tlb_layers.addWidget(spacer) self._tlb_layers.addAction(act_add) self._tlb_layers.addAction(act_remove) self._tlb_layers.addAction(act_clean) # Layouts layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) sublayout = QHBoxLayout() sublayout.addStretch() sublayout.addWidget(QLabel('Thickness unit')) sublayout.addWidget(self._cb_unit) layout.addLayout(sublayout) layout.addWidget(self._tbl_layers) layout.addWidget(self._tlb_layers) self.setLayout(layout) # Signals self.valuesChanged.connect(self._onChanged) self.validationRequested.connect(self._onChanged) act_add.triggered.connect(self._onAdd) act_remove.triggered.connect(self._onRemove) act_clean.triggered.connect(self._onClear) self._tbl_layers.doubleClicked.connect(self._onDoubleClicked) model.dataChanged.connect(self.valuesChanged) model.rowsInserted.connect(self.valuesChanged) model.rowsRemoved.connect(self.valuesChanged) self.validationRequested.emit()
def _layout_indicators(self, indicators): subframes = [] ind_vlayout = QVBoxLayout() for line in indicators: hboxlayout = QHBoxLayout() hboxlayout.addStretch() hboxlayout.setAlignment(Qt.AlignTop) for ind in line[1:]: if type(ind) == list: deeper_layout, deeper_subframes = self._layout_indicators( ind) subframes += deeper_subframes hboxlayout.addLayout(deeper_layout) else: hboxlayout.addWidget(ind) hboxlayout.addStretch() s = SubFrame(line[0], hboxlayout, self) subframes.append(s) ind_vlayout.addWidget(s) return ind_vlayout, subframes
def _footer(self): hbox2 = QHBoxLayout() self.layout.addLayout(hbox2) cancelbut = QtGui.QPushButton("Close") cancelbut.released.connect(self.close) hbox2.addStretch(1) hbox2.addWidget(cancelbut)
def _footer(self): hbox2 = QHBoxLayout() self.layout.addLayout(hbox2) cancelbut = QtGui.QPushButton("Close") cancelbut.released.connect(self.close) hbox2.addStretch(1) hbox2.addWidget(cancelbut)
def setupUI(self): self._bttn.setMaximumWidth(20) layout = QHBoxLayout() layout.addWidget(self._dateEdit) layout.addWidget(self._bttn) layout.addStretch() self.setLayout(layout)
def settings(self): if self.settings_window is None: window = QDialog(self) self.settings_window = window else: window = self.settings_window window = self.settings_window window.setWindowTitle('Settings') window.notelabel = QLabel("Currently these settings are only guaranteed to work prior to loading the first MIDI!\nYou'll have to restart ADLMIDI pyGui to change them again if they stop working. \n\nSorry! This will be fixed soon!") window.notelabel.setWordWrap(True) window.notelabel.setStyleSheet("font-size: 8pt; border-style: dotted; border-width: 1px; padding: 12px;") window.banklabel = QLabel("<B>Choose Instrument Bank</B>") window.space = QLabel("") window.optlabel = QLabel("<B>Options</B>") window.combo = QComboBox() window.combo.addItems(self.banks) #window.combo.setMaximumWidth(350) window.combo.setMaxVisibleItems(12) window.combo.setStyleSheet("combobox-popup: 0;") window.combo.setCurrentIndex(int(self.progset.value("sound/bank", 1))) window.combo.currentIndexChanged.connect(self.saveSettings) window.perc = QCheckBox("Adlib Percussion Instrument Mode") #window.perc.stateChanged.connect(self.checkOpts) window.tremamp = QCheckBox("Tremolo Amplification Mode") #window.tremamp.stateChanged.connect(self.checkOpts) window.vibamp = QCheckBox("Vibrato Amplification Mode") #window.vibamp.stateChanged.connect(self.checkOpts) window.modscale = QCheckBox("Scaling of Modulator Volume") #window.modscale.stateChanged.connect(self.checkOpts) window.okButton = QPushButton('OK') window.okButton.clicked.connect(window.hide) vbox = QVBoxLayout() vbox.addWidget(window.space) vbox.addWidget(window.banklabel) vbox.addWidget(window.combo) vbox.addWidget(window.space) vbox.addWidget(window.optlabel) vbox.addWidget(window.perc) vbox.addWidget(window.tremamp) vbox.addWidget(window.vibamp) vbox.addWidget(window.modscale) vbox.addWidget(window.notelabel) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(window.okButton) vbox.addLayout(hbox) window.setLayout(vbox) window.setFixedSize(530, 369) window.show() window.activateWindow() window.raise_()
def _createLayout(self): 'Create the Widget Layout' self._txtLogbook = QLineEdit() self._txtLogbook.setReadOnly(True) self._lblLogbook = QLabel(self.tr('&Logbook File:')) self._lblLogbook.setBuddy(self._txtLogbook) self._btnBrowse = QPushButton('...') self._btnBrowse.clicked.connect(self._btnBrowseClicked) self._btnBrowse.setStyleSheet('QPushButton { min-width: 24px; max-width: 24px; }') self._btnBrowse.setToolTip(self.tr('Browse for a Logbook')) self._cbxComputer = QComboBox() self._lblComputer = QLabel(self.tr('Dive &Computer:')) self._lblComputer.setBuddy(self._cbxComputer) self._btnAddComputer = QPushButton(QPixmap(':/icons/list-add.png'), self.tr('')) self._btnAddComputer.setStyleSheet('QPushButton { min-width: 24px; min-height: 24; max-width: 24px; max-height: 24; }') self._btnAddComputer.clicked.connect(self._btnAddComputerClicked) self._btnRemoveComputer = QPushButton(QPixmap(':/icons/list-remove.png'), self.tr('')) self._btnRemoveComputer.setStyleSheet('QPushButton { min-width: 24px; min-height: 24; max-width: 24px; max-height: 24; }') self._btnRemoveComputer.clicked.connect(self._btnRemoveComputerClicked) hbox = QHBoxLayout() hbox.addWidget(self._btnAddComputer) hbox.addWidget(self._btnRemoveComputer) gbox = QGridLayout() gbox.addWidget(self._lblLogbook, 0, 0) gbox.addWidget(self._txtLogbook, 0, 1) gbox.addWidget(self._btnBrowse, 0, 2) gbox.addWidget(self._lblComputer, 1, 0) gbox.addWidget(self._cbxComputer, 1, 1) gbox.addLayout(hbox, 1, 2) gbox.setColumnStretch(1, 1) self._pbTransfer = QProgressBar() self._pbTransfer.reset() self._txtStatus = QTextEdit() self._txtStatus.setReadOnly(True) self._btnTransfer = QPushButton(self.tr('&Transfer Dives')) self._btnTransfer.clicked.connect(self._btnTransferClicked) self._btnExit = QPushButton(self.tr('E&xit')) self._btnExit.clicked.connect(self.close) hbox = QHBoxLayout() hbox.addWidget(self._btnTransfer) hbox.addStretch() hbox.addWidget(self._btnExit) vbox = QVBoxLayout() vbox.addLayout(gbox) vbox.addWidget(self._pbTransfer) vbox.addWidget(self._txtStatus) vbox.addLayout(hbox) self.setLayout(vbox)
def layoutWidgets(self): layout = QVBoxLayout() layout.addWidget(self.browser, 1) hbox = QHBoxLayout() hbox.addStretch() hbox.addWidget(self.closeButton) hbox.addStretch() layout.addLayout(hbox) self.setLayout(layout)
def __init__(self): generic.GenericGui.__init__(self) window = QWidget() window.setWindowTitle('quichem-pyside') self.compiler_view = QListWidget() self.compiler_view.currentRowChanged.connect(self.show_source) self.stacked_widget = QStackedWidget() self.stacked_widget.setFrameStyle(QFrame.StyledPanel | QFrame.Raised) self.edit = QLineEdit() self.edit.setPlaceholderText('Type quichem input...') self.edit.textChanged.connect(self.change_value) self.view = QWebView() self.view.page().mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff) self.view.page().action(QWebPage.Reload).setVisible(False) self.view.setMaximumHeight(0) self.view.setUrl('qrc:/web/page.html') self.view.setZoomFactor(2) self.view.page().mainFrame().contentsSizeChanged.connect( self._resize_view) # For debugging JS: ## from PySide.QtWebKit import QWebSettings ## QWebSettings.globalSettings().setAttribute( ## QWebSettings.DeveloperExtrasEnabled, True) button_image = QPushButton('Copy as Image') button_image.clicked.connect(self.set_clipboard_image) button_image.setToolTip('Then paste into any graphics program') button_word = QPushButton('Copy as MS Word Equation') button_word.clicked.connect(self.set_clipboard_word) button_html = QPushButton('Copy as Formatted Text') button_html.clicked.connect(self.set_clipboard_html) line = QFrame() line.setFrameShape(QFrame.HLine) line.setFrameShadow(QFrame.Sunken) button_layout = QHBoxLayout() button_layout.addStretch() button_layout.addWidget(button_image) button_layout.addWidget(button_word) button_layout.addWidget(button_html) source_layout = QHBoxLayout() source_layout.addWidget(self.compiler_view) source_layout.addWidget(self.stacked_widget, 1) QVBoxLayout(window) window.layout().addWidget(self.edit) window.layout().addWidget(self.view) window.layout().addLayout(button_layout) window.layout().addWidget(line) window.layout().addLayout(source_layout, 1) window.show() window.resize(window.minimumWidth(), window.height()) # To prevent garbage collection of internal Qt object. self._window = window
def layoutWidgets(self): layout = QVBoxLayout() hbox = QHBoxLayout() hbox.addWidget(self.label) hbox.addStretch() hbox.addWidget(self.closeButton) hbox.addWidget(self.helpButton) layout.addLayout(hbox) layout.addWidget(self.spellList) self.setLayout(layout)
def _make_top_row(self): row = QHBoxLayout() row.addStretch() self._remove_button = self._make_remove_btn() row.addWidget(self._remove_button) self._addr_label = self._make_addr_label() row.addWidget(self._addr_label) self._hex_value_label = self._make_hex_value_label() row.addWidget(self._hex_value_label) return row
def _init_ui(self, txt): self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) pal = QPalette() color = QColor() color.setNamedColor(self._window_bgcolor) color.setAlpha(255 * self._opacity) pal.setColor(QPalette.Background, color) self.setAutoFillBackground(True) self.setPalette(pal) wm, hm = 5, 5 spacing = 8 layout = QVBoxLayout() layout.setSpacing(spacing) layout.setContentsMargins(wm, hm, wm, hm) nlines, ts = self._generate_text(txt) qlabel = QLabel('\n'.join(ts)) ss = 'QLabel {{color: {}; font-family:{}, sans-serif; font-size: {}px}}'.format(self._color, self._font, self._fontsize) qlabel.setStyleSheet(ss) layout.addWidget(qlabel) hlabel = QLabel('double click to dismiss') hlabel.setStyleSheet('QLabel {font-size: 10px}') hlayout = QHBoxLayout() hlayout.addStretch() hlayout.addWidget(hlabel) hlayout.addStretch() layout.addLayout(hlayout) self.setLayout(layout) font = QFont(self._font, self._fontsize) fm = QFontMetrics(font) pw = max([fm.width(ti) for ti in ts]) ph = (fm.height() + 2) * nlines w = pw + wm * 2 h = ph + (hm + spacing + 1) * 2 self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setFixedWidth(w) self.setFixedHeight(h) self.setMask(mask(self.rect(), 10))
def setupUI(self): layout = QVBoxLayout() layout.setContentsMargins(20, 20, 20, 10) datelayout = QHBoxLayout() datelayout.addWidget(QLabel("Salary for month of ")) datelayout.addWidget(self.month) datelayout.addWidget(self.year) datelayout.addStretch() layout.addLayout(datelayout) form = QFormLayout() form.setSpacing(10) form.addRow(QLabel("Name"), self.name) form.addRow(QLabel("ID No."), self.id) form.addRow(QLabel("Designation"), self.designation) form.addRow(QLabel("Original Pay"), self.originalPay) form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade) form.addRow(QLabel("Date of joining"), self.DOJ) form.addRow(QLabel("Pan No."), self.pan) infoGroup = QGroupBox("Basic Info") infoGroup.setLayout(form) layout.addWidget(infoGroup) leftForm = QFormLayout() leftForm.addRow(QLabel("Dearness Allowance"), self.da_percent) leftForm.addRow(QLabel("Housing Rent Allowance"), self.hra_percent) leftForm.addRow(QLabel("Transport Allowance"), self.ta_percent) leftGroup = QGroupBox("Allowances") leftGroup.setLayout(leftForm) rightForm = QFormLayout() rightForm.addRow(QLabel("Income Tax"), self.it_percent) rightForm.addRow(QLabel("Profession Tax"), self.pt_percent) rightGroup = QGroupBox("Deductions") rightGroup.setLayout(rightForm) table = QHBoxLayout() table.addWidget(leftGroup) table.addWidget(rightGroup) layout.addLayout(table) layout.addStretch() bttnLayout = QHBoxLayout() bttnLayout.addStretch() bttnLayout.addWidget(self.bttnCancel) bttnLayout.addWidget(self.bttnCalculate) layout.addLayout(bttnLayout) self.setLayout(layout)
def __init__(self, playersOut, playersIn, parent=None): super(confirmSubsDialog, self).__init__(parent) self.now = QDateTime.currentDateTime() self.now.setTime( QTime(self.now.time().hour(), self.now.time().minute())) self.setWindowTitle("Confirm Subs") mainVerticalLayout = QVBoxLayout(self) subsLayout = QGridLayout() mainVerticalLayout.addLayout(subsLayout) subsLayout.addWidget(QLabel("<b>Players Out</b>"), 0, 0) subsLayout.addWidget(QLabel("<b>Players In</b>"), 0, 1) for i, (playerOut, playerIn) in enumerate(zip(playersOut, playersIn)): playerOutLabel = QLabel() playerOutLabel.setText("<font color=red>{0}</font>".format( playerOut.name)) subsLayout.addWidget(playerOutLabel, i + 1, 0) playerInLabel = QLabel() playerInLabel.setText("<font color=green>{0}</font>".format( playerIn.name)) subsLayout.addWidget(playerInLabel, i + 1, 1) mainVerticalLayout.addItem( QSpacerItem(0, 15, QSizePolicy.Minimum, QSizePolicy.Expanding)) dateTimeLayout = QHBoxLayout() mainVerticalLayout.addLayout(dateTimeLayout) dateTimeLayout.addWidget(QLabel("Date and time")) self.dateTimeEdit = QDateTimeEdit(self.now) self.dateTimeEdit.setMaximumDateTime(self.now) self.dateTimeEdit.setCalendarPopup(True) self.dateTimeEdit.setDisplayFormat("d MMM yy h:mm AP") dateTimeLayout.addWidget(self.dateTimeEdit) dateTimeLayout.addStretch() mainVerticalLayout.addItem( QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding)) buttonBox = QDialogButtonBox(self) buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) buttonBox.button(QDialogButtonBox.Ok).setText("&Accept") mainVerticalLayout.addWidget(buttonBox) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def buildDataDisplays(self): hbox = QHBoxLayout() hbox.addStretch(1) for widget in self.buildLeftDataDisplays(): hbox.addWidget(widget) hbox.addStretch(1) hbox.addLayout(self.buildRightDataDisplays()) return hbox
def buildDataDisplays(self): hbox = QHBoxLayout() hbox.addStretch(1) for widget in self.buildLeftDataDisplays(): hbox.addWidget(widget) hbox.addStretch(1) hbox.addLayout(self.buildRightDataDisplays()) return hbox
def __init__(self, parent=None): super(OverlayContainer, self).__init__(parent) overlay_layout = QHBoxLayout() self._right_overlay = ControlOverlay() self._right_overlay.clicked.connect(self.right_clicked) self._left_overlay = ControlOverlay(controlDirection=ControlOverlay.LEFT) self._left_overlay.clicked.connect(self.left_clicked) overlay_layout.addWidget(self._left_overlay) overlay_layout.addStretch() overlay_layout.setContentsMargins(0,0,0,0) overlay_layout.addWidget(self._right_overlay) self.setLayout(overlay_layout)
def __init__(self): QWidget.__init__(self) self.__view_page_select = ViewPageSelectMag() self.__view_widget_select = ViewWidgetSelect() self.__widget_data = dict() # 主 layout _layout = QGridLayout() self.setLayout(_layout) # 控件类型 _type_label = QLabel(u"对象类型") self.__type_select = OrcSelect("operate_object_type") # 控件信息输入 _widget_label = QLabel(u"控件") self.__widget_input = OrcLineEdit() self.__widget_input.setReadOnly(True) # 操作信息输入 layout _operate_label = QLabel(u"操作") self.__operate_select = SelectWidgetOperation() # 按钮 _button_submit = QPushButton(u"确定") _button_cancel = QPushButton(u"取消") # 按钮 layout _layout_button = QHBoxLayout() _layout_button.addStretch() _layout_button.addWidget(_button_submit) _layout_button.addWidget(_button_cancel) _layout.addWidget(_type_label, 0, 0) _layout.addWidget(self.__type_select, 0, 1) _layout.addWidget(_widget_label, 1, 0) _layout.addWidget(self.__widget_input, 1, 1) _layout.addWidget(_operate_label, 2, 0) _layout.addWidget(self.__operate_select, 2, 1) _layout.addLayout(_layout_button, 3, 1) self.__change_type("PAGE") # connection _button_cancel.clicked.connect(self.close) _button_submit.clicked.connect(self.__submit) self.__widget_input.clicked.connect(self.__show_select) self.__view_widget_select.sig_selected[dict].connect(self.__set_widget) self.__view_page_select.sig_selected[dict].connect(self.__set_widget) self.__type_select.currentIndexChanged.connect(self.__change_type)
def layoutWidgets(self): layout = QVBoxLayout() hbox = QHBoxLayout() hbox.addWidget(self.indexLabel) hbox.addSpacing(self.fontMetrics().width("W") * 4) hbox.addStretch() hbox.addWidget(self.gotoLabel) hbox.addWidget(self.gotoLineEdit, 1) hbox.addWidget(self.helpButton) layout.addLayout(hbox) layout.addWidget(self.view, 1) self.setLayout(layout)
class PluginDialog(QWidget): def __init__(self, pluginManager): super(PluginDialog, self).__init__() self.view = PluginView(pluginManager, self) self.vbLayout = QVBoxLayout(self) self.vbLayout.setContentsMargins(0, 0, 0, 0) self.vbLayout.setSpacing(0) self.vbLayout.addWidget(self.view) self.hbLayout = QHBoxLayout() self.vbLayout.addLayout(self.hbLayout) self.hbLayout.setContentsMargins(0, 0, 0, 0) self.hbLayout.setSpacing(6) self.detailsButton = QPushButton("Details", self) self.errorDetailsButton = QPushButton("Error Details", self) self.detailsButton.setEnabled(False) self.errorDetailsButton.setEnabled(False) self.hbLayout.addWidget(self.detailsButton) self.hbLayout.addWidget(self.errorDetailsButton) self.hbLayout.addStretch(5) self.resize(650, 300) self.setWindowTitle("Installed Plugins") self.view.currentPluginChanged.connect(self.updateButtons) self.view.pluginActivated.connect(self.openDetails) self.detailsButton.clicked.connect(self.openDetails) self.errorDetailsButton.clicked.connect(self.openErrorDetails) @Slot() def updateButtons(self): # todo pass @Slot() def openDetails(self): # todo pass @Slot() def openDetails(self, spec): # todo print("TODO open details") pass @Slot() def openErrorDetails(self): # todo pass
def __init__(self, my_parent, max_size = 200): QWidget.__init__(self) myframe = QHBoxLayout() self.setLayout(myframe) self.popup = QComboBox() self.popup.setSizeAdjustPolicy(QComboBox.AdjustToContents) myframe.addWidget(self.popup) myframe.addStretch() self.my_parent = my_parent self.popup.addItems(self.my_parent._lcvsa_dict.keys()) self.popup.setFont(QFont('SansSerif', 12)) self.popup.currentIndexChanged.connect(self.when_modified) self.when_modified()
class MainWindow(QDialog): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.h0 = QHBoxLayout() self.lineArray = [] labelArray = [u'時間', u'值班', u'救護勤務', u'備勤', u'待命服勤', u'水源查察', u'消防查察', u'宣導勤務', u'訓(演)練', u'專案勤務', u'南山救護站'] for i in labelArray: label = QLabel(i) label.setFixedWidth(100) label.setAlignment(Qt.AlignCenter) self.h0.addWidget(label) self.h0.addSpacing(15) self.v0 = QVBoxLayout() self.v0.addLayout(self.h0) for i in xrange(24): hn = QHBoxLayout() for j in xrange(len(labelArray)): if j == 0: time = i+8 if (i+8)< 24 else i+8-24 line = QLabel("%s:00~%s:00" % (str(time).zfill(2), str(time+1).zfill(2))) else: line = QLineEdit() self.lineArray.append(line) line.setFixedWidth(100) hn.addSpacing(15) hn.addWidget(line) self.v0.addLayout(hn) self.h1 = QHBoxLayout() self.clearPB = QPushButton("Clear All") self.clearPB.setFixedWidth(200) self.clearPB.setFixedHeight(50) self.clearPB.clicked.connect(self.clear) self.h1.addStretch() self.h1.addWidget(self.clearPB) self.h1.addStretch() self.v0.addLayout(self.h1) self.setLayout(self.v0) def clear(self): for each in self.lineArray: each.setText('')
def setupUI(self): paneLayout = QHBoxLayout() paneLayout.setContentsMargins(0, 0, 0, 0) leftPane = QFrame() leftPane.setObjectName("leftPane") leftPaneLayout = QVBoxLayout() leftPaneLayout.setContentsMargins(20, 20, 20, 10) heading = QLabel("Select Employee: ") heading.setObjectName("heading") leftPaneLayout.addWidget(heading) leftPaneLayout.addSpacing(10) form1 = QFormLayout() form1.addRow(QLabel("Name"), self.nameSearch) form1.addRow(QLabel("ID No."), self.id) leftPaneLayout.addLayout(form1) leftPaneLayout.addStretch() leftPane.setLayout(leftPaneLayout) layout = QVBoxLayout() layout.setContentsMargins(20, 20, 20, 10) editGroup = QGroupBox("Edit below") form = QFormLayout() form.setContentsMargins(10, 10, 10, 30) form.setSpacing(20) form.addRow(QLabel("Name"), self.nameEdit) form.addRow(QLabel("Designation"), self.designation) form.addRow(QLabel("Original Pay"), self.originalPay) form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade) form.addRow(QLabel("Date of joining"), self.DOJ) form.addRow(QLabel("Pan No."), self.pan) editGroup.setLayout(form) layout.addWidget(editGroup) layout.addStretch() bttnLayout = QHBoxLayout() bttnLayout.addStretch() bttnLayout.addWidget(self.bttnCancel) bttnLayout.addWidget(self.bttnSave) layout.addLayout(bttnLayout) paneLayout.addWidget(leftPane) paneLayout.addLayout(layout) self.setLayout(paneLayout)
def initUI(self): '''Lays out the widgets''' total = QHBoxLayout() total.addWidget(QLabel("Wavenum: ")) total.addWidget(self.wavenum) total.addWidget(QLabel("Intens.: ")) total.addWidget(self.intense) total.addWidget(QLabel("Lower Limit")) total.addWidget(self.xmin) total.addStretch() total.addWidget(self.reverse) total.addStretch() total.addWidget(QLabel("Upper Limit")) total.addWidget(self.xmax) self.setLayout(total)
def create_check_boxes(self, name_list): for txt in name_list: qh = QHBoxLayout() cb = QCheckBox(txt) cb.setFont(regular_small_font) qh.addWidget(cb) qh.addStretch() self.the_layout.addLayout(qh) if self.handler != None: cb.toggled.connect(self.handler) self.widget_dict[txt] = cb if (self.help_dict != None) and (self.help_instance != None): if txt in self.help_dict: help_button_widget = self.help_instance.create_button(txt, self.help_dict[txt]) qh.addWidget(help_button_widget)
def initUI(self): '''Lays out the widgets''' radios = QVBoxLayout() radios.addWidget(self.rate) radios.addWidget(self.lifetime) rate = QGridLayout() rate.addWidget(QLabel("Unit: "), 1, 1) rate.addWidget(self.unit, 1, 2) rate.addWidget(QLabel("Value: "), 2, 1) rate.addWidget(self.rate_value, 2, 2) total = QHBoxLayout() total.addLayout(radios) total.addStretch() total.addLayout(rate) self.setLayout(total)
def __init__(self, options, parent=None): QWidget.__init__(self, parent) # Variables self._options = options # Widgets self._lbl_title = QLabel("Untitled") font = self._lbl_title.font() font.setBold(True) font.setPointSize(14) self._lbl_title.setFont(font) self._lbl_subtitle = QLabel("") font = self._lbl_subtitle.font() font.setItalic(True) font.setPointSize(14) self._lbl_subtitle.setFont(font) # Layouts layout = QVBoxLayout() sublayout = QHBoxLayout() sublayout.addWidget(self._lbl_title) sublayout.addStretch() sublayout.addWidget(self._lbl_subtitle) layout.addLayout(sublayout) wdglayout = QVBoxLayout() wdglayout.addLayout(self._initUI(), 1) wdglayout.addWidget(self._initToolbar()) toolbox = self._initToolbox() if toolbox.count() == 0: layout.addLayout(wdglayout) else: wdg_dummy = QWidget() wdg_dummy.setLayout(wdglayout) splitter = QSplitter() splitter.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) splitter.addWidget(wdg_dummy) splitter.addWidget(toolbox) splitter.setCollapsible(0, False) splitter.setCollapsible(1, True) layout.addWidget(splitter) self.setLayout(layout)
def _initialize_view(self): presenter = self._presenter self.widget = window = QWidget() window.setWindowTitle(LEMMA) self._layout = window_layout = QStackedLayout() window.setLayout(window_layout) self._main_menu = main_menu = QWidget(window) window_layout.addWidget(main_menu) main_menu_v_layout = QHBoxLayout() main_menu.setLayout(main_menu_v_layout) main_menu_v_layout.addStretch(20) main_menu_v_layout.addWidget(QLabel(LEMMA)) main_menu_layout = QVBoxLayout() main_menu_v_layout.addLayout(main_menu_layout) main_menu_v_layout.addStretch(20) main_menu_layout.addStretch() self._main_menu_buttons = buttons = {} buttons[MainWindowView.CONTINUE_GAME] = continue_game = QPushButton( 'Continue game') main_menu_layout.addWidget(continue_game) continue_game.clicked.connect(presenter.continue_game_clicked) buttons[MainWindowView.NEW_GAME] = new_game = QPushButton('New game') main_menu_layout.addWidget(new_game) new_game.clicked.connect(presenter.new_game_clicked) buttons[MainWindowView.LOAD_GAME] = load_game = QPushButton( 'Load game') main_menu_layout.addWidget(load_game) load_game.clicked.connect(presenter.load_game_clicked) buttons[MainWindowView.SAVE_GAME] = save_game = QPushButton( 'Save Game') main_menu_layout.addWidget(save_game) save_game.clicked.connect(presenter.save_game_clicked) buttons[MainWindowView.QUIT] = quit_button = QPushButton('Quit') main_menu_layout.addWidget(quit_button) quit_button.clicked.connect(presenter.quit_clicked) main_menu_layout.addStretch()
def create(self): self.widget = self._createWidget() if hasattr(self, "customize") and callable(self.customize): self.customize(self.widget) if self.converter.suffix(None): self.container = QWidget(self.parent) self.suffix = QLabel("", self.parent) hbox = QHBoxLayout(self.container) hbox.addWidget(self.widget) hbox.addWidget(self.suffix) hbox.addStretch(1) hbox.setContentsMargins(QMargins(0, 0, 0, 0)) if self.converter.label(None) and self.hasLabel: self.label = QLabel(self.parent) self.label.setBuddy(self.widget) return self.widget
def __init__(self, playersOut, playersIn, parent=None): super(confirmSubsDialog, self).__init__(parent) self.now = QDateTime.currentDateTime() self.now.setTime(QTime(self.now.time().hour(), self.now.time().minute())) self.setWindowTitle("Confirm Subs") mainVerticalLayout = QVBoxLayout(self) subsLayout = QGridLayout() mainVerticalLayout.addLayout(subsLayout) subsLayout.addWidget(QLabel("<b>Players Out</b>"), 0, 0) subsLayout.addWidget(QLabel("<b>Players In</b>"), 0, 1) for i, (playerOut, playerIn) in enumerate(zip(playersOut, playersIn)): playerOutLabel = QLabel() playerOutLabel.setText("<font color=red>{0}</font>".format(playerOut.name)) subsLayout.addWidget(playerOutLabel, i+1, 0) playerInLabel = QLabel() playerInLabel.setText("<font color=green>{0}</font>".format(playerIn.name)) subsLayout.addWidget(playerInLabel, i+1, 1) mainVerticalLayout.addItem(QSpacerItem(0, 15, QSizePolicy.Minimum, QSizePolicy.Expanding)) dateTimeLayout = QHBoxLayout() mainVerticalLayout.addLayout(dateTimeLayout) dateTimeLayout.addWidget(QLabel("Date and time")) self.dateTimeEdit = QDateTimeEdit(self.now) self.dateTimeEdit.setMaximumDateTime(self.now) self.dateTimeEdit.setCalendarPopup(True) self.dateTimeEdit.setDisplayFormat("d MMM yy h:mm AP") dateTimeLayout.addWidget(self.dateTimeEdit) dateTimeLayout.addStretch() mainVerticalLayout.addItem(QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding)) buttonBox = QDialogButtonBox(self) buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok) buttonBox.button(QDialogButtonBox.Ok).setText("&Accept") mainVerticalLayout.addWidget(buttonBox) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def __init__(self, parent=None): super(EditPreferencesDlg, self).__init__(parent) self.setWindowTitle("Preferences") # define widgets pref_list = QListWidget() pref_list.addItem("General") pref_list.addItem("Display") pref_list.setMaximumWidth(150) pref_list.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel) general_page = QWidget() general_layout = QGridLayout() general_layout.setAlignment(Qt.AlignTop) general_layout.addWidget(QLabel("<b>General</b>"), 0, 0) general_page.setLayout(general_layout) display_page = QWidget() display_layout = QGridLayout() display_layout.setAlignment(Qt.AlignTop) display_layout.addWidget(QLabel("<b>Display Options</b>"), 0, 0) self.multitabs_checkbox = QCheckBox("Limit the display of tabs to one relief device (and the device's scenarios) at a time") if parent.limit_tabs is True: self.multitabs_checkbox.setChecked(True) display_layout.addWidget(self.multitabs_checkbox, 1, 0) display_page.setLayout(display_layout) stacked_widget = QStackedWidget() for page in general_page, display_page: stacked_widget.addWidget(page) main_layout = QVBoxLayout() widgets_layout = QHBoxLayout() widgets_layout.addWidget(pref_list) widgets_layout.addWidget(stacked_widget) buttons_layout = QHBoxLayout() buttons_layout.addStretch() buttons_layout.addWidget(button_box) main_layout.addLayout(widgets_layout) main_layout.addLayout(buttons_layout) self.setLayout(main_layout) pref_list.currentRowChanged.connect(stacked_widget.setCurrentIndex) button_box.accepted.connect(self.accept) button_box.rejected.connect(self.reject)
def layoutWidgets(self): layout = QVBoxLayout() hbox = QHBoxLayout() hbox.addStretch() hbox.addWidget(self.closeButton) hbox.addStretch() layout.addWidget(self.browser) layout.addLayout(hbox) widget = QWidget() widget.setLayout(layout) self.setCentralWidget(widget) if self.loadSaveSize: settings = QSettings() self.resize( QSize( settings.value(Gopt.Key.CheckForm_Size, Gopt.Default.CheckForm_Size)))
def layoutWidgets(self): buttonBox = QDialogButtonBox() buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole) buttonBox.addButton(self.addButton, QDialogButtonBox.ActionRole) buttonBox.addButton(self.deleteButton, QDialogButtonBox.ActionRole) buttonBox.addButton(self.closeButton, QDialogButtonBox.AcceptRole) hbox = QHBoxLayout() hbox.addWidget(self.extensionLabel) hbox.addWidget(self.extensionComboBox) hbox.addStretch() hbox.addWidget(buttonBox) vbox = QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(self.tabWidget, 1) self.setLayout(vbox)
def _layoutWidgets(self): """ Setup layout of internal widgets """ mainLayout = QVBoxLayout() timerLayout = QHBoxLayout() timerLayout.addStretch() timerLayout.addWidget(self.__timeLeft) timerLayout.addStretch() mainLayout.addLayout(timerLayout) buttonLayout = QHBoxLayout() buttonLayout.addWidget(ActionButton(self.__startWorkActivity, self)) buttonLayout.addWidget(ActionButton(self.__stopActivity, self)) buttonLayout.addWidget(ActionButton(self.__startShortBreakActivity, self)) buttonLayout.addWidget(ActionButton(self.__startLongBreakActivity, self)) mainLayout.addLayout(buttonLayout) self.setLayout(mainLayout)
def layoutWidgets(self): layout = QVBoxLayout() whichLayout = QHBoxLayout() whichLayout.addWidget(self.seeRadioButton) whichLayout.addWidget(self.alsoRadioButton) whichLayout.addStretch() self.whichGroup.setLayout(whichLayout) layout.addWidget(self.whichGroup) entryLayout = QHBoxLayout() entryLayout.setSpacing(0) entryLayout.addWidget(self.entry1Label) entryLayout.addWidget(self.termLabel) entryLayout.addWidget(self.entry2Label) entryLayout.addStretch() layout.addLayout(entryLayout) eidLayout = QVBoxLayout() hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.filteredRadioButton) hbox.addWidget(self.filteredLabel, 1) eidLayout.addLayout(hbox) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.circledRadioButton) hbox.addWidget(self.circledLabel, 1) eidLayout.addLayout(hbox) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.recentRadioButton) hbox.addWidget(self.recentComboBox, 1) eidLayout.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.groupRadioButton) hbox.addWidget(self.groupComboBox, 1) eidLayout.addLayout(hbox) grid = QGridLayout() grid.addWidget(self.formatPanel, 0, 0, 1, 2, Qt.AlignRight) grid.addWidget(self.genericTermRadioButton, 1, 0) grid.addWidget(self.genericTermLineEdit, 1, 1) eidLayout.addLayout(grid) eidLayout.addStretch() self.eidGroup.setLayout(eidLayout) layout.addWidget(self.eidGroup) layout.addWidget(self.buttonBox) self.setLayout(layout)
def layoutWidgets(self): layout = QVBoxLayout() entryLayout = QHBoxLayout() entryLayout.setSpacing(0) entryLayout.addWidget(self.entryLabel) entryLayout.addWidget(self.termLabel) entryLayout.addStretch() layout.addLayout(entryLayout) eidLayout = QVBoxLayout() eidLayout.addWidget(self.copyToTopRadioButton) eidLayout.addWidget(self.subentryRadioButton) eidLayout.addWidget(self.siblingRadioButton) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.filteredRadioButton) hbox.addWidget(self.filteredLabel, 1) eidLayout.addLayout(hbox) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.circledRadioButton) hbox.addWidget(self.circledLabel, 1) eidLayout.addLayout(hbox) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.recentRadioButton) hbox.addWidget(self.recentComboBox, 1) eidLayout.addLayout(hbox) eidLayout.addStretch() self.eidGroup.setLayout(eidLayout) layout.addWidget(self.eidGroup) vbox = QVBoxLayout() hbox = QHBoxLayout() hbox.addWidget(self.copyAllCheckBox) hbox.addWidget(self.copyXrefsCheckBox) hbox.addWidget(self.copyGroupsCheckBox) hbox.addWidget(self.copySubentriesCheckBox) hbox.addStretch() vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.linkPagesCheckBox) hbox.addWidget(self.linkLabel) hbox.addStretch() vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.setSpacing(0) hbox.addWidget(self.withSeeCheckBox) hbox.addWidget(self.withSeeLabel1) hbox.addStretch() vbox.addLayout(hbox) vbox.addWidget(self.withSeeLabel2) self.optionsGroup.setLayout(vbox) layout.addWidget(self.optionsGroup) layout.addWidget(self.buttonBox) self.setLayout(layout)
def __init__(self, current_tab_text=None, parent=None): """ Constructor """ super(DialogOtpWriteRange, self).__init__(parent) ok_button = QPushButton("&OK") cancel_button = QPushButton("Cancel") button_layout = QHBoxLayout() button_layout.addStretch() button_layout.addWidget(ok_button) button_layout.addWidget(cancel_button) layout = QGridLayout() current_row = 0 label_start = QLabel("starting address :") self.hsb_start = HexSpinBox() self.hsb_start.setMinimum(0x00) self.hsb_start.setMaximum(0x7F) self.hsb_start.setValue(0x00) layout.addWidget(label_start, current_row, 0) layout.addWidget(self.hsb_start, current_row, 1, 1, 1) current_row += 1 label_finish = QLabel("ending address :") self.hsb_finish = HexSpinBox() self.hsb_finish.setMinimum(0x00) self.hsb_finish.setMaximum(0x7F) self.hsb_finish.setValue(0x7F) layout.addWidget(label_finish, current_row, 0) layout.addWidget(self.hsb_finish, current_row, 1, 1, 1) # current_row += 1 # label_bank = QLabel("otp bank :") # self.spin_box_bank_sel = QSpinBox() # self.spin_box_bank_sel.setMinimum(0) # self.spin_box_bank_sel.setMaximum(1) # layout.addWidget(label_bank, current_row, 0) # layout.addWidget(self.spin_box_bank_sel, current_row, 1, 1, 1) current_row += 1 layout.addLayout(button_layout, current_row, 0, 1, 2) self.setLayout(layout) self.connect(ok_button, SIGNAL("clicked()"), self, SLOT("accept()")) self.connect(cancel_button, SIGNAL("clicked()"), self, SLOT("reject()")) self.setWindowTitle("set OTP write range / bank")
class TextDialog(QDialog): NAME = "TextDialog" TEXT_DIALOG_OK = "TEXT_DIALOG_OK" TEXT_DIALOG_CANCEL = "TEXT_DIALOG_CANCEL" def __init__(self, *args, **kwargs): super(TextDialog, self).__init__(*args, **kwargs) self.edit_line = QLineEdit() self.ok_btn = QPushButton("&Ok") # noinspection PyUnresolvedReferences self.ok_btn.clicked.connect(self.accept) self.ok_btn.setDefault(True) self.cancel_btn = QPushButton("&Cancel") # noinspection PyUnresolvedReferences self.cancel_btn.clicked.connect(self.reject) self.h_layout = QHBoxLayout() self.v_layout = QVBoxLayout() self.h_layout.addStretch(0) self.h_layout.addWidget(self.ok_btn) self.h_layout.addWidget(self.cancel_btn) self.v_layout.addWidget(self.edit_line) self.v_layout.addLayout(self.h_layout) self.setLayout(self.v_layout) # noinspection PyUnresolvedReferences self.accepted.connect(self.on_accept) # noinspection PyUnresolvedReferences self.rejected.connect(self.on_reject) def on_accept(self): Facade.getInstance().sendNotification( TextDialog.TEXT_DIALOG_OK, {"text": self.edit_line.text()}, ) def on_reject(self): Facade.getInstance().sendNotification( TextDialog.TEXT_DIALOG_CANCEL, )
def init_msh_ui(self): comps = QGroupBox('Components') mdlgr = QGroupBox('Models - {0}'.format(self.mdlmanager.count())) mdllay = QVBoxLayout() mdllay.addWidget(self.mdlmanager.get_frame()) #mdllay.addStretch() mdlgr.setLayout(mdllay) matgr = QGroupBox('Materials - {0}'.format(self.matmanager.count())) matlay = QVBoxLayout() matlay.addWidget(self.matmanager.get_frame()) #matlay.addStretch() matgr.setLayout(matlay) frame2lay = QHBoxLayout() frame2lay.addWidget(matgr) frame2lay.addWidget(mdlgr) comps.setLayout(frame2lay) # Misc stuff. self.setGeometry(200, 100, WIDTH_MSH, HEIGHT_MSH) frame = QFrame() framelay = QVBoxLayout() framelay.addWidget(self.infomanager.get_frame()) framelay.addWidget(comps) #framelay.addStretch() load = QPushButton('Open') load.clicked.connect(self.load_msh) save = QPushButton('Save') save.clicked.connect(self.save) close = QPushButton('Close') close.clicked.connect(self.close) btnlay = QHBoxLayout() btnlay.addWidget(QLabel('<b>MSH Suite</b> Version {0}'.format(SUITE_VER))) btnlay.addStretch() btnlay.addWidget(load) btnlay.addWidget(save) btnlay.addWidget(close) framelay.addLayout(btnlay) frame.setLayout(framelay) self.setCentralWidget(frame) self.setWindowTitle('MSH Suite - {0}'.format(self.msh.info.name))