def initGUI(self): #设置窗口大小 self.resize(580, 400) #设置窗口位置(下面配置的是居于屏幕中间) qr = self.frameGeometry() cp = QtWidgets.QDesktopWidget().availableGeometry().center() qr.moveCenter(cp) self.move(qr.topLeft()) #设置窗口标题和图标 self.setWindowTitle('editExcel1.0版') #######配置文件 #设置按钮 self.btn_pz = QtWidgets.QPushButton('添加配置文件路径', self) #大小 self.btn_pz.resize(150, 30) #位置 self.btn_pz.move(20, 20) #设置输入框 self.textbox_pz = Qt.QLineEdit(self) #大小 self.textbox_pz.resize(300, 30) #w位置 self.textbox_pz.move(210, 20) #点击鼠标触发事件 self.btn_pz.clicked.connect(self.select_pz_file_path) ######excel文件 #设置按钮 self.btn_excel = QtWidgets.QPushButton('添加excel文件路径', self) #大小 self.btn_excel.resize(150, 30) #位置 self.btn_excel.move(20, 70) #设置输入框 self.textbox_excel = Qt.QLineEdit(self) #大小 self.textbox_excel.resize(300, 30) #w位置 self.textbox_excel.move(210, 70) #点击鼠标触发事件 self.btn_excel.clicked.connect(self.select_excel_file_path) # 构建一个进度条 self.pbar = QProgressBar(self) # 从左上角30-50的界面,显示一个200*25的界面 self.pbar.setGeometry(70, 150, 450, 40) # 设置进度条的位置 ##执行button #设置按钮 self.btn_act = QtWidgets.QPushButton('执行', self) #大小 self.btn_act.resize(80, 50) #位置 self.btn_act.move(250, 220) self.btn_act.clicked.connect(self.thread_deal) #展示窗口 self.show()
def __init__(self, label, path, view): """Create item.""" super(Item, self).__init__() self.view = view self.label = Q.QLineEdit(view) self.label.setObjectName('cataview_item_{}_title'.format(label)) self.label.setReadOnly(True) self.label.setSizePolicy(Q.QSizePolicy.Minimum, Q.QSizePolicy.Fixed) self.path = Q.QLineEdit(view) self.path.setObjectName('cataview_item_{}_path'.format(label)) self.path.setReadOnly(True) self.path.setMinimumWidth(150) self.btn = Q.QPushButton(view) self.btn.setObjectName('cataview_item_{}_btn'.format(label)) self.btn.setIcon(load_icon("as_pic_delete.png")) gl = view.layout() row = gl.rowCount() gl.addWidget(self.label, row, 0) gl.addWidget(self.path, row, 1) gl.addWidget(self.btn, row, 2) self.btn.clicked.connect(self.remove) self.label.setText(label) self.label.home(False) self.label.setToolTip(label) self.path.setText(path) self.path.home(False) self.path.setToolTip(path)
def __init__(self, parent=None): super(LaueFormWidget, self).__init__(parent) self._result = None # Placeholder for results layout = Qt.QFormLayout(self) self._nCellsLineEdit = Qt.QLineEdit() layout.addRow("Number of unit cells:", self._nCellsLineEdit) self._oversamplingLineEdit = Qt.QLineEdit() layout.addRow("Oversampling:", self._oversamplingLineEdit) self._hLineEdit = Qt.QLineEdit() layout.addRow("H:", self._hLineEdit) self._kLineEdit = Qt.QLineEdit() layout.addRow("K:", self._kLineEdit) runPushButton = Qt.QPushButton("Run") runPushButton.clicked.connect(self.compute) layout.addRow(runPushButton) self._savePushButton = Qt.QPushButton("Save") self._savePushButton.clicked.connect(self.save) self._savePushButton.setEnabled(False) layout.addRow(self._savePushButton)
def __init__(self): SettingsTabBase.__init__(self, "Core") self.le_working_folder = Qt.QLineEdit() self.pb_working_browse = Qt.QPushButton(Qt.QIcon(":/folder.png"), "") self.pb_working_reset = Qt.QPushButton(Qt.QIcon(":/reset.png"), "") self.pb_working_browse.clicked.connect(self.browse_working_folder) self.pb_working_reset.clicked.connect(self.reset_working_folder) self.pb_always_on_top = Qt.QPushButton("Window always on top") self.pb_always_on_top.setCheckable(True) self.pb_check_for_updates = Qt.QPushButton("Check for updates") self.pb_check_for_updates.setCheckable(True) work_layout = Qt.QHBoxLayout() work_layout.addWidget(Qt.QLabel("File Folder: "), 0) work_layout.addWidget(self.le_working_folder, 1) work_layout.addWidget(self.pb_working_browse, 0) work_layout.addWidget(self.pb_working_reset, 0) bottom_layout = Qt.QHBoxLayout() bottom_layout.addWidget(self.pb_always_on_top) bottom_layout.addWidget(self.pb_check_for_updates) bottom_layout.addStretch() layout = Qt.QVBoxLayout() layout.addLayout(work_layout) layout.addLayout(bottom_layout) self.set_layout(layout)
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(518, 353) self.verticalLayout = QtGui.QVBoxLayout(Form) self.verticalLayout.setSizeConstraint( QtGui.QLayout.SetDefaultConstraint) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.label = QtGui.QLabel(Form) self.label.setWordWrap(True) self.label.setObjectName(_fromUtf8("label")) self.verticalLayout.addWidget(self.label) self.hboxlayout = QtGui.QHBoxLayout() self.hboxlayout.setObjectName(_fromUtf8("hboxlayout")) self.opt_wordconv_exe_path = QtGui.QLineEdit(Form) self.opt_wordconv_exe_path.setObjectName( _fromUtf8("opt_wordconv_exe_path")) self.hboxlayout.addWidget(self.opt_wordconv_exe_path) self.fileChoose = QtGui.QPushButton(Form) self.fileChoose.setObjectName(_fromUtf8("fileChoose")) self.fileChoose.clicked.connect(self.fileSearch) self.hboxlayout.addWidget(self.fileChoose) self.verticalLayout.addLayout(self.hboxlayout) self.opt_docx_no_cover = QtGui.QCheckBox(Form) self.opt_docx_no_cover.setObjectName(_fromUtf8("opt_docx_no_cover")) self.verticalLayout.addWidget(self.opt_docx_no_cover) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self, parent=None): Qt.QWidget.__init__(self, parent) self.label = Qt.QLabel() self.lineEdit = Qt.QLineEdit("ABCDE") self.fontComboBox = Qt.QFontComboBox() self.sizeSpinBox = Qt.QDoubleSpinBox() self.sizeSpinBox.setMinimum(1.0) self.sizeSpinBox.setValue(12.0) saveButton = Qt.QPushButton(self.tr("Save")) self.lineEdit.textChanged.connect(self.updateImage) self.fontComboBox.currentFontChanged.connect(self.updateImage) self.sizeSpinBox.valueChanged.connect(self.updateImage) saveButton.clicked.connect(self.saveImage) formLayout = Qt.QFormLayout() formLayout.addRow(self.tr("&Text:"), self.lineEdit) formLayout.addRow(self.tr("&Font:"), self.fontComboBox) formLayout.addRow(self.tr("Font &Size:"), self.sizeSpinBox) layout = Qt.QGridLayout() layout.addWidget(self.label, 0, 0, 1, 3, QtCore.Qt.AlignCenter) layout.addLayout(formLayout, 1, 0, 1, 3) layout.addWidget(saveButton, 2, 1) self.setLayout(layout) self.updateImage() self.setWindowTitle(self.tr("Paint Text"))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.setWindowTitle("Cute Fileserver Client") # Create a container object self._container = Qt.QWidget() self.setCentralWidget(self._container) # Create a grid self.grid = Qt.QGridLayout() # Create the ip address selection text field self.address_field = Qt.QLineEdit() self.address_field.setPlaceholderText("127.0.0.1:3001") self.grid.addWidget(self.address_field) # Create the connect button self.connect_btn = Qt.QPushButton() self.connect_btn.setText("Connect") self.connect_btn.clicked.connect(self.connect) self.grid.addWidget(self.connect_btn) # Create the file selection combobox self.file_selector = Qt.QComboBox() self.file_selector.setEnabled(False) self.grid.addWidget(self.file_selector) # Create the download button self.download_btn = Qt.QPushButton() self.download_btn.setText("Download") self.download_btn.setEnabled(False) self.download_btn.clicked.connect(self.download) self.grid.addWidget(self.download_btn) # Set the grid as layout self._container.setLayout(self.grid) # Extra data self.client_socket = None
def __init__(self, p, top): super().__init__(p) self.top = top self.choose_color = config['color'] self.setProperty('class', 'set') layer = qt.QVBoxLayout() self.server_cfg = qt.QFrame(self) layer_1 = CommonHBox() layer_1.addWidget(qt.QLabel('服务器', self.server_cfg)) self.server_input = qt.QLineEdit(config['server'], self.server_cfg) layer_1.addWidget(self.server_input) self.server_cfg.setLayout(layer_1) self.color_cfg = qt.QFrame(self) layer_2 = CommonHBox() layer_2.addWidget(qt.QLabel('主题', self.server_cfg)) self.white = qt.QPushButton(self.color_cfg) self.white.clicked.connect(self.set_white) self.white.setProperty('class', 'white') self.dracula = qt.QPushButton(self.color_cfg) self.dracula.clicked.connect(self.set_dracula) self.dracula.setProperty('class', 'dracula') layer_2.addWidget(self.white) layer_2.addWidget(self.dracula) self.color_cfg.setLayout(layer_2) self.save_btn = CommonBtn('保存', self) self.save_btn.clicked.connect(self.save) layer.addWidget(self.server_cfg) layer.addWidget(self.color_cfg) layer.addWidget(self.save_btn) self.setLayout(layer)
def __init__(self, app, parent): super().__init__(parent) question_data = parent.question_data statement_label = Qt.QLabel(question_data['statement'], self) statement_label.setFont(Qt.QFont('Arial', 20)) statement_label.setWordWrap(True) answer_title = Qt.QLabel('Ответ:', self) answer_title.setFont(Qt.QFont('Arial', 30)) answer_input = Qt.QLineEdit(self) answer_input.setFont(Qt.QFont('Arial', 20)) answer_input.setMinimumWidth(500) answer_input.setFocus() check_button = Qt.QPushButton('Проверить', self) check_button.setObjectName('Button') check_button.setFont(Qt.QFont('Arial', 20)) check_button.clicked.connect(lambda: app.send_submission( question_data['rowid'], answer_input.text())) answer_input.returnPressed.connect(check_button.click) self.lower_layout.addWidget(answer_title) self.lower_layout.addSpacerItem(Qt.QSpacerItem(20, 0)) self.lower_layout.addWidget(answer_input) self.lower_layout.addSpacerItem(Qt.QSpacerItem(20, 0)) self.lower_layout.addStretch(1) self.lower_layout.addWidget(check_button) self.layout.addWidget(statement_label) self.layout.addStretch(1)
def __init__(self, parent=None): super().__init__(parent) layout = Qt.QVBoxLayout(self) self.urlEdit = Qt.QLineEdit() self.urlEdit.setText('https://www.python.org/static/img/python-logo.png') layout.addWidget(self.urlEdit) self.imageLabel = Qt.QLabel("No image") self.imageLabel.setScaledContents(True) layout.addWidget(self.imageLabel) self.loadButton = Qt.QPushButton("Load") layout.addWidget(self.loadButton) self.loadButton.clicked.connect(self.on_load) # Создаем объект потока и привязываем его сигнал к слоту установки картинки self.thread = LoadImageThread() self.thread.about_new_image.connect(self.imageLabel.setPixmap) # Пока выполняется загрузка картинки, кнопка недоступна self.thread.started.connect(lambda: self.loadButton.setEnabled(False)) self.thread.finished.connect(lambda: self.loadButton.setEnabled(True))
def __init__(self, parent): super(PreferencesDlg, self).__init__(parent) self.settings = Qt.QSettings() layout = Qt.QVBoxLayout(self) layout.addWidget(Qt.QLabel(self.tr("WoW Install Folder:"), self)) folderlayout = Qt.QHBoxLayout() self.wowInstallFolder = Qt.QLineEdit(self.getWowFolder(), self) folderlayout.addWidget(self.wowInstallFolder) btn = Qt.QPushButton(self.tr("..."), self) btn.clicked.connect(self.browseForWoWFolder) folderlayout.addWidget(btn) layout.addLayout(folderlayout) layout.addWidget(Qt.QLabel(self.tr("Max. concurrent Threads:"), self)) self.maxthreads = Qt.QSpinBox(self) self.maxthreads.setMinimum(1) self.maxthreads.setMaximum(1000) self.maxthreads.setValue(self.getMaxThreads()) layout.addWidget(self.maxthreads) bottom = Qt.QHBoxLayout() bottom.addSpacing(100) btn = Qt.QPushButton(self.tr("Save"), self) btn.clicked.connect(self.accept) btn.setDefault(True) bottom.addWidget(btn) btn = Qt.QPushButton(self.tr("Cancel"), self) btn.clicked.connect(self.reject) bottom.addWidget(btn) layout.addSpacing(100) layout.addLayout(bottom) self.setLayout(layout)
def __init__(self): super().__init__() self.setGeometry(540, 65, 320, 200) self.setWindowTitle('MainWindow') self.labelMain = Qt.QLabel("Результат потоковой задачи WorkThreadMain: ") self.labelThread = Qt.QLabel("Результат Потоковой задачи WorkThread: ") validator = Qt.QIntValidator(1, 999, self) validator.setBottom(1) self.lineEdit = Qt.QLineEdit() self.lineEdit.setPlaceholderText("Начильный параметр для потоковой задачи WorkThread") # self.lineEdit будет принимать только целые числа от 1 до 999 self.lineEdit.setValidator(validator) self.btn = Qt.QPushButton("Start поток WorkThread") self.btn.clicked.connect(self.on_btn) self.btnMain = Qt.QPushButton("Запустить поток WorkThreadMain") self.btnMain.clicked.connect(self.on_btnMain) layout = Qt.QVBoxLayout(self) layout.addWidget(self.labelMain) layout.addWidget(self.labelThread) layout.addWidget(self.lineEdit) layout.addWidget(self.btn) layout.addWidget(self.btnMain) self.msg = MsgBox() self.thread = None self.threadMain = None
def _addFileItem(self, parent, title, setting, slot): """ Add file selection item. Arguments: parent (QWidget): Parent widget. title (str): Text label. setting (str): Preference item's identifier. slot (method): Slot to connect `Browse` button to. """ label = Q.QLabel(title, parent) _setObjName(label, "label", setting) editor = Q.QLineEdit(parent) _setObjName(editor, "edit", setting) btn = Q.QPushButton(translate("AsterStudy", "Browse..."), parent) _setObjName(btn, "btn", setting) hblayout = Q.QHBoxLayout() hblayout.addWidget(editor) hblayout.addWidget(btn) row = self._layout(parent).rowCount() self._layout(parent).addWidget(label, row, 0) self._layout(parent).addLayout(hblayout, row, 1) btn.editor = editor connect(btn.clicked, slot) self.widgets[setting] = editor
def add_row(self, row, name, unit, value_property, target_property, range_low, range_high): layout = self.layout() target_label = Qt.QLabel('Target {}:'.format(name)) target_label.setAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignVCenter) #target_label.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Expanding) layout.addWidget(target_label, row, 0) target = Qt.QLineEdit() target.setValidator( Qt.QDoubleValidator(range_low, range_high, 1, parent=self)) update = self.subscribe( target_property, callback=lambda value: target.setText(str(value))) def editing_finished(): try: value = float(target.text()) update(value) except Exception as e: Qt.QMessageBox.warning(self, 'Could not set {}'.format(name), e.args[0]) target.editingFinished.connect(editing_finished) layout.addWidget(target, row, 1) label = Qt.QLabel('{}\t{}: - {}'.format(unit, name, unit)) layout.addWidget(label, row, 2) self.subscribe(value_property, callback=lambda value: label.setText( '{}\t{}: {} {}'.format(unit, name, value, unit)), readonly=True)
def __init__(self, parent, availableAddons): super(AddAddonDlg, self).__init__(parent) box = Qt.QVBoxLayout(self) box.addWidget( Qt.QLabel( self.tr("Type name or url of the addon you want to add:"), self)) self.input = Qt.QLineEdit(self) box.addWidget(self.input) btnBox = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel) btnBox.accepted.connect(self.accept) btnBox.rejected.connect(self.reject) box.addWidget(btnBox) self.show() if len(availableAddons) > 0: self.completer = Qt.QCompleter( [addon[0] for addon in availableAddons], self) self.completer.setFilterMode(Qt.Qt.MatchContains) self.completer.setCaseSensitivity(Qt.Qt.CaseInsensitive) self.input.setCompleter(self.completer) else: Qt.QMessageBox.information( self, self.tr("No addon catalog data"), self. tr("You haven't updated the available addons catalog, " "so you need to insert a URL for the addon you want to add." ))
def _init_toolbars(self): self.main_view_toolbar = self.addToolBar('Image') self.zoom_editor = Qt.QLineEdit() self.zoom_editor.setAlignment(Qt.Qt.AlignCenter) w = self.zoom_editor.fontMetrics().boundingRect('0000.0%').width() self.zoom_editor.setFixedWidth(w + 14) self.zoom_editor.editingFinished.connect( self._on_zoom_editing_finished) self.zoom_editor.setAlignment(Qt.Qt.AlignCenter) self.main_view_toolbar.addWidget(self.zoom_editor) self.image_view.zoom_changed.connect(self._image_view_zoom_changed) self.main_view_toolbar.addAction(self.image_view.zoom_to_fit_action) self.main_view_toolbar.addAction( self.layer_stack_reset_curr_min_max_action) self.main_view_toolbar.addAction( self.layer_stack_reset_curr_gamma_action) self.main_view_toolbar.addAction( self.layer_stack.auto_min_max_all_action) self.main_view_toolbar.addAction( self.layer_stack.solo_layer_mode_action) if freeimage is not None: self.main_view_toolbar.addAction(self.snapshot_action) self.dock_widget_visibility_toolbar = self.addToolBar( 'Dock Widget Visibility') self.dock_widget_visibility_toolbar.addAction( self.layer_table_dock_widget.toggleViewAction()) self.dock_widget_visibility_toolbar.addAction( self.histogram_dock_widget.toggleViewAction()) self.dock_widget_visibility_toolbar.addAction( self.flipbook_dock_widget.toggleViewAction())
def make_numeric_widget(self, property, type): widget = Qt.QLineEdit() widget.setValidator(self.get_numeric_validator(property, type)) update = self.subscribe( self.PROPERTY_ROOT + property, callback=lambda value: widget.setText(str(value))) if update is None: raise TypeError('{} is not a writable property!'.format(property)) coerce_type = int if type == 'Int' else float def editing_finished(): try: value = coerce_type(widget.text()) update(value) except ValueError as e: # from the coercion Qt.QMessageBox.warning(self, 'Invalid Value', e.args[0]) except rpc_client.RPCError as e: # from the update if e.args[0].find('OUTOFRANGE') != -1: min, max = getattr(self.scope.camera, property + '_range') if min is None: min = '?' if max is None: max = '?' error = 'Given the camera state, {} must be in the range [{}, {}].'.format( property, min, max) elif e.args[0].find('NOTWRITABLE') != -1: error = 'Given the camera state, {} is not modifiable.'.format( property) else: error = 'Could not set {} ({}).'.format( property, e.args[0]) Qt.QMessageBox.warning(self, 'Invalid Value', error) widget.editingFinished.connect(editing_finished) return widget
def setup_ui(self) -> None: layout = Qt.QHBoxLayout(self) layout.setObjectName('DebugToolbar.setup_ui.layout') layout.setContentsMargins(0, 0, 0, 0) self.test_button = Qt.QPushButton(self) self.test_button.setText('Test') layout.addWidget(self.test_button) self.break_button = Qt.QPushButton(self) self.break_button.setText('Break') layout.addWidget(self.break_button) self.exec_lineedit = Qt.QLineEdit(self) self.exec_lineedit.setPlaceholderText( 'Python statement in context of DebugToolbar.exec_button_clicked()' ) layout.addWidget(self.exec_lineedit) self.exec_button = Qt.QPushButton(self) self.exec_button.setText('Exec') layout.addWidget(self.exec_button) layout.addStretch() self.toggle_button.setVisible(False)
def __init__(self, **kwargs): super().__init__(**kwargs) self.setFixedSize(275, 90) self.setWindowTitle('Annotation Note Field') self.notebox = Qt.QLineEdit(self) self.notebox.move(5, 5) self.notebox.setFixedSize(265, 80)
def __init__(self, parent, mode): super(ColorMapSettingsView, self).__init__(parent) self.max_value = 100.0 self.min_value = 0.0 self.currentData = mode # Initiation of button / lineedit / label widgets self.button_update_lookup_table = Qt.QPushButton('Activate color map') self.button_update_lookup_table.clicked.connect( self.adaptColormapMinMax) self.label_min_value = Qt.QLabel(self) self.label_min_value.setText('Min value (yellow):') self.label_min_value.setFixedWidth(125) self.label_max_value = Qt.QLabel(self) self.label_max_value.setText('Max value (red):') self.label_max_value.setFixedWidth(125) self.lineedit_min_value = Qt.QLineEdit(self) self.lineedit_min_value.setText(str(self.min_value)) self.lineedit_max_value = Qt.QLineEdit(self) self.lineedit_max_value.setText(str(self.max_value)) self.checkbox_scalar_bar = Qt.QCheckBox("Show scalar bar", self) self.checkbox_scalar_bar.setChecked(False) self.checkbox_scalar_bar.stateChanged.connect( self.functionCheckboxScalarBar) # Boxlayout self.frame = Qt.QFrame() self.vl = Qt.QVBoxLayout() self.frame.setLayout(self.vl) self.setCentralWidget(self.frame) self.hl_min_value = Qt.QHBoxLayout() self.hl_min_value.addWidget(self.label_min_value) self.hl_min_value.addWidget(self.lineedit_min_value) self.hl_max_value = Qt.QHBoxLayout() self.hl_max_value.addWidget(self.label_max_value) self.hl_max_value.addWidget(self.lineedit_max_value) self.vl.addLayout(self.hl_min_value) self.vl.addLayout(self.hl_max_value) self.vl.addWidget(self.checkbox_scalar_bar) self.vl.addWidget(self.button_update_lookup_table)
def __init__(self): super().__init__() self.setWindowTitle('xml_html__xpath__css_selector__gui') self.le_xpath_css = Qt.QLineEdit() self.rb_xpath = Qt.QRadioButton('XPath') self.rb_css_selector = Qt.QRadioButton('CSS selector') self.rb_css_selector.setChecked(True) self.text_edit_input = Qt.QPlainTextEdit() self.text_edit_output = Qt.QPlainTextEdit() self.label_error = Qt.QLabel() self.label_error.setStyleSheet("QLabel { color : red; }") self.label_error.setTextInteractionFlags(Qt.Qt.TextSelectableByMouse) self.label_error.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Preferred) self.button_detail_error = Qt.QPushButton('...') self.button_detail_error.setFixedSize(20, 20) self.button_detail_error.setToolTip('Detail error') self.button_detail_error.hide() self.last_error_message = None self.last_detail_error_message = None self.le_xpath_css.textEdited.connect(self.on_process) self.rb_xpath.clicked.connect(self.on_process) self.rb_css_selector.clicked.connect(self.on_process) self.text_edit_input.textChanged.connect(self.on_process) self.button_detail_error.clicked.connect( self.show_detail_error_message) splitter = Qt.QSplitter() splitter.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Expanding) splitter.addWidget(self.text_edit_input) splitter.addWidget(self.text_edit_output) layout_xpath_css = Qt.QHBoxLayout() layout_xpath_css.addWidget(self.le_xpath_css) layout_xpath_css.addWidget(self.rb_xpath) layout_xpath_css.addWidget(self.rb_css_selector) layout = Qt.QVBoxLayout() layout.addLayout(layout_xpath_css) layout.addWidget(splitter) layout_error = Qt.QHBoxLayout() layout_error.addWidget(self.label_error) layout_error.addWidget(self.button_detail_error) layout.addLayout(layout_error) self.setLayout(layout)
def init_widgets(self): lbl_width = 45 val_width = 125 lbl_height = 12 #Device devLabel = Qt.QLabel("Device:") devLabel.setAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignVCenter) devLabel.setStyleSheet("QLabel {font:10pt; color:rgb(255,0,0);}") devLabel.setFixedWidth(lbl_width) self.devTextBox = Qt.QLineEdit() self.devTextBox.setText("/dev/ttyUSB0") self.devTextBox.setEchoMode(Qt.QLineEdit.Normal) self.devTextBox.setStyleSheet( "QLineEdit {font:10pt; background-color:rgb(200,75,75); color:rgb(0,0,0);}" ) self.devTextBox.setFixedWidth(val_width) self.devTextBox.setFixedHeight(20) dev_hbox = Qt.QHBoxLayout() dev_hbox.addWidget(devLabel) dev_hbox.addWidget(self.devTextBox) #Connection Button & Connection Status self.connect_button = Qt.QPushButton("Connect") self.connect_button.setStyleSheet( "QPushButton {font:10pt; background-color:rgb(200,0,0);}") self.connect_button.setFixedHeight(20) self.connect_button.setFixedWidth(100) btn_hbox = Qt.QHBoxLayout() btn_hbox.addStretch(1) btn_hbox.addWidget(self.connect_button) btn_hbox.addStretch(1) status_lbl = Qt.QLabel('Status:') status_lbl.setAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignVCenter) status_lbl.setStyleSheet("QLabel {font:10pt; color:rgb(255,0,0);}") status_lbl.setFixedHeight(lbl_height) status_lbl.setFixedWidth(lbl_width) self.conn_status_lbl = Qt.QLabel('Disconnected') self.conn_status_lbl.setAlignment(Qt.Qt.AlignLeft | Qt.Qt.AlignVCenter) self.conn_status_lbl.setStyleSheet( "QLabel {font:10pt; font-weight:bold; color:rgb(255,0,0);}") self.conn_status_lbl.setFixedWidth(val_width) self.conn_status_lbl.setFixedHeight(lbl_height) status_hbox = Qt.QHBoxLayout() status_hbox.addWidget(status_lbl) status_hbox.addWidget(self.conn_status_lbl) vbox = Qt.QVBoxLayout() vbox.addLayout(dev_hbox) vbox.addLayout(status_hbox) vbox.addLayout(btn_hbox) vbox.addStretch(1) self.setLayout(vbox)
def __init__(self, layout, label_text): super().__init__() self.ignore_change = internal_util.Condition() self.label = Qt.QLabel(label_text) layout.addWidget(self.label) self.editbox = Qt.QLineEdit() self.editbox.editingFinished.connect(self._on_editbox_editing_finished) layout.addWidget(self.editbox) self.setEnabled(False) self._value = None
def __init__(self, *args, **kwargs): super(LaueFormWidget, self).__init__(*args, **kwargs) layout = Qt.QFormLayout(self) self._nCellsLineEdit = Qt.QLineEdit(self) layout.addRow("Number of unit cells:", self._nCellsLineEdit) self._oversamplingLineEdit = Qt.QLineEdit(self) layout.addRow("Oversampling:", self._oversamplingLineEdit) self._hLineEdit = Qt.QLineEdit(self) layout.addRow("H:", self._hLineEdit) self._kLineEdit = Qt.QLineEdit(self) layout.addRow("K:", self._kLineEdit) pushButton = Qt.QPushButton("Run and Save", self) pushButton.clicked.connect(self._runAndSaveClicked) layout.addRow(pushButton)
def __init__(self, parent=None): super(LaueFormWidget, self).__init__(parent) layout = Qt.QFormLayout(self) self._nCellsLineEdit = Qt.QLineEdit(self) layout.addRow("Number of unit cells:", self._nCellsLineEdit) self._oversamplingLineEdit = Qt.QLineEdit(self) layout.addRow("Oversampling:", self._oversamplingLineEdit) self._hLineEdit = Qt.QLineEdit(self) layout.addRow("H:", self._hLineEdit) self._kLineEdit = Qt.QLineEdit(self) layout.addRow("K:", self._kLineEdit) pushButton = Qt.QPushButton("Run and Save", self) pushButton.clicked.connect(self.compute) layout.addRow(pushButton)
def __init__(self): super().__init__() self.line_edit = Qt.QLineEdit() self.line_edit.textChanged.connect(self.on_text_changed) layout = Qt.QVBoxLayout() layout.addWidget(self.line_edit) self.setLayout(layout)
def setup_ui(self) -> None: layout = Qt.QVBoxLayout(self) layout.setObjectName('SceningListDialog.setup_ui.layout') self.name_lineedit = Qt.QLineEdit(self) layout.addWidget(self.name_lineedit) self.tableview = Qt.QTableView(self) self.tableview.setSelectionMode(Qt.QTableView.SingleSelection) self.tableview.setSelectionBehavior(Qt.QTableView.SelectRows) self.tableview.setSizeAdjustPolicy(Qt.QTableView.AdjustToContents) layout.addWidget(self.tableview) scene_layout = Qt.QHBoxLayout() scene_layout.setObjectName('SceningListDialog.setup_ui.scene_layout') layout.addLayout(scene_layout) self.start_frame_control = FrameEdit[Frame](self) scene_layout.addWidget(self.start_frame_control) self.end_frame_control = FrameEdit[Frame](self) scene_layout.addWidget(self.end_frame_control) self.start_time_control = TimeEdit[Time](self) scene_layout.addWidget(self.start_time_control) self.end_time_control = TimeEdit[Time](self) scene_layout.addWidget(self.end_time_control) self.label_lineedit = Qt.QLineEdit(self) self.label_lineedit.setPlaceholderText('Label') scene_layout.addWidget(self.label_lineedit) buttons_layout = Qt.QHBoxLayout() buttons_layout.setObjectName( 'SceningListDialog.setup_ui.buttons_layout') layout.addLayout(buttons_layout) self.delete_button = Qt.QPushButton(self) self.delete_button.setAutoDefault(False) self.delete_button.setText('Delete Selected Scene') self.delete_button.setEnabled(False) buttons_layout.addWidget(self.delete_button)
def init_ui(self): layout = Qt.QHBoxLayout() self.__current_password_input = Qt.QLineEdit("") self.__current_password_input.textChanged.connect( self.verify_current_password) self.__current_password_input.textChanged.connect( self.update_ok_button) lbl_current = Qt.QLabel(u"&Current password:"******"") self.__new_password_input.textChanged.connect(self.verify_new_password) self.__new_password_input.textChanged.connect(self.update_ok_button) lbl_new = Qt.QLabel(u"&New password:"******"") self.__verify_password_input.textChanged.connect( self.verify_new_password) self.__verify_password_input.textChanged.connect(self.update_ok_button) lbl_verify = Qt.QLabel(u"&Verify password:") lbl_verify.setBuddy(self.__verify_password_input) grid_layout = Qt.QGridLayout() grid_layout.addWidget(lbl_current, 0, 0) grid_layout.addWidget(self.__current_password_input, 0, 1) grid_layout.addWidget(lbl_new, 1, 0) grid_layout.addWidget(self.__new_password_input, 1, 1) grid_layout.addWidget(lbl_verify, 2, 0) grid_layout.addWidget(self.__verify_password_input, 2, 1) self.__ok_cancel = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel) self.__ok_cancel.setOrientation(Qt.Qt.Vertical) self.__ok_cancel.accepted.connect(self.accept) self.__ok_cancel.rejected.connect(self.reject) layout.addLayout(grid_layout) layout.addWidget(self.__ok_cancel) self.setLayout(layout)
def __init__(self, parent=None): """ Create dialog. """ super(SetupCatalog, self).__init__(parent) title = translate("CatalogsView", "Set-up catalogue") self.setWindowTitle(title) gl = Q.QGridLayout(self.main()) gl.setContentsMargins(0, 0, 0, 0) title = translate("CatalogsView", "Label") gl.addWidget(Q.QLabel(title, self.main()), 0, 0) self.label = Q.QLineEdit(self.main()) self.label.setObjectName('cataview_setup_catalog_title') gl.addWidget(self.label, 0, 1) title = translate("CatalogsView", "Location") gl.addWidget(Q.QLabel(title, self.main()), 1, 0) self.path = Q.QLineEdit(self.main()) self.path.setObjectName('cataview_setup_catalog_path') self.path.setMinimumWidth(200) self.path.setCompleter(Q.QCompleter()) model = Q.QDirModel() model.setFilter(Q.QDir.Drives | Q.QDir.Dirs | Q.QDir.NoDotAndDotDot) self.path.completer().setModel(model) gl.addWidget(self.path, 1, 1, 1, 2) title = translate("AsterStudy", "Browse...") btn = Q.QPushButton(title, self.main()) btn.setObjectName('cataview_setup_catalog_browse_btn') gl.addWidget(btn, 1, 3) gl.setColumnStretch(2, 5) btn.clicked.connect(self._browse) self.label.setFocus()
def __init__(self, *args, **kwargs): super(LaueFormWidget, self).__init__(*args, **kwargs) self._processingThread = None # Placeholder for thread layout = Qt.QFormLayout(self) self._nCellsLineEdit = Qt.QLineEdit(self) layout.addRow("Number of unit cells:", self._nCellsLineEdit) self._oversamplingLineEdit = Qt.QLineEdit(self) layout.addRow("Oversampling:", self._oversamplingLineEdit) self._hLineEdit = Qt.QLineEdit(self) layout.addRow("H:", self._hLineEdit) self._kLineEdit = Qt.QLineEdit(self) layout.addRow("K:", self._kLineEdit) self._pushButton = Qt.QPushButton(self._RUN_AND_SAVE, self) self._pushButton.clicked.connect(self._runAndSaveClicked) layout.addRow(self._pushButton) self._sigProcessingDone.connect(self._processingDone)