def __init__(self): super(Demo, self).__init__() self.setWindowTitle('Floating Widgets Demo') w = QtWidgets.QWidget(self) self.setCentralWidget(w) lyt = QtWidgets.QFormLayout(w) self.lw = QtWidgets.QWidget(self) self.ui = ui_file.get_module(__file__) self.ui.setupUi(self.lw) with open(STYLE) as fobj: self.setStyleSheet(fobj.read()) # No need to do anything with the layout at its current grid position # self.ui.gridLayout.removeItem(self.ui.layout_0) # self.ui.gridLayout.addLayout(self.ui.layout_0, 0, 0) # Before you can put it to layered grid position you NEED to remove it self.ui.gridLayout.removeItem(self.ui.layout_1) self.ui.gridLayout.addLayout(self.ui.layout_1, 0, 0) self.ui.layout_1.setAlignment( self.ui.button_right, QtCore.Qt.AlignCenter | QtCore.Qt.AlignRight) self.ui.layout_1.setAlignment( self.ui.button_left, QtCore.Qt.AlignCenter | QtCore.Qt.AlignLeft) lyt.addRow(self.lw)
def setupWidgets(self): grp_addnew = QtWidgets.QGroupBox() grp_addnew.setLayout(QtWidgets.QFormLayout()) self.combo_density = QtWidgets.QComboBox() for x in range(5,9): self.combo_density.insertItem(x,f"LTO-{x}", x) self.combo_density.setCurrentIndex(self.combo_density.count() - 1) self.combo_devices = QtWidgets.QComboBox() self.combo_devices.insertItems(0, [str(x) for x in pathlib.Path("/dev/").glob("nst?")]) self.combo_devices.setCurrentIndex(self.combo_devices.count() - 1) self.num_buffer = QtWidgets.QSpinBox() self.num_buffer.setRange(512000, 5120000) self.num_buffer.setSuffix(" KB") self.txt_mount = QtWidgets.QLineEdit() grp_addnew.layout().addRow("Device:", self.combo_devices) grp_addnew.layout().addRow("Drive Density:", self.combo_density) grp_addnew.layout().addRow("Drive Buffer:", self.num_buffer) grp_addnew.layout().addRow("Mount Point:", self.txt_mount) self.layout().addWidget(grp_addnew) btns_actions = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Cancel) self.layout().addWidget(btns_actions)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(436, 423) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.formLayout = QtWidgets.QFormLayout(self.centralWidget) self.formLayout.setObjectName("formLayout")
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(501, 467) Form.setLocale( QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.formLayout = QtWidgets.QFormLayout(Form) self.formLayout.setObjectName("formLayout") self.label_9 = QtWidgets.QLabel(Form) self.label_9.setWordWrap(True) self.label_9.setObjectName("label_9") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_9) self.label = QtWidgets.QLabel(Form) self.label.setObjectName("label") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label) self.sbDenstiy = QtWidgets.QDoubleSpinBox(Form) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.sbDenstiy.sizePolicy().hasHeightForWidth()) self.sbDenstiy.setSizePolicy(sizePolicy) self.sbDenstiy.setDecimals(3) self.sbDenstiy.setMinimum(-999999999999.0) self.sbDenstiy.setMaximum(99999999999999.0) self.sbDenstiy.setObjectName("sbDenstiy") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.sbDenstiy) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self, parent=None): super(ShapeSettings, self).__init__(parent) self.shape = QtWidgets.QComboBox() self.shape.addItems(SHAPE_TYPES) self.shape.currentIndexChanged.connect(self.shape_changed) self.left = FloatEdit(minimum=0.0) method = partial(self.rectModified.emit, 'shape.left') self.left.valueSet.connect(method) self.top = FloatEdit(minimum=0.0) method = partial(self.rectModified.emit, 'shape.right') self.top.valueSet.connect(method) self.width = FloatEdit(minimum=0.0) method = partial(self.rectModified.emit, 'shape.width') self.width.valueSet.connect(method) self.height = FloatEdit(minimum=0.0) method = partial(self.rectModified.emit, 'shape.height') self.height.valueSet.connect(method) self.layout = QtWidgets.QFormLayout(self) self.layout.setSpacing(0) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setHorizontalSpacing(5) self.layout.addRow('Shape', self.shape) self.layout.addItem(QtWidgets.QSpacerItem(0, 8)) self.layout.addRow(Title('Dimensions')) self.layout.addRow('left', self.left) self.layout.addRow('top', self.top) self.layout.addRow('width', self.width) self.layout.addRow('height', self.height) for label in self.findChildren(QtWidgets.QLabel): if not isinstance(label, Title): label.setFixedWidth(LEFT_CELL_WIDTH)
def __init__(self, tray_icon): super(SettingsWindow,self).__init__() self.tray_icon = tray_icon self.setWindowTitle("Settings") self.setFixedSize(470, 0) if os.path.exists("assets/settings_icon.png"): self.setWindowIcon(QtGui.QIcon("assets/settings_icon.png")) self.main_layout = QtWidgets.QFormLayout() self.init_service_section() self.main_layout.addRow(QtWidgets.QLabel("")) self.init_themes_section() self.main_layout.addRow(QtWidgets.QLabel("")) self.init_layer_section() self.main_layout.addRow(QtWidgets.QLabel("")) # Save button self.save_button = QtWidgets.QPushButton("Save") self.save_button.clicked.connect(self.save) self.save_button.setDefault(True) self.main_layout.addRow("",self.save_button) try: self.setStyleSheet(config.theme["settings_window"]) except KeyError: pass self.setLayout(self.main_layout)
def __init__(self, parent=None): super().__init__(parent) self.setWindowTitle("Dodaj u korpu") self.vbox_layout = QtWidgets.QVBoxLayout() self.form_layout = QtWidgets.QFormLayout() self.inputKolicina = QtWidgets.QPlainTextEdit(self) self.inputNapomena = QtWidgets.QPlainTextEdit(self) self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, parent=self) self.form_layout.addRow("Kolicina :", self.inputKolicina) self.form_layout.addRow("Napomena :", self.inputNapomena) self.inputKolicina.setMaximumHeight(20) self.vbox_layout.addLayout(self.form_layout) self.vbox_layout.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) self.setLayout(self.vbox_layout)
def createFormGroupBox(self): self.formGroupBox = QtWidgets.QGroupBox("Form layout") layout = QtWidgets.QFormLayout() layout.addRow(QtWidgets.QLabel("Line 1:"), QtWidgets.QLineEdit()) layout.addRow(QtWidgets.QLabel("Line 2, long text:"), QtWidgets.QComboBox()) layout.addRow(QtWidgets.QLabel("Line 3:"), QtWidgets.QSpinBox()) self.formGroupBox.setLayout(layout)
def __init__(self): super().__init__() self.OSZ = None self.SONGS = None self.lOsz = QtWidgets.QLabel('.osz file') self.bBrowse = QtWidgets.QPushButton('Browse') self.bReset = QtWidgets.QPushButton('Reset') self.lSdir = QtWidgets.QLabel('Songs directory') self.bSbrowse = QtWidgets.QPushButton('Browse') self.bSReset = QtWidgets.QPushButton('Reset') self.bExtract = QtWidgets.QPushButton('Extract beatmap') self.layout = QtWidgets.QVBoxLayout() self.lay1 = QtWidgets.QFormLayout() self.lay11 = QtWidgets.QHBoxLayout() self.lay11.addWidget(self.bBrowse) self.lay11.addWidget(self.bReset) self.lay1.addRow(self.lOsz, self.lay11) self.lay12 = QtWidgets.QHBoxLayout() self.lay12.addWidget(self.bSbrowse) self.lay12.addWidget(self.bSReset) self.lay1.addRow(self.lSdir, self.lay12) self.layout.addLayout(self.lay1) self.layout.addWidget(self.bExtract) self.setLayout(self.layout) self.bBrowse.clicked.connect(self.searchOsz) self.bSbrowse.clicked.connect(self.searchSongs) self.bExtract.clicked.connect(self.extOsz) self.bReset.clicked.connect(lambda: self.reset(self.OSZ)) self.bSReset.clicked.connect(lambda: self.reset(self.SONGS))
def __init__(self, parent=None, metadata: Dict[str, Any] = None): super().__init__(parent) super().setWindowFlags(QtCore.Qt.Window | QtCore.Qt.WindowCloseButtonHint) self.setWindowTitle(self.TITLE) if (metadata is None): self._metadata = {"author": None, "licence": None} else: self._metadata = copy.deepcopy(metadata) self._main_layout = QtWidgets.QFormLayout(self) self._author = QtWidgets.QLineEdit() self._author.setText("" if (self._metadata.get("author", None) is None ) else self._metadata["author"]) self._licence_text = QtWidgets.QTextEdit() self._licence_text.setText("" if ( self._metadata.get("licence", None) is None ) else self._metadata["licence"]) self._licence_btn = QtWidgets.QPushButton("From File") self._submit_btns = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok) self._main_layout.addRow("Author:", self._author) self._main_layout.addRow("Licence:", self._licence_btn) self._main_layout.addRow(self._licence_text) self._main_layout.addRow(self._submit_btns) self._licence_btn.clicked.connect(self._on_file_req) self._submit_btns.accepted.connect(self._on_accept) self._submit_btns.rejected.connect(self.reject) self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
def __init__(self, modes, parent=None): super(HotkeySetter, self).__init__(parent) self.setWindowTitle("Set hotkey") self.ctrl = BoolCombo(False) self.alt = BoolCombo(False) self.shift = BoolCombo(False) self.touch = TouchEdit() self.hotkeytype = QtWidgets.QComboBox() self.hotkeytype.addItems(modes) self.options_layout = QtWidgets.QFormLayout() self.options_layout.setContentsMargins(0, 0, 0, 0) self.options_layout.setVerticalSpacing(0) self.options_layout.addRow("Ctrl", self.ctrl) self.options_layout.addRow("Alt", self.alt) self.options_layout.addRow("Shift", self.shift) self.options_layout.addRow("Touch", self.touch) self.options_layout.addRow("Hotkey event", self.hotkeytype) self.ok = QtWidgets.QPushButton("ok") self.ok.released.connect(self.accept) self.cancel = QtWidgets.QPushButton("cancel") self.cancel.released.connect(self.reject) self.button_layout = QtWidgets.QHBoxLayout() self.button_layout.setContentsMargins(0, 0, 0, 0) self.button_layout.addStretch(1) self.button_layout.addWidget(self.ok) self.button_layout.addWidget(self.cancel) self.layout = QtWidgets.QVBoxLayout(self) self.layout.addLayout(self.options_layout) self.layout.addLayout(self.button_layout)
def __init__(self, app): self._app = app qtwidgets.QWidget.__init__(self) self.setFont(self._app.main_font(size=10)) v_layout = qtwidgets.QVBoxLayout() buttons = widgets.HButtonBar([ ("Apply OCR", self._apply_ocr), ("Create Djvu", self._djvubind), ]) v_layout.addWidget(buttons, stretch=0) self.cover_front = widgets.OpenFileWidget() self.cover_back = widgets.OpenFileWidget() f_layout = qtwidgets.QFormLayout() f_layout.addRow("cover_front", self.cover_front) f_layout.addRow("cover_back", self.cover_back) f_widget = qtwidgets.QWidget(self) f_widget.setLayout(f_layout) v_layout.addWidget(f_widget, stretch=0) self.tab = qtwidgets.QTabWidget() v_layout.addWidget(self.tab, stretch=1) self.setLayout(v_layout) self.cover_front.field.textChanged.connect(self._cover_front_changed) self.cover_back.field.textChanged.connect(self._cover_back_changed) self._app.models["page_numbering"].pageNumberChanged.connect( self._update_page_numbers)
def create_layout(self): """ pyside2 create layout :return: None """ self.uiTopHBox = QtWidgets.QHBoxLayout() self.uiTopHBox.addWidget(self.lineEdit) self.uiTopHBox.addWidget(self.path_btn) self.levelSpinBoxHBox = QtWidgets.QHBoxLayout() self.levelSpinBoxHBox.addWidget(self.levelSpinBoxLable) self.levelSpinBoxHBox.addWidget(self.levelSpinBox) self.levelSpinBoxHBox.addStretch() self.uiFormLayout = QtWidgets.QFormLayout() self.uiFormLayout.addRow('Path: ', self.uiTopHBox) self.uiFormLayout.addRow('', self.levelSpinBoxHBox) self.uiFormLayout.addRow('', self.loadBuffers_checkBox) self.uiFormLayout.addRow('', self.loadScale_checkBox) # create button layout self.btn_hBoxLayout = QtWidgets.QHBoxLayout() self.btn_hBoxLayout.addStretch() self.btn_hBoxLayout.addWidget(self.save_btn) self.btn_hBoxLayout.addWidget(self.load_btn) # create and add to main layout self.main_vBoxLayout = QtWidgets.QVBoxLayout(self) self.main_vBoxLayout.addLayout(self.uiFormLayout) self.main_vBoxLayout.addLayout(self.btn_hBoxLayout)
def create_layout(self): file_path_layout = QtWidgets.QHBoxLayout() file_path_layout.addWidget(self.filepath_le) file_path_layout.addWidget(self.select_file_path_btn) radio_btn_layout = QtWidgets.QHBoxLayout() radio_btn_layout.addWidget(self.open_rb) radio_btn_layout.addWidget(self.import_rb) radio_btn_layout.addWidget(self.reference_rb) form_layout = QtWidgets.QFormLayout() form_layout.addRow("File:", file_path_layout) form_layout.addRow("", radio_btn_layout) form_layout.addRow("", self.force_cb) button_layout = QtWidgets.QHBoxLayout() button_layout.addWidget(self.green_btn) button_layout.addStretch() button_layout.addWidget(self.apply_btn) button_layout.addWidget(self.close_btn) main_layout = QtWidgets.QVBoxLayout(self) main_layout.addWidget(self.title_label) main_layout.addLayout(form_layout) main_layout.addLayout(button_layout)
def __init__(self, show=None, parent=None): QtWidgets.QWidget.__init__(self, parent) show_name = "" if show: show_name = show.data.name self.__shows = opencue.api.getShows() self.__allocs = opencue.api.getAllocations() layout = QtWidgets.QFormLayout(self) self.showBox = QtWidgets.QComboBox(self) self.allocBox = QtWidgets.QComboBox(self) self.sizeBox = QtWidgets.QDoubleSpinBox(self) self.burstBox = QtWidgets.QDoubleSpinBox(self) self.showBox.addItems([s.data.name for s in self.__shows]) defaultIndex = self.showBox.findText(show_name) if defaultIndex >= 0: self.showBox.setCurrentIndex(defaultIndex) self.allocBox.addItems([a.data.name for a in self.__allocs]) self.sizeBox.setMaximum(1000000) self.sizeBox.setValue(100) self.burstBox.setMaximum(1000000) self.burstBox.setValue(110) layout.addRow('Show:', self.showBox) layout.addRow('Alloc:', self.allocBox) layout.addRow('Size:', self.sizeBox) layout.addRow('Burst:', self.burstBox)
def layout(self): # Projects tree related projects_layout = QtWidgets.QHBoxLayout() projects_layout.addWidget(self.line_search_label) projects_layout.addWidget(self.line_search) projects_layout.addStretch() vertical_layout_1 = QtWidgets.QVBoxLayout() vertical_layout_1.addLayout(projects_layout) vertical_layout_1.addWidget(self.projects_tree) # Shot step related shots_layout = QtWidgets.QVBoxLayout() shots_layout.addWidget(self.shots_tree) # Files step related files_layout = QtWidgets.QVBoxLayout() files_layout.addWidget(self.files_tree) horizontal_layout = QtWidgets.QHBoxLayout() horizontal_layout.addLayout(vertical_layout_1) horizontal_layout.addLayout(shots_layout) horizontal_layout.addLayout(files_layout) horizontal_layout.addStretch() horizontal_open_form = QtWidgets.QFormLayout() horizontal_open_form.addWidget(self.btn_open) main_layout = QtWidgets.QVBoxLayout(self) main_layout.addLayout(horizontal_layout) main_layout.addLayout(horizontal_open_form)
def __init__(self, flight_sim, parent=None, appctxt=None): """Game and application versions widget.""" QtWidgets.QDialog.__init__(self) self.flight_sim = flight_sim self.parent = parent self.appctxt = appctxt self.setWindowTitle("Versions") self.setWindowFlags(QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowCloseButtonHint) self.setWindowModality(QtCore.Qt.ApplicationModal) self.layout = QtWidgets.QFormLayout() self.app_version_field = QtWidgets.QLineEdit(self) self.app_version_field.setReadOnly(True) self.layout.addRow("Application Version:", self.app_version_field) self.game_version_field = QtWidgets.QLineEdit(self) self.game_version_field.setReadOnly(True) self.layout.addRow("Game Version:", self.game_version_field) self.setLayout(self.layout) self.get_versions() self.show() self.setFixedSize(self.width(), self.height())
def __init__(self, parent=None): super().__init__(parent) self.setWindowTitle("Moja korpa") self.vbox_layout = QtWidgets.QVBoxLayout() self.form_layout = QtWidgets.QFormLayout() self.inputBrTelefona = QtWidgets.QPlainTextEdit(self) self.inputAdresa = QtWidgets.QPlainTextEdit(self) self.inputNapomena = QtWidgets.QPlainTextEdit(self) self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, parent=self) self.form_layout.addRow("Broj telefona :", self.inputBrTelefona) self.form_layout.addRow("Adresa dostave :", self.inputAdresa) self.form_layout.addRow("Napomena porudzbine :", self.inputNapomena) self.inputBrTelefona.setMaximumHeight(20) self.inputAdresa.setMaximumHeight(20) self.vbox_layout.addLayout(self.form_layout) self.vbox_layout.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) self.setLayout(self.vbox_layout)
def __init__(self, *args, **kwargs): super(OptionWidget, self).__init__(*args, **kwargs) optionLayout = QtWidgets.QFormLayout(self) #ドッグレッグリグのオンオフ確認 self.checkWidgetDL = QtWidgets.QCheckBox('Is Dog Leg') optionLayout.addRow('', self.checkWidgetDL) #アーム作成の可否 self.checkWidgetLeg = QtWidgets.QCheckBox('Make Leg') optionLayout.addRow('', self.checkWidgetLeg) #アーム作成の可否 self.checkWidgetArm = QtWidgets.QCheckBox('Make Arm') optionLayout.addRow('', self.checkWidgetArm) #翼作成の可否 self.checkWidgetWing = QtWidgets.QCheckBox('Make Wing') optionLayout.addRow('', self.checkWidgetWing) #size of controller self.inputSize = QtWidgets.QSpinBox() self.inputSize.setRange(0, 1000) self.inputSize.setValue(5) optionLayout.addRow('Size', self.inputSize)
def __init__(self, options: List[OptionsBox] = None, parent: QtWidgets.QWidget = None): super().__init__(parent) self.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Expanding) self.stack = _ExportOptionsStack() self.stack.currentChanged.connect(self.currentIndexChanged) self.combo = QtWidgets.QComboBox() self.combo.currentIndexChanged.connect(self.stack.setCurrentIndex) if options is not None: for option in options: self.addOption(option) layout_form = QtWidgets.QFormLayout() if self.count() < 2: self.combo.setVisible(False) else: # pragma: no cover layout_form.addRow("Type:", self.combo) layout = QtWidgets.QVBoxLayout() layout.addLayout(layout_form) layout.addWidget(self.stack) self.setLayout(layout)
def createForm(self): # Add vertical layout to dock contents verticalLayout = QtWidgets.QVBoxLayout(self) verticalLayout.setContentsMargins(10, 10, 10, 10) # Add vertical layout to main widget (self) # verticalLayout.addWidget(self) self.setLayout(verticalLayout) # Add group box groupBox = QtWidgets.QGroupBox(self) # Add form layout to group box groupBoxFormLayout = QtWidgets.QFormLayout(groupBox) # Add elements to layout verticalLayout.addWidget(groupBox) self.num_widgets = 0 self.uiElements = { 'verticalLayout': verticalLayout, 'groupBox': groupBox, 'groupBoxFormLayout': groupBoxFormLayout } self.widgets = {}
def itemAeropython(self): form = QtWidgets.QFormLayout() label1 = QtWidgets.QLabel(u'Angle of attack (°)') self.aoa = QtWidgets.QDoubleSpinBox() self.aoa.setSingleStep(0.1) self.aoa.setDecimals(1) self.aoa.setRange(-10.0, 10.0) self.aoa.setValue(0.0) form.addRow(label1, self.aoa) label2 = QtWidgets.QLabel('Freestream velocity (m/s)') self.freestream = QtWidgets.QDoubleSpinBox() self.freestream.setSingleStep(0.1) self.freestream.setDecimals(2) self.freestream.setRange(0.0, 100.0) self.freestream.setValue(10.0) form.addRow(label2, self.freestream) label3 = QtWidgets.QLabel('Number of panels (-)') self.panels = QtWidgets.QSpinBox() self.panels.setRange(10, 500) self.panels.setValue(40) form.addRow(label3, self.panels) panelMethodButton = QtWidgets.QPushButton('Calculate lift coefficient') form.addRow(panelMethodButton) self.item_ap = QtWidgets.QGroupBox('AeroPython Panel Method') self.item_ap.setLayout(form) panelMethodButton.clicked.connect(self.runPanelMethod)
def __init__(self, parent=None): super(ImageSettings, self).__init__(parent) self.path = BrowseEdit() self.path.valueSet.connect(partial(self.optionSet.emit, 'image.path')) self.fit = BoolCombo(True) self.fit.valueSet.connect(partial(self.optionSet.emit, 'image.fit')) self.width = FloatEdit() method = partial(self.optionSet.emit, 'image.width') self.width.valueSet.connect(method) self.height = FloatEdit() method = partial(self.optionSet.emit, 'image.height') self.height.valueSet.connect(method) self.layout = QtWidgets.QFormLayout(self) self.layout.setSpacing(0) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setHorizontalSpacing(5) self.layout.addRow('Path', self.path) self.layout.addRow('Fit to shape', self.fit) self.layout.addRow('Width', self.width) self.layout.addRow('Height', self.height) for label in self.findChildren(QtWidgets.QLabel): if not isinstance(label, Title): label.setFixedWidth(LEFT_CELL_WIDTH)
def __init__(self): super(Demo, self).__init__() w = QtWidgets.QWidget(self) self.setCentralWidget(w) lyt = QtWidgets.QFormLayout(w) self.lyt = lyt lyt.setSpacing(20) w.setLayout(lyt) button1 = A2MoreButton(self) button1.menu_called.connect(self.build_a_menu) self.menu_called_count = 0 lyt.addRow('<b>A2MoreButton</b> with menu_called Signal:<br>' 'So the menu is always rebuilt', button1) button2 = A2MoreButton(self) button2.add_note('A disabled action') action = button2.add_action('An enabled one') action.triggered.connect(self.print_something) lyt.addRow('<b>A2MoreButton</b> with directly added actions:<br>' 'The menu is built once and just popps up', button2) button2.menu_called.connect(self.never_called_function) path_field = A2PathField(self) lyt.addRow(QtWidgets.QLabel('Path field with A2MoreButton implemented:')) lyt.addRow(path_field) bfield = A2ButtonField(self) bfield.setPlaceholderText('its empty!') menu = bfield.add_menu('even more') menu.addAction('this is an action') lyt.addRow(bfield)
def __init__(self, restoran, parent=None): super().__init__(parent) self.setWindowTitle("Dodaj pribor u korpu") self.vbox_layout = QtWidgets.QVBoxLayout() self.form_layout = QtWidgets.QFormLayout() with open('plugins/restoran/Restorani.csv') as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') line_count = 0 for row in csv_reader: if row[0] == restoran: cena = row[7] self.labelaCena = QtWidgets.QLabel(self) self.labelaCena.setText(cena) self.inputKolicina = QtWidgets.QPlainTextEdit(self) self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, parent=self) self.inputKolicina.setPlainText("0") self.form_layout.addRow("Cena :", self.labelaCena) self.form_layout.addRow("Kolicina :", self.inputKolicina) self.labelaCena.setMaximumHeight(20) self.inputKolicina.setMaximumHeight(20) self.vbox_layout.addLayout(self.form_layout) self.vbox_layout.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) self.setLayout(self.vbox_layout)
def setupUi(self, DurationEditor): DurationEditor.setObjectName("DurationEditor") DurationEditor.resize(400, 300) self.verticalLayout_2 = QtWidgets.QVBoxLayout(DurationEditor) self.verticalLayout_2.setObjectName("verticalLayout_2") self.layout = QtWidgets.QFormLayout() self.layout.setObjectName("layout") self.duration_edit_label = QtWidgets.QLabel(DurationEditor) self.duration_edit_label.setObjectName("duration_edit_label") self.layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.duration_edit_label) self.edit_layout = QtWidgets.QVBoxLayout() self.edit_layout.setObjectName("edit_layout") self.duration_edit = QtWidgets.QLineEdit(DurationEditor) self.duration_edit.setObjectName("duration_edit") self.edit_layout.addWidget(self.duration_edit) self.units_hint = QtWidgets.QLabel(DurationEditor) self.units_hint.setObjectName("units_hint") self.edit_layout.addWidget(self.units_hint) self.layout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.edit_layout) self.verticalLayout_2.addLayout(self.layout) self.retranslateUi(DurationEditor) QtCore.QMetaObject.connectSlotsByName(DurationEditor)
def __init__(self, parent=None , halaID=None ,proizvodNaziv = None , ProizvodID = None ): super().__init__(parent) self.this_naziv_proizvoda = proizvodNaziv self.this_proizvodID = ProizvodID self.this_halaID = halaID #iteracija kroz bazu --------------------------------------------------- #rashlladne_hale GET self._conn = konekcija_ka_bazi() self._c = self._conn.cursor() self.setWindowTitle("UKLONI FILM") self.resize(250, 180) self.vbox_layout = QtWidgets.QVBoxLayout() self.form_layout = QtWidgets.QFormLayout() self.proizvod_label = QtWidgets.QLabel(self) self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, parent=self) self.proizvod_label.setText(self.this_naziv_proizvoda) self.form_layout.addRow("FILM:", self.proizvod_label) self.vbox_layout.addLayout(self.form_layout) self.vbox_layout.addWidget(self.button_box) self.button_box.accepted.connect(self._on_accept) self.button_box.rejected.connect(self.reject) self.setLayout(self.vbox_layout)
def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle("CSV Graph") self.setWindowFlags(self.windowFlags() ^ QtCore.Qt.WindowContextHelpButtonHint) self.show() self.resize(200, 300) main_lay = QtWidgets.QVBoxLayout() horizontal_lay = QtWidgets.QHBoxLayout() self.path_line_edit = QtWidgets.QLineEdit() self.path_line_edit.setReadOnly(True) form_layout = QtWidgets.QFormLayout() form_layout.addRow("Path: ", self.path_line_edit) horizontal_lay.addLayout(form_layout) self.browse_btn = QtWidgets.QPushButton("Browse", clicked=self.browse_btn_clk) horizontal_lay.addWidget(self.browse_btn) main_lay.addLayout(horizontal_lay) self.calculate_btn = QtWidgets.QPushButton( "Calculate", clicked=self.calculate_btn_clk) main_lay.addWidget(self.calculate_btn) self.graph_widget = pg.PlotWidget() main_lay.addWidget(self.graph_widget) self.setLayout(main_lay)
def create_layout(self): asset_list_layout = QtWidgets.QHBoxLayout() asset_list_layout.addWidget(self.refresh_asset_list_button) asset_list_layout.addWidget(self.refresh_progress_bar) asset_list_layout.addWidget(self.cancel_refresh_asset_list_button) asset_list_layout.addStretch() asset_list_layout.addWidget(self.asset_list_label) asset_list_layout.addWidget(self.asset_list_cmb) details_layout = QtWidgets.QFormLayout() details_layout.addRow("Name:", self.name_le) details_layout.addRow("Description:", self.description_plaintext) details_layout.addRow("Creator:", self.creator_le) details_layout.addRow("Created:", self.created_date_le) details_layout.addRow("Modified:", self.modified_date_le) button_layout = QtWidgets.QHBoxLayout() button_layout.addStretch() button_layout.addWidget(self.edit_button) button_layout.addWidget(self.save_button) button_layout.addWidget(self.cancel_button) main_layout = QtWidgets.QVBoxLayout(self) main_layout.setContentsMargins(2, 2, 2, 2) main_layout.addLayout(asset_list_layout) main_layout.addWidget(self.preview_image_label) main_layout.addLayout(details_layout) main_layout.addLayout(button_layout)
def populate(self, parent): """Populate a parent widget with this parameter. :param parent: The parent widget to populate. :return: self. Do not override this method. Override :meth:`populate_subclass` which is called by this method appropriately. Each parameter consists of two default widgets: self.label and self.widget. The self.label is a QLabel that contains the self.name. The self.widget contains a self.layout, and the exact contents are configured by the derived class. Both widgets are added to the parent by calling the parent's layout.addRow(). """ layout = parent.layout() if layout is None: layout = QtWidgets.QFormLayout(parent) self.label = QtWidgets.QLabel(self.name, parent) if self.tooltip is not None: self.label.setToolTip(self.tooltip) self.widget_construct(parent) layout.addRow(self.label, self.widget) return self