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 _make_tabs_button(self, side_widgets, side_icons): if len(side_widgets) != len(side_icons): raise Exception( "Bad parameters : len(side_widgets) ({}) != len(side_icons) ({})" .format(len(side_widgets), len(side_icons))) layout = QVBoxLayout() self._side_icons = [] ndx = 0 for w in side_widgets: resource_name = side_icons[ndx] pixmap = QPixmap(os.path.join(resource_dir, resource_name)) icon = QIcon(pixmap) self._side_icons.append(icon) b = QToolButton() b.setIcon(icon) b.setIconSize(pixmap.rect().size()) b.setMaximumWidth(pixmap.rect().width() + 6) b.clicked.connect(self.signal_mapper_tab_changed.map) self.signal_mapper_tab_changed.setMapping(b, ndx) layout.addWidget(b) layout.setStretch(ndx, 1) ndx += 1 layout.addStretch() return layout
def __init__(self, info_text, no_date_allowed = True): super(DatePick, self).__init__() self.accepted_date = None layout = QVBoxLayout() title = _("Pick a date") self.setWindowTitle(title) layout.addWidget(TitleWidget(title, self)) self.info_label =QLabel(info_text) self.qw = QCalendarWidget() self.info_label.setWordWrap(True) self.info_label.setMaximumWidth(self.qw.minimumWidth()) layout.addWidget( self.info_label) layout.addWidget( self.qw) self.qw.activated.connect(self.date_chosen) self.buttons = QDialogButtonBox() if no_date_allowed: self.buttons.addButton( QPushButton("No date"), QDialogButtonBox.ButtonRole.AcceptRole) self.buttons.addButton( QDialogButtonBox.StandardButton.Cancel) self.buttons.addButton( QDialogButtonBox.Ok) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) layout.addWidget(self.buttons) layout.addStretch() self.setLayout(layout)
def _init_load_options_tab(self, tab): # auto load libs auto_load_libs = QCheckBox(self) auto_load_libs.setText("Automatically load all libraries") auto_load_libs.setChecked(False) self.option_widgets['auto_load_libs'] = auto_load_libs # dependencies list dep_group = QGroupBox("Dependencies") dep_list = QListWidget(self) self.option_widgets['dep_list'] = dep_list sublayout = QVBoxLayout() sublayout.addWidget(dep_list) dep_group.setLayout(sublayout) layout = QVBoxLayout() layout.addWidget(auto_load_libs) layout.addWidget(dep_group) layout.addStretch(0) frame = QFrame(self) frame.setLayout(layout) tab.addTab(frame, "Loading Options")
def _setupUi(self): self.setMinimumWidth(800) self.setMinimumHeight(600) layout = QVBoxLayout() self.setLayout(layout) self.editPmCmd = QLineEdit() layout.addWidget(self.editPmCmd) self.modesWidget = QWidget() self.modesLayout = QHBoxLayout() self.modesWidget.setLayout(self.modesLayout) layout.addWidget(self.modesWidget) self.checkBoxes = [] for mode in 'create query edit'.split(): chkBox = QCheckBox(mode) chkBox.setProperty('mode', mode) self.checkBoxes.append(chkBox) for checkBox in self.checkBoxes: self.modesLayout.addWidget(checkBox) checkBox.setChecked(True) if self.command: self.updateDocs() else: layout.addStretch()
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__( 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 layout = QVBoxLayout() layout.setContentsMargins(2, 2, 2, 2) layout.setSpacing(2) layout.addStretch(1) widget.setLayout(layout) self.setWidget(widget)
def layoutWidgets(self): hbox = QHBoxLayout() hbox.addWidget(self.indentLabel) hbox.addWidget(self.indentComboBox) hbox.addStretch() self.txtGroupBox.setLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.rtfIndentLabel) hbox.addWidget(self.rtfIndentComboBox) hbox.addStretch() self.rtfGroupBox.setLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.paperSizeLabel) hbox.addWidget(self.letterRadioButton) hbox.addWidget(self.a4RadioButton) hbox.addStretch() self.pdfGroupBox.setLayout(hbox) vbox = QVBoxLayout() vbox.addWidget(self.rtfGroupBox) vbox.addWidget(self.txtGroupBox) vbox.addWidget(self.pdfGroupBox) vbox.addStretch() self.setLayout(vbox)
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 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 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 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 _build_ui(self): layout = QVBoxLayout() self.setLayout(layout) self.setStyleSheet(_COMMON_CSS) layout.addLayout(self._make_top_row()) layout.addLayout(self._make_bottom_row()) layout.addStretch()
def layoutWidgets(self): layout = QVBoxLayout() layout.addWidget(self.tabWidget) layout.addStretch() buttonBox = QDialogButtonBox() buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole) buttonBox.addButton(self.closeButton, QDialogButtonBox.AcceptRole) layout.addWidget(buttonBox) self.setLayout(layout)
def _init_widgets(self): state = self._state if state is None: return if state.arch.name not in self.ARCH_REGISTERS: l.error( "Architecture %s is not listed in QRegisterViewer.ARCH_REGISTERS.", state.arch.name) return layout = QVBoxLayout() area = QScrollArea() area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setWidgetResizable(True) regs = self.ARCH_REGISTERS[state.arch.name] # common ones common_regs = regs['common'] for reg_name in common_regs: sublayout = QHBoxLayout() lbl_reg_name = QLabel(self) lbl_reg_name.setProperty('class', 'reg_viewer_label') lbl_reg_name.setText(reg_name) lbl_reg_name.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sublayout.addWidget(lbl_reg_name) sublayout.addSpacing(10) reg_value = QASTViewer(None, parent=self) self._registers[reg_name] = reg_value sublayout.addWidget(reg_value) layout.addLayout(sublayout) layout.setSpacing(0) layout.addStretch(0) layout.setContentsMargins(2, 2, 2, 2) # the container container = QFrame() container.setAutoFillBackground(True) palette = container.palette() palette.setColor(container.backgroundRole(), Qt.white) container.setPalette(palette) container.setLayout(layout) area.setWidget(container) base_layout = QVBoxLayout() base_layout.addWidget(area) self.setLayout(base_layout)
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 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, parent): QWidget.__init__(self, parent) # Variables self._options = parent.options() # Layouts layout = QVBoxLayout() layout.addLayout(self._initUI()) layout.addStretch() self.setLayout(layout)
class Profile(QWidget): ''' classdocs ''' def __init__(self, athlete=False): ''' Constructor ''' QWidget.__init__(self) self.initGUI() if athlete is not False: self.athlete = athlete self.setProfile(athlete) def initGUI(self): self.vLayout = QVBoxLayout() text = QLabel("<h3><b>Your profile</b></h3>") profileLayout = QFormLayout() self.nameLabel = QLabel() self.surnameLabel = QLabel() self.ageLabel = QLabel() self.bmiLabel = QLabel() self.heightLabel = QLabel() self.massLabel = QLabel() profileLayout.addRow("Name", self.nameLabel) profileLayout.addRow("Surname", self.surnameLabel) profileLayout.addRow("Age", self.ageLabel) profileLayout.addRow("Body Mass Index", self.bmiLabel) profileLayout.addRow("Height", self.heightLabel) profileLayout.addRow("Mass", self.massLabel) self.vLayout.addWidget(text) self.vLayout.addLayout(profileLayout) self.vLayout.addStretch(1) self.setLayout(self.vLayout) def setProfile(self, athlete): self.athlete = athlete self.nameLabel.setText(self.athlete._name) self.surnameLabel.setText(self.athlete._surname) self.ageLabel.setText(str(self.athlete.getAge())) self.bmiLabel.setText(str(self.athlete.getBMI())) self.heightLabel.setText(str(self.athlete._height) + " cm") self.massLabel.setText(str(self.athlete._mass) + " Kg")
def SetVLayout(self): verticalLayout = QVBoxLayout(self) vButton1 = QPushButton('Button 1', self) vButton2 = QPushButton('Button 2', self) vButton3 = QPushButton('Button 3', self) vButton4 = QPushButton('Button 4', self) verticalLayout.addWidget(vButton1) verticalLayout.addWidget(vButton2) verticalLayout.addStretch() verticalLayout.addWidget(vButton3) verticalLayout.addWidget(vButton4) self.setLayout(verticalLayout)
def __init__(self, parent, label, units): QDataDisplay.__init__(self, parent) self.units = units self.buildLabels(label) vbox = QVBoxLayout() vbox.addStretch(1) vbox.addWidget(self.label) vbox.addWidget(self.data) vbox.addStretch(1) self.setLayout(vbox)
def __init__(self, parent=None): QWidget.__init__(self, parent) # Layouts layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addLayout(self._initUI()) # Initialize widgets layout.addStretch() self.setLayout(layout) # Signals for widget in self._iter_parameter_widgets(): widget.valuesChanged.connect(self.valueChanged)
def setlayoutV(self): """Présentation de QVBoxLayout""" self.setWindowTitle("Vertical Layout") verticalLayout = QVBoxLayout(self) boutton1 = QPushButton("I'm first", self) boutton2 = QPushButton("I'm second", self) boutton3 = QPushButton("I'm third", self) boutton4 = QPushButton("I'm fourth", self) verticalLayout.addWidget(boutton1) verticalLayout.addWidget(boutton2) verticalLayout.addStretch() verticalLayout.addWidget(boutton3) verticalLayout.addWidget(boutton4) self.setLayout(verticalLayout)
def SetLayout(self): vlayout = QVBoxLayout(self) vbt1 = QPushButton('Button1', self) vbt2 = QPushButton('Button2', self) vbt3 = QPushButton('Button3', self) vbt4 = QPushButton('Button4', self) vlayout.addWidget(vbt1) vlayout.addStretch() vlayout.addWidget(vbt2) vlayout.addWidget(vbt3) vlayout.addWidget(vbt4) self.setLayout(vlayout)
def SetLayout(self): """ Function to add buttons and set the layout """ verticalLayout = QVBoxLayout(self) vButton1 = QPushButton('Button 1', self) vButton2 = QPushButton('Button 2', self) vButton3 = QPushButton('Button 3', self) vButton4 = QPushButton('Button 4', self) verticalLayout.addWidget(vButton1) verticalLayout.addWidget(vButton2) verticalLayout.addStretch() verticalLayout.addWidget(vButton3) verticalLayout.addWidget(vButton4) self.setLayout(verticalLayout)
def _init_settings_tab(self, tab): oneactive_checkbox = QCheckBox("Keep at most one active path") oneactive_checkbox.setChecked(False) self._oneactive_checkbox = oneactive_checkbox settings_layout = QVBoxLayout() settings_layout.addWidget(oneactive_checkbox) settings_layout.addStretch(0) frame = QFrame() frame.setLayout(settings_layout) tab.addTab(frame, 'Settings')
def _setupUi(self): self.iField = QLineEdit() self.iField.setFixedHeight(40) self.oField = QLineEdit() self.oField.setReadOnly(True) self.oField.setFixedHeight(40) mainLayout = QVBoxLayout() mainLayout.addWidget(QLabel('請在上面這欄輸入地址')) mainLayout.addWidget(self.iField) mainLayout.addStretch(1) mainLayout.addWidget(QLabel('郵遞區號會出現在這邊')) mainLayout.addWidget(self.oField) self.setLayout(mainLayout) self.setStyleSheet(MainWidget.stylesheet)
def __init__(self, parent, label, units): QDataDisplay.__init__(self, parent) self.units = units self.label = QLabel('%s:' % label) self.data = QLineEdit(constants.DEFAULT_LABEL) self.data.setReadOnly(True) vbox = QVBoxLayout() vbox.addStretch(1) vbox.addWidget(self.label) vbox.addWidget(self.data) vbox.addStretch(1) self.setLayout(vbox)
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 _make_supply_order_detail_view(self): # There's a self.proto somewhere, don't mess with it :-) # proto = [] # proto.append( TextLinePrototype('description',_('Description'), editable=True,nullable=False)) # proto.append( FloatNumberPrototype('quantity',_('Quantity'), editable=True,nullable=False)) # proto.append( FloatNumberPrototype('unit_price',_('Unit price'), editable=True,nullable=False)) # self.detail_model = PrototypedModelView(proto, self) # self.detail_view = PrototypedQuickView(proto, self) # self.detail_view.setModel(self.detail_model) # self.detail_view.verticalHeader().hide() self.detail_description = QTextEdit() self.detail_description.setTextInteractionFlags( Qt.TextBrowserInteraction) self.delivery_date_widget = QLabel() self.creation_date_widget = QLabel() self.supplier_reference_widget = QLabel() hlayout = QHBoxLayout() hlayout.addWidget(QLabel(_("Delivery date"))) hlayout.addWidget(self.delivery_date_widget) hlayout.addStretch() hlayout3 = QHBoxLayout() hlayout3.addWidget(QLabel(_("Creation date"))) hlayout3.addWidget(self.creation_date_widget) hlayout3.addStretch() hlayout2 = QHBoxLayout() hlayout2.addWidget(QLabel(_("Supplier's reference"))) hlayout2.addWidget(self.supplier_reference_widget) hlayout2.addStretch() layout = QVBoxLayout() layout.addLayout(hlayout) layout.addLayout(hlayout3) layout.addLayout(hlayout2) layout.addWidget(self.detail_description) layout.addStretch() # layout.addWidget(self.detail_view) # layout.setStretch(0,1) # layout.setStretch(1,3) return layout
class ToggleWidget(QWidget): toggled = Signal() service_changed = Signal() def __init__(self, *args, **kwargs): super(ToggleWidget, self).__init__(*args, **kwargs) self.line_edit = QLineEdit(self) self.button = QPushButton("Toggle", self) self.label = QLabel() self.layout = QVBoxLayout() self.layout.addWidget(self.line_edit) self.layout.addStretch() self.layout.addWidget(self.button) self.layout.addWidget(self.label) self.layout.addStretch() self.button.clicked.connect(self.on_click) self.line_edit.editingFinished.connect(self.on_edit) self.setLayout(self.layout) self.s = False def set_label(self, k): self.button.setText(k) def update_me(self): self.label.setText( "Current state: {}".format("ON" if self.s else "OFF")) def service(self): return str(self.line_edit.text()) def set_service(self, s): self.line_edit.setText(s) def set_state(self, s): self.s = s self.update_me() @Slot() def on_edit(self): self.service_changed.emit() @Slot() def on_click(self): self.s = not self.s self.update_me() self.toggled.emit()
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 _createLayout(self): 'Create the Wizard Page Layout' self._txtName = QLineEdit() self._lblName = QLabel(self.tr('Computer &Name:')) self._lblName.setBuddy(self._txtName) gbox = QGridLayout() gbox.addWidget(self._lblName, 0, 0) gbox.addWidget(self._txtName, 0, 1) vbox = QVBoxLayout() vbox.addLayout(gbox) vbox.addStretch() self.setLayout(vbox)
def __init__(self, parent = None): super(StackedPage, self).__init__(parent) layout = QHBoxLayout(self) leftpane = QVBoxLayout() self.buttongroup = QButtonGroup(self) self.buttongroup.setExclusive(True) self.groupbox = QGroupBox(self) self.groupbox.setMinimumWidth(200) QVBoxLayout(self.groupbox) leftpane.addWidget(self.groupbox) leftpane.addStretch(1) layout.addLayout(leftpane) self.rightpane = QStackedWidget(self) layout.addWidget(self.rightpane) self.buttongroup.buttonClicked[int].connect(self.rightpane.setCurrentIndex) self.rightpane.currentChanged[int].connect(self.activate)
def __init__(self, options, parent=None): QWizardPage.__init__(self, parent) # Variables self._options = options # Layouts layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) sublayout = self._initUI() # Initialize widgets sublayout.setContentsMargins(10, 10, 10, 10) layout.addLayout(sublayout, 1) layout.addStretch() self.setLayout(layout)
def add_command_tab(self, command_list, tab_name = "Commands"): outer_widget = QWidget() outer_layout = QVBoxLayout() outer_widget.setLayout(outer_layout) outer_layout.setContentsMargins(2, 2, 2, 2) outer_layout.setSpacing(1) for c in command_list: new_command = qButtonWithArgumentsClass(c[1], c[0], c[2], self.help_instance, max_field_size = 100) outer_layout.addWidget(new_command) outer_layout.setAlignment(new_command,QtCore.Qt.AlignTop ) outer_layout.addStretch() scroller = QScrollArea() scroller.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) # scroller.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scroller.setWidget(outer_widget) scroller.setWidgetResizable(True) self.addTab(scroller, tab_name)
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)
class TransactionMenuWidget(QFrame): """ Represents Transaction Menu Widget """ def __init__(self, parent=None): """ Initialize the Transaction Menu Widget """ QFrame.__init__(self, parent=parent) self.setFrameShape(QFrame.Panel) self.layout = QVBoxLayout(self) self.transaction = None self.forms = [SubtransactionForm(self)] self.setupHeader() for form in self.forms: form.setup() self.layout.addStretch() def setupHeader(self): header = QLabel() header.setText("<b>Transaction Details</b>") font = header.font() font.setPointSize(16) header.setFont(font) self.layout.addWidget(header) self.transactionLabel = QLabel() self.setTransactionLabelText() self.layout.addWidget(self.transactionLabel) def updateOnTransactionChange(self, currentTransaction): """ Update menu contents when the current transaction changes Transaction Change """ self.transaction = currentTransaction self.setTransactionLabelText() for form in self.forms: form.updateOnTransactionChange() def setTransactionLabelText(self): """ Set the Transaction label Text """ if self.transaction is not None: self.transactionLabel.setText("<b>{0}</b>".format(self.transaction.description)) def tabSelected(self): """ Update the Account Tab when the tab is selected """ for form in self.forms: form.tabSelected()
def __init__(self, parent, remote_documents_service): super(Nonconformity2Widget, self).__init__(parent) self._track_changes = True self._current_qe = None top_layout = QVBoxLayout() self._quality_event_prototype = QualityEventTypePrototype( "kind", _("Kind")) self._quality_event_type_widget = self._quality_event_prototype.edit_widget( self) self._quality_event_type_widget.activated.connect( self.event_type_changed) self._type_label = QLabel(_("Type :")) hlayout = QHBoxLayout() hlayout.addWidget(self._type_label) hlayout.addWidget(self._quality_event_prototype.edit_widget(self)) hlayout.setStretch(0, 0) hlayout.setStretch(1, 1) top_layout.addLayout(hlayout) # self.comments_widget = CommentsWidget(self, self._change_tracker) self.comments_widget = QTextEdit(self) self.comments_widget.textChanged.connect(self.comment_changed) self._description_label = QLabel(_("Description :")) top_layout.addWidget(self._description_label) top_layout.addWidget(self.comments_widget) self.documents = DocumentCollectionWidget( parent=self, doc_service=remote_documents_service, used_category_short_name='Qual.', no_header=True) self.documents.documents_list_changed.connect( self._documents_changed_slot) top_layout.addWidget(self.documents) top_layout.addStretch() self._enable_editing() self.setLayout(top_layout)
def _init_cfg_options_tab(self, tab): resolve_indirect_jumps = QCheckBox(self) resolve_indirect_jumps.setText('Resolve indirect jumps') resolve_indirect_jumps.setChecked(True) self.option_widgets['resolve_indirect_jumps'] = resolve_indirect_jumps collect_data_refs = QCheckBox(self) collect_data_refs.setText( 'Collect cross-references and infer data types') collect_data_refs.setChecked(True) self.option_widgets['collect_data_refs'] = collect_data_refs layout = QVBoxLayout() layout.addWidget(resolve_indirect_jumps) layout.addWidget(collect_data_refs) layout.addStretch(0) frame = QFrame(self) frame.setLayout(layout) tab.addTab(frame, 'CFG Options')
def __init__(self, program, parent=None): QWidget.__init__(self, parent) # Variables self._program = program # Controls lbl_program = QLabel(program.name) font = lbl_program.font() font.setBold(True) font.setPointSize(14) lbl_program.setFont(font) # Sizer layout = QVBoxLayout() layout.addWidget(lbl_program) layout.addLayout(self._initUI()) layout.addStretch() self.setLayout(layout)
def _load_tmps(self): state = self._state layout = QVBoxLayout() self._tmps.clear() if state is None: tmps = {} else: tmps = state.scratch.temps # tmps for tmp_id, tmp_value in tmps.iteritems(): sublayout = QHBoxLayout() lbl_tmp_name = QLabel(self) lbl_tmp_name.setProperty('class', 'reg_viewer_label') lbl_tmp_name.setText("tmp_%d" % tmp_id) lbl_tmp_name.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sublayout.addWidget(lbl_tmp_name) sublayout.addSpacing(10) tmp_viewer = QASTViewer(tmp_value, parent=self) self._tmps[tmp_id] = tmp_viewer sublayout.addWidget(tmp_viewer) layout.addLayout(sublayout) layout.setSpacing(0) layout.addStretch(0) layout.setContentsMargins(2, 2, 2, 2) # the container container = QFrame() container.setAutoFillBackground(True) palette = container.palette() palette.setColor(container.backgroundRole(), Qt.white) container.setPalette(palette) container.setLayout(layout) self._area.setWidget(container)
def _createLayout(self): 'Create the Wizard Page Layout' self._cbxType = QComboBox() self._lblType = QLabel(self.tr('Dive Computer &Type')) self._lblType.setBuddy(self._cbxType) for t in ComputerTypes: self._cbxType.addItem(t['name']) self._cbxType.addItem('Custom...') gbox = QGridLayout() gbox.addWidget(self._lblType, 0, 0) gbox.addWidget(self._cbxType, 0, 1) vbox = QVBoxLayout() vbox.addLayout(gbox) vbox.addStretch() self.setLayout(vbox)
def __init__(self, radio): QMainWindow.__init__(self) self.radio = radio self.dataDisplays = {} self.updateDatasetSignal.connect(self.updateDatasetSlot) dataDisplaysLayout = self.buildDataDisplays() graphs = self.buildGraphs() commandInputLayout = self.buildCommandInput() centralLayout = QVBoxLayout() centralLayout.addLayout(dataDisplaysLayout) centralLayout.addLayout(graphs) centralLayout.addStretch(1) centralLayout.addLayout(commandInputLayout) # Add the completeted layout to the window self.centralWidget = QWidget() self.centralWidget.setLayout(centralLayout) self.setCentralWidget(self.centralWidget)
def createLayouts(self): """Put widgets into layouts, thus creating the widget""" mainLayout = QHBoxLayout() fieldsLayout = QVBoxLayout() pathLayout = QHBoxLayout() buttonLayout = QHBoxLayout() mainLayout.addStretch(10) fieldsLayout.addStretch(50) fieldsLayout.addWidget(self.linkLabel) fieldsLayout.addWidget(self.line) fieldsLayout.addWidget(self.localdirLabel) pathLayout.addWidget(self.localdirEdit) pathLayout.addWidget(self.browseButton) fieldsLayout.addLayout(pathLayout) buttonLayout.addStretch(50) buttonLayout.addWidget(self.syncButton, 50, Qt.AlignRight) fieldsLayout.addLayout(buttonLayout) fieldsLayout.addStretch(10) fieldsLayout.addWidget(self.statusLabel) fieldsLayout.addWidget(self.status) fieldsLayout.addStretch(80) mainLayout.addLayout(fieldsLayout, 60) mainLayout.addStretch(10) self.setLayout(mainLayout)
def __init__(self, parent=None): super().__init__(parent) self._text_edit = QTextEdit() self._open_button = QPushButton(self.tr("&Open")) self._save_button = QPushButton(self.tr("&Save")) self._exit_button = QPushButton(self.tr("&Exit")) button_layout = QVBoxLayout() button_layout.addWidget(self._open_button) button_layout.addWidget(self._save_button) button_layout.addWidget(self._exit_button) button_layout.addStretch() main_layout = QHBoxLayout() main_layout.addWidget(self._text_edit) main_layout.addLayout(button_layout) self.setLayout(main_layout) self.setWindowTitle(self.tr('Notepad')) self._save_button.clicked.connect(self.save) self._open_button.clicked.connect(self.open) self._exit_button.clicked.connect(self.exit)
class FormPage(QWidget): statusMessage = Signal(str) def __init__(self, parent): super(FormPage, self).__init__(parent) layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) formframe = QGroupBox(self) self.vbox = QVBoxLayout(formframe) self.form = PropertyFormLayout() self.vbox.addLayout(self.form) self.vbox.addStretch(1) self._has_stretch = True layout.addWidget(formframe) def _removeStretch(self): if self._has_stretch: self.vbox.removeItem(self.vbox.itemAt(self.vbox.count() - 1)) self._has_stretch = False; def addStretch(self): if not self._has_stretch: self.vbox.addStretch(1) self._has_stretch = True def addProperty(self, kind, path, row, col, *args, **kwargs): self.form.addProperty(self, kind, path, row, col, *args, **kwargs) def addWidget(self, widget, *args): self._removeStretch() self.form.addWidget(widget, *args) def addLayout(self, sublayout, *args): self._removeStretch() self.form.addLayout(sublayout, *args) def status_message(self, msg, *args): self.statusMessage.emit(msg.format(*args))
def _createLayout(self): 'Create the Wizard Page Layout' self._cbxDriver = QComboBox() self._cbxDriver.setModel(DriverModel()) self._lblDriver = QLabel(self.tr('&Driver:')) self._lblDriver.setBuddy(self._cbxDriver) self._cbxParser = QComboBox() self._cbxParser.setModel(ParserModel()) self._lblParser = QLabel(self.tr('&Parser:')) self._lblParser.setBuddy(self._cbxParser) self._txtDOpts = QLineEdit() self._lblDOpts = QLabel(self.tr('Driver Options:')) self._lblDOpts.setBuddy(self._txtDOpts) self._txtPOpts = QLineEdit() self._lblPOpts = QLabel(self.tr('Parser Options:')) self._lblPOpts.setBuddy(self._txtPOpts) gbox = QGridLayout() gbox.addWidget(self._lblDriver, 0, 0) gbox.addWidget(self._cbxDriver, 0, 1) gbox.addWidget(self._lblParser, 1, 0) gbox.addWidget(self._cbxParser, 1, 1) gbox.addWidget(self._lblDOpts, 2, 0) gbox.addWidget(self._txtDOpts, 2, 1) gbox.addWidget(self._lblPOpts, 3, 0) gbox.addWidget(self._txtPOpts, 3, 1) vbox = QVBoxLayout() vbox.addLayout(gbox) vbox.addStretch() self.setLayout(vbox)
def __init__(self, loadIcon="loading_bar", primaryMessage="Please, Wait", message='', parent=None): super(LoadingWidget, self).__init__(parent) self.finished.connect(self._updateUI) self.setStyleSheet(""" QWidget { background-color: #ffffff } """) self._icon_load = loadIcon self._primary_message = primaryMessage self._label_message = QLabel(message) self._label_message.setWordWrap(True) self._label_message.setAlignment(Qt.AlignCenter) self._label_primary_message = QLabel(self._primary_message) self._label_primary_message.setStyleSheet(""" QLabel { font-size: 20px; font-weight:bold; color: rgb(65,65,65); } """) self._label_primary_message.setAlignment(Qt.AlignCenter) self._label_movie = QLabel() self._label_movie.setAlignment(Qt.AlignCenter) self._movie = QMovie(self._icon_load) self._label_movie.setMovie(self._movie) self._movie.start() layout = QVBoxLayout() layout.addWidget(self._label_primary_message) layout.addSpacing(5) layout.addWidget(self._label_message) layout.addSpacing(5) layout.addWidget(self._label_movie) layout.addStretch() #self._setupAnimation() # this should be done after showing everything to get correct geometries self.setLayout(layout)
def createLayouts(self): """Put widgets into layouts, thus creating the widget""" mainLayout = QHBoxLayout() fieldsLayout = QVBoxLayout() ftpInfoLayout = QHBoxLayout() buttonLayout = QHBoxLayout() mainLayout.addStretch(20) fieldsLayout.addStretch(80) fieldsLayout.addWidget(self.linkLabel) fieldsLayout.addWidget(self.line) fieldsLayout.addStretch(20) ftpInfoLayout.addWidget(self.hostLabel, 50, Qt.AlignLeft) ftpInfoLayout.addStretch(20) ftpInfoLayout.addWidget(self.sslLabel, 20, Qt.AlignRight) ftpInfoLayout.addWidget(self.sslCheck, 10, Qt.AlignRight) fieldsLayout.addLayout(ftpInfoLayout) fieldsLayout.addWidget(self.hostEdit) fieldsLayout.addWidget(self.usernameLabel) fieldsLayout.addWidget(self.usernameEdit) fieldsLayout.addWidget(self.passwdLabel) fieldsLayout.addWidget(self.passwdEdit) fieldsLayout.addStretch(30) buttonLayout.addStretch(50) buttonLayout.addWidget(self.loginButton, 50, Qt.AlignRight) fieldsLayout.addLayout(buttonLayout) fieldsLayout.addStretch(20) mainLayout.addLayout(fieldsLayout, 30) mainLayout.addStretch(20) self.setLayout(mainLayout)
def __init__(self, parent): super(TipOfTheDayDialog, self).__init__(parent) """ Default class constructor. :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_ """ ## qDebug("TipOfTheDayDialog constructor") self.mainWin = parent self.setAttribute(Qt.WA_DeleteOnClose) self.setWizardStyle(QWizard.ModernStyle) self.setMinimumSize(550, 400) ## self.setOption(QWizard.HaveHelpButton, True) page = QWizardPage(self) self.imgBanner = ImageWidget(self.mainWin.gImgDir, self.mainWin.gIconDir, self) # Read in the tips.txt file. # fileOpen = open(self.mainWin.gAppDir + os.sep + 'tips.txt') # tips = fileOpen.read() # fileOpen.close() # self.tipsList = [tip for tip in tips.split('\n') if tip] # remove the blank lines also. self.tipsList = [tip for tip in TIPS_TXT.split('\n') if tip] # remove the blank lines also. # Make sure we don't cause an IndexError. # DEV-We might be adding tips to the txt at runtime. The easy way to add and check tips. if int(self.mainWin.settings_general_current_tip) >= len(self.tipsList): self.mainWin.settings_general_current_tip = 0 self.labelTipOfTheDay = QLabel(self) self.labelTipOfTheDay.setText(self.tipsList[int(self.mainWin.settings_general_current_tip)]) self.labelTipOfTheDay.setWordWrap(True) # Forget about a standardish QCheckBox, real powerusers keep the lights on! self.lightswitch = LightSwitchWidget(self.mainWin.gImgDir, self.mainWin, self) self.showOnStartupLabel = QLabel(self) self.showOnStartupLabel.setText(self.tr('Show tips on startup')) layout = QVBoxLayout(self) hblayout = QHBoxLayout() hblayout2 = QHBoxLayout() hblayout.addStretch(1) hblayout.addWidget(self.imgBanner) hblayout.addStretch(1) layout.addLayout(hblayout) layout.addStrut(1) layout.addSpacerItem(QSpacerItem(0, 5)) layout.addWidget(self.labelTipOfTheDay) layout.addStretch(1) hblayout2.addWidget(self.lightswitch) hblayout2.addWidget(self.showOnStartupLabel) hblayout2.addStretch(1) self.showOnStartupLabel.setAlignment(Qt.AlignBottom) layout.addLayout(hblayout2) page.setLayout(layout) self.addPage(page) self.setWindowTitle(self.tr('Tip of the Day')) buttonPrevious = QPushButton(self) buttonPrevious.setText(self.tr('&Previous')) buttonPrevious.setIcon(QIcon(self.mainWin.gIconDir + os.sep + 'undo.png')) buttonPrevious.setIconSize(QSize(24, 24)) buttonNext = QPushButton(self) buttonNext.setText(self.tr('&Next')) buttonNext.setIcon(QIcon(self.mainWin.gIconDir + os.sep + 'redo.png')) buttonNext.setIconSize(QSize(24, 24)) buttonClose = QPushButton(self) buttonClose.setText(self.tr('&Close')) buttonClose.setIcon(QIcon(self.mainWin.gIconDir + os.sep + 'windowclose.png')) buttonClose.setIconSize(QSize(24, 24)) self.setButton(QWizard.CustomButton1, buttonPrevious) self.setButton(QWizard.CustomButton2, buttonNext) self.setButton(QWizard.CustomButton3, buttonClose) self.setOption(QWizard.HaveCustomButton1, True) self.setOption(QWizard.HaveCustomButton2, True) self.setOption(QWizard.HaveCustomButton3, True) self.customButtonClicked.connect(self.buttonTipOfTheDayClicked) listTipOfTheDayButtons = [QWizard.Stretch, QWizard.CustomButton1, QWizard.CustomButton2, QWizard.CustomButton3] self.setButtonLayout(listTipOfTheDayButtons) self.DoSetWhatsThis()
def initUI(self): grp = QGroupBox('Bounding Box') grplay = QGridLayout() # Extents. extx = QDoubleSpinBox() extx.setMinimum(0) extx.setMaximum(100) extx.setValue(self.bbox.extents[0]) self.controls['extx'] = extx exty = QDoubleSpinBox() exty.setMinimum(0) exty.setMaximum(100) exty.setValue(self.bbox.extents[1]) self.controls['exty'] = exty extz = QDoubleSpinBox() extz.setMinimum(0) extz.setMaximum(100) extz.setValue(self.bbox.extents[2]) self.controls['extz'] = extz grplay.addWidget(QLabel('<b>Extents</b>'), 0, 0) grplay.addWidget(QLabel('X'), 0, 1) grplay.addWidget(extx, 0, 2) grplay.addWidget(QLabel('Y'), 0, 3) grplay.addWidget(exty, 0, 4) grplay.addWidget(QLabel('Z'), 0, 5) grplay.addWidget(extz, 0, 6) # Center. cntx = QDoubleSpinBox() cntx.setMinimum(-10000) cntx.setMaximum(10000) cntx.setValue(self.bbox.center[0]) self.controls['cntx'] = cntx cnty = QDoubleSpinBox() cnty.setMinimum(-10000) cnty.setMaximum(10000) cnty.setValue(self.bbox.center[1]) self.controls['cnty'] = cnty cntz = QDoubleSpinBox() cntz.setMinimum(-10000) cntz.setMaximum(10000) cntz.setValue(self.bbox.center[2]) self.controls['cntz'] = cntz grplay.addWidget(QLabel('<b>Center</b>'), 1, 0) grplay.addWidget(QLabel('X'), 1, 1) grplay.addWidget(cntx, 1, 2) grplay.addWidget(QLabel('Y'), 1, 3) grplay.addWidget(cnty, 1, 4) grplay.addWidget(QLabel('Z'), 1, 5) grplay.addWidget(cntz, 1, 6) # Radius. radius = QDoubleSpinBox() cntz.setMinimum(0) cntz.setMaximum(10000) radius.setValue(self.bbox.radius) self.controls['radius'] = radius grplay.addWidget(QLabel('<b>BSphereRadius'), 2, 0) grplay.addWidget(radius, 2, 1, 1, 2) grp.setLayout(grplay) # Buttons. save_btn = QPushButton('Save') save_btn.clicked.connect(self.save) cancel_btn = QPushButton('Cancel') cancel_btn.clicked.connect(self.close) btns = QHBoxLayout() btns.addStretch() btns.addWidget(save_btn) btns.addWidget(cancel_btn) # Main Layout. mainlay = QVBoxLayout() mainlay.addWidget(grp) mainlay.addLayout(btns) mainlay.addStretch() self.setLayout(mainlay) self.setGeometry(340, 340, 400, 100) self.setWindowTitle('MSH Suite - Edit BBox') self.show()
def initUI(self): grp = QGroupBox('Transform') grplay = QGridLayout() # Translation grplay.addWidget(QLabel('<b>Translation</b>'), 0, 0) trax = QDoubleSpinBox() trax.setMinimum(-10000) trax.setMaximum(10000) trax.setValue(self.tran.translation[0]) self.controls['trax'] = trax grplay.addWidget(trax, 0, 1) tray = QDoubleSpinBox() tray.setMinimum(-10000) tray.setMaximum(10000) tray.setValue(self.tran.translation[1]) self.controls['tray'] = tray grplay.addWidget(tray, 0, 2) traz = QDoubleSpinBox() traz.setMinimum(-10000) traz.setMaximum(10000) traz.setValue(self.tran.translation[2]) self.controls['traz'] = traz grplay.addWidget(traz, 0, 3) # Rotation. grplay.addWidget(QLabel('<b>Rotation</b>'), 1, 0) rotx = QSpinBox() rotx.setMinimum(-10000) rotx.setMaximum(10000) #rotx.setText(str(self.tran.euler_angles()[0])) traz.setValue(self.tran.euler_angles()[0]) self.controls['rotx'] = rotx grplay.addWidget(rotx, 1, 1) roty = QSpinBox() roty.setMinimum(-10000) roty.setMaximum(10000) #roty.setText(str(self.tran.euler_angles()[1])) traz.setValue(self.tran.euler_angles()[1]) self.controls['roty'] = roty grplay.addWidget(roty, 1, 2) rotz = QSpinBox() rotz.setMinimum(-10000) rotz.setMaximum(10000) #rotz.setText(str(self.tran.euler_angles()[2])) traz.setValue(self.tran.euler_angles()[2]) self.controls['rotz'] = rotz grplay.addWidget(rotz, 1, 3) # Scale. grplay.addWidget(QLabel('<b>Scale</b>'), 2, 0) sclx = QDoubleSpinBox() sclx.setMinimum(-10000) sclx.setMaximum(10000) sclx.setValue(self.tran.scale[0]) self.controls['sclx'] = sclx grplay.addWidget(sclx, 2, 1) scly = QDoubleSpinBox() scly.setMinimum(-10000) scly.setMaximum(10000) scly.setValue(self.tran.scale[1]) self.controls['scly'] = scly grplay.addWidget(scly, 2, 2) sclz = QDoubleSpinBox() sclz.setMinimum(-10000) sclz.setMaximum(10000) sclz.setValue(self.tran.scale[2]) self.controls['sclz'] = sclz grplay.addWidget(sclz, 2, 3) grp.setLayout(grplay) # Buttons. save_btn = QPushButton('Save') save_btn.clicked.connect(self.save) cancel_btn = QPushButton('Cancel') cancel_btn.clicked.connect(self.close) btns = QHBoxLayout() btns.addStretch() btns.addWidget(save_btn) btns.addWidget(cancel_btn) # Main Layout. mainlay = QVBoxLayout() mainlay.addWidget(grp) mainlay.addLayout(btns) mainlay.addStretch() self.setLayout(mainlay) self.setGeometry(340, 340, 400, 100) self.setWindowTitle('MSH Suite - Edit BBox') self.show()