def __init__(self, window=None, **kwargs): super(SelectUser, self).__init__(window) layout = QFormLayout(self) self.email = QLineEdit(self) fm = self.email.fontMetrics() self.email.setMaximumWidth(30 * fm.maxWidth() + 11) self.email.setText(kwargs.get("uid", kwargs.get("email", ""))) layout.addRow("&User ID:", self.email) self.pwd = QLineEdit(self) self.pwd.setEchoMode(QLineEdit.Password) fm = self.pwd.fontMetrics() self.pwd.setMaximumWidth(30 * fm.width('*') + 11) self.pwd.setText(kwargs.get("password", "")) layout.addRow("&Password:"******"&Save Credentials (unsafe)") self.savecreds.setChecked(kwargs.get("savecredentials", False)) layout.addRow(self.savecreds) self.buttonbox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) self.buttonbox.accepted.connect(self.authenticate) self.buttonbox.rejected.connect(self.reject) layout.addRow(self.buttonbox) self.setLayout(layout)
def __init__(self, parent: QWidget, filename: str, torrent_info: TorrentInfo): super().__init__(parent) self.parent = parent #parent.torrent_added.emit(torrent_info) self._torrent_info = torrent_info # download_info = torrent_info.download_info vbox = QVBoxLayout(self) vbox.addWidget(QLabel('Download directory:')) vbox.addWidget(self._get_directory_browse_widget()) self._button_box = QDialogButtonBox(self) self._button_box.setOrientation(Qt.Horizontal) self._button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self._button_box.button(QDialogButtonBox.Ok).clicked.connect( self.submit_torrent) self._button_box.button(QDialogButtonBox.Cancel).clicked.connect( self.close) vbox.addWidget(self._button_box) self.setFixedSize(450, 550) self.setWindowTitle('Adding "{}"'.format(filename))
def step2_layout(self): step2_groupBox = QGroupBox("Step 2") step2_layout = QVBoxLayout() step2_groupBox.setLayout(step2_layout) self.question1 = Label({'txt': "Question 1"}) self.question2 = Label({'txt': "Question 2"}) self.answer1 = QLineEdit() self.answer2 = QLineEdit() step2_btn_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) step2_btn_box.accepted.connect(self.on_step2_btn_clicked) step2_btn_box.rejected.connect(self.close) step2_layout.addWidget(self.question1) step2_layout.addWidget(self.answer1) step2_layout.addWidget(self.question2) step2_layout.addWidget(self.answer2) step2_layout.addWidget(step2_btn_box) return step2_groupBox
def __init__(self, parent=None, init_text=''): super(TextDialog, self).__init__(parent) layout = QVBoxLayout(self) ''' # nice widget for editing the date self.datetime = QDateTimeEdit(self) self.datetime.setCalendarPopup(True) self.datetime.setDateTime(QDateTime.currentDateTime()) layout.addWidget(self.datetime) ''' self.edit_capton = QLineEdit(self) self.edit_capton.setText(init_text) layout.addWidget(self.edit_capton) # OK and Cancel buttons self.buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject)
def setupUi(self, Dialog): Dialog.resize(640, 165) Dialog.setWindowTitle("Add Bookmark") self.gridLayout = QGridLayout(Dialog) self.label = QLabel(Dialog) self.label.setText("Title :") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.titleEdit = QLineEdit(Dialog) self.gridLayout.addWidget(self.titleEdit, 0, 1, 1, 1) self.label_2 = QLabel(Dialog) self.label_2.setText("Address :") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.addressEdit = QLineEdit(Dialog) self.gridLayout.addWidget(self.addressEdit, 1, 1, 1, 1) self.buttonBox = QDialogButtonBox(Dialog) self.buttonBox.setLayoutDirection(QtCore.Qt.LeftToRight) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Save) self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 2) self.buttonBox.accepted.connect(Dialog.accept) self.buttonBox.rejected.connect(Dialog.reject)
def __init__(self, topLevelOperator, parent): super(QDialog, self).__init__(parent=parent) self.topLevelOperator = topLevelOperator buttonbox = QDialogButtonBox(Qt.Horizontal, parent=self) buttonbox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonbox.accepted.connect(self.add_Parameters) buttonbox.rejected.connect(self.reject) self.halo_edit = QLineEdit(self) self.halo_edit.setPlaceholderText("HaloSize") self.batch_edit = QLineEdit(self) self.batch_edit.setPlaceholderText("Batch Size") layout = QVBoxLayout() layout.addWidget(self.halo_edit) layout.addWidget(self.batch_edit) layout.addWidget(buttonbox) self.setLayout(layout) self.setWindowTitle("Set Parameters")
def passwordmenu(self): self.passdialog = QDialog(self) self.passlayout = QFormLayout() self.passlbl = QLabel("Password :") self.passle = QLineEdit() self.passle.setEchoMode(QLineEdit.Password) self.passbtnbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.passbtnbox.accepted.connect(self.passaccept) self.passbtnbox.rejected.connect(self.passdialogclose) self.passdialog.setLayout(self.passlayout) self.passlayout.addRow(self.passlbl) self.passlayout.addRow(self.passle) self.passlayout.addRow(self.passbtnbox) self.passdialog.show()
def __setupUi(self): layout = QVBoxLayout() label = QLabel(self) pixmap, _ = config.splash_screen() label.setPixmap(pixmap) layout.addWidget(label, Qt.AlignCenter) try: from Orange.version import version from Orange.version import git_revision except ImportError: dist = pkg_resources.get_distribution("Orange3") version = dist.version git_revision = "Unknown" text = ABOUT_TEMPLATE.format(version=version, git_revision=git_revision[:7]) # TODO: Also list all known add-on versions. text_label = QLabel(text) layout.addWidget(text_label, Qt.AlignCenter) buttons = QDialogButtonBox(QDialogButtonBox.Close, Qt.Horizontal, self) layout.addWidget(buttons) buttons.rejected.connect(self.accept) layout.setSizeConstraint(QVBoxLayout.SetFixedSize) self.setLayout(layout)
def deleteEntry_popup(self): orderGroupBox = QGroupBox("Headstone To Delete") tablename = QComboBox() tablename.addItems(db.getTables()) hid = QComboBox() hid.addItems(db.getIDs(tablename.currentText())) layout = QFormLayout() layout.addRow(QLabel("Table"), tablename) layout.addRow(QLabel("ID"), hid) orderGroupBox.setLayout(layout) orderButtonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) mainOrderLayout = QVBoxLayout() central_widget = QWidget() central_widget.setLayout(mainOrderLayout) mainOrderLayout.addWidget(orderGroupBox) mainOrderLayout.addWidget(orderButtonBox) self.setCentralWidget(central_widget) self.show() orderButtonBox.accepted.connect( lambda: db.deleteEntry(tablename.currentText(), hid.currentText())) orderButtonBox.accepted.connect(self.close) orderButtonBox.rejected.connect(self.close)
def __init__(self): super().__init__() self.top = 200 self.left = 500 self.width = 400 self.height = 300 self.setGeometry(self.left, self.top, self.width, self.height) self.setWindowTitle('PyQt5 Tab Widget') self.setWindowIcon(QIcon("icon.png")) vbox = QVBoxLayout() tabWidget = QTabWidget() buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) tabWidget.addTab(TabContact(), "Contact Details") tabWidget.addTab(TabPersonDetails(), "Person Details") vbox.addWidget(tabWidget) vbox.addWidget(buttonbox) self.setLayout(vbox)
def __init__(self, parent, path): super().__init__(parent, Qt.WindowCloseButtonHint | Qt.WindowSystemMenuHint) self.path = path self.setWindowTitle(self.tr("Select columns")) self.hlayout = QHBoxLayout() buttonBox = QDialogButtonBox(Qt.Horizontal) buttonBox.addButton(QDialogButtonBox.Ok) buttonBox.accepted.connect(self.accept) self.table = QTableWidget(self) self.table.setEditTriggers(QTableWidget.NoEditTriggers) layout = QVBoxLayout() layout.addLayout(self.hlayout) layout.addWidget(self.table) layout.addWidget(buttonBox) self.setLayout(layout)
def __init__(self, parent=None, currentSettings=None): super(SettingsDialog, self).__init__(parent) self.setWindowTitle("Settings") layout = QFormLayout(self) self.projectName = QLineEdit("", self) self.roomWidth = QSpinBox(self) self.roomWidth.setMinimum(1) self.roomWidth.setMaximum(2000) self.roomHeight = QSpinBox(self) self.roomHeight.setMinimum(1) self.roomHeight.setMaximum(2000) self.gridSize = QSpinBox(self) self.gridSize.setMinimum(1) self.dancerWidth = QSpinBox(self) self.dancerWidth.setMinimum(1) layout.addRow("Project name", self.projectName) layout.addRow("Room width", self.roomWidth) layout.addRow("Room height", self.roomHeight) layout.addRow("Grid size", self.gridSize) layout.addRow("Dancer size", self.dancerWidth) # OK and Cancel buttons buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons) if currentSettings: self.setDefaults(currentSettings)
def __init__(self): super(DropSiteWindow, self).__init__() self.abstractLabel = QLabel( "This example accepts drags from other applications and " "displays the MIME types provided by the drag object.") self.abstractLabel.setWordWrap(True) self.abstractLabel.adjustSize() self.dropArea = DropArea() self.dropArea.changed.connect(self.updateFormatsTable) self.formatsTable = QTableWidget() self.formatsTable.setColumnCount(2) self.formatsTable.setEditTriggers(QAbstractItemView.NoEditTriggers) self.formatsTable.setHorizontalHeaderLabels(["Format", "Content"]) self.formatsTable.horizontalHeader().setStretchLastSection(True) self.clearButton = QPushButton("Clear") self.quitButton = QPushButton("Quit") self.buttonBox = QDialogButtonBox() self.buttonBox.addButton(self.clearButton, QDialogButtonBox.ActionRole) self.buttonBox.addButton(self.quitButton, QDialogButtonBox.RejectRole) self.quitButton.pressed.connect(self.close) self.clearButton.pressed.connect(self.dropArea.clear) mainLayout = QVBoxLayout() mainLayout.addWidget(self.abstractLabel) mainLayout.addWidget(self.dropArea) mainLayout.addWidget(self.formatsTable) mainLayout.addWidget(self.buttonBox) self.setLayout(mainLayout) self.setWindowTitle("Drop Site") self.setMinimumSize(350, 500)
def __init__(self, parent): super(NewFolderWindow, self).__init__() self.parent = parent self.setWindowTitle("Gridsync - Add New Sync Folder") self.resize(500, 225) self.layout = QVBoxLayout(self) self.folder = None layout = QVBoxLayout() grid_group_box = QGroupBox(self) grid_group_box.setTitle("Select remote storage grid to use:") grid_layout = QHBoxLayout(grid_group_box) self.grid_combo_box = QComboBox(grid_group_box) self.populate_combo_box() grid_layout.addWidget(self.grid_combo_box) layout.addWidget(grid_group_box) folder_group_box = QGroupBox(self) folder_group_box.setTitle("Select local folder to sync:") folder_layout = QHBoxLayout(folder_group_box) self.folder_text = QLineEdit(folder_group_box) folder_layout.addWidget(self.folder_text) folder_button = QPushButton(folder_group_box) folder_button.setText("Browse...") folder_button.clicked.connect(self.get_folder) folder_layout.addWidget(folder_button) layout.addWidget(folder_group_box) self.layout.addLayout(layout) button_box = QDialogButtonBox(self) button_box.setStandardButtons( QDialogButtonBox.Cancel | QDialogButtonBox.Ok) button_box.rejected.connect(self.close) button_box.accepted.connect(self.create_new_folder) self.layout.addWidget(button_box)
def __init__(self, theParent, theProject): QDialog.__init__(self, theParent) logger.debug("Initialising ConfigEditor ...") self.mainConf = nw.CONFIG self.theParent = theParent self.theProject = theProject self.outerBox = QHBoxLayout() self.innerBox = QVBoxLayout() self.setWindowTitle("Preferences") self.guiDeco = self.theParent.theTheme.loadDecoration("settings",(64,64)) self.tabMain = GuiConfigEditGeneral(self.theParent) self.tabEditor = GuiConfigEditEditor(self.theParent) self.tabWidget = QTabWidget() self.tabWidget.addTab(self.tabMain, "General") self.tabWidget.addTab(self.tabEditor, "Editor") self.setLayout(self.outerBox) self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop) self.outerBox.addLayout(self.innerBox) self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonBox.accepted.connect(self._doSave) self.buttonBox.rejected.connect(self._doClose) self.innerBox.addWidget(self.tabWidget) self.innerBox.addWidget(self.buttonBox) self.show() logger.debug("ConfigEditor initialisation complete") return
def setup(self, log, settings, packages, mode, device_list): self.setMinimumSize(600, 400) self.setWindowTitle(_("Mu Administration")) widget_layout = QVBoxLayout() self.setLayout(widget_layout) self.tabs = QTabWidget() widget_layout.addWidget(self.tabs) button_box = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel ) button_box.accepted.connect(self.accept) button_box.rejected.connect(self.reject) widget_layout.addWidget(button_box) # Tabs self.log_widget = LogWidget(self) self.log_widget.setup(log) self.tabs.addTab(self.log_widget, _("Current Log")) if mode.short_name in ["python", "web", "pygamezero"]: self.envar_widget = EnvironmentVariablesWidget(self) self.envar_widget.setup(settings.get("envars", "")) self.tabs.addTab(self.envar_widget, _("Python3 Environment")) if mode.short_name == "microbit": self.microbit_widget = MicrobitSettingsWidget(self) self.microbit_widget.setup( settings.get("minify", False), settings.get("microbit_runtime", ""), ) self.tabs.addTab(self.microbit_widget, _("BBC micro:bit Settings")) if mode.short_name in ["python", "web", "pygamezero"]: self.package_widget = PackagesWidget(self) self.package_widget.setup(packages) self.tabs.addTab(self.package_widget, _("Third Party Packages")) if mode.short_name == "esp": self.esp_widget = ESPFirmwareFlasherWidget(self) self.esp_widget.setup(mode, device_list) self.tabs.addTab(self.esp_widget, _("ESP Firmware flasher")) self.log_widget.log_text_area.setFocus()
def __init__(self): super(TahoeConfigForm, self).__init__() self.rootcap = None self.settings = {} self.progress = None self.animation = None self.crypter = None self.crypter_thread = None self.connection_settings = ConnectionSettings() self.encoding_parameters = EncodingParameters() self.restore_selector = RestoreSelector(self) connection_settings_gbox = QGroupBox(self) connection_settings_gbox.setTitle("Connection settings:") connection_settings_gbox_layout = QGridLayout(connection_settings_gbox) connection_settings_gbox_layout.addWidget(self.connection_settings) encoding_parameters_gbox = QGroupBox(self) encoding_parameters_gbox.setTitle("Encoding parameters:") encoding_parameters_gbox_layout = QGridLayout(encoding_parameters_gbox) encoding_parameters_gbox_layout.addWidget(self.encoding_parameters) restore_selector_gbox = QGroupBox(self) restore_selector_gbox.setTitle("Import from Recovery Key:") restore_selector_gbox_layout = QGridLayout(restore_selector_gbox) restore_selector_gbox_layout.addWidget(self.restore_selector) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) layout = QGridLayout(self) layout.addWidget(connection_settings_gbox) layout.addWidget(encoding_parameters_gbox) layout.addItem(QSpacerItem(0, 0, 0, QSizePolicy.Expanding)) layout.addWidget(restore_selector_gbox) layout.addWidget(self.buttonbox)
def __init__(self, channel, oldName, parent): super().__init__(parent) mainLayout = QVBoxLayout() oldNameLayout = QHBoxLayout() newNameLayout = QHBoxLayout() oldNameLayout.addWidget(QLabel("Old channel name: " + oldName)) self.nameLineEdit = QLineEdit() # name must be 1-16 non-whitespace characters regExp = QRegExp("[\\S]{1,16}") self.nameLineEdit.setValidator(QRegExpValidator(regExp, self)) self.nameLineEdit.textChanged.connect(self.onLineEditTextChanged) newNameLayout.addWidget(QLabel("channel name:")) newNameLayout.addWidget(self.nameLineEdit) newNameLayout.addWidget(QLabel("(16 characters max)")) newNameLayout.addStretch() self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) mainLayout.addLayout(oldNameLayout) mainLayout.addLayout(newNameLayout) mainLayout.addWidget(self.buttonBox) # mainLayout.addStretch() self.setLayout(mainLayout) self.setWindowTitle("Rename Channel " + channel)
def __init__(self, currentGlyph, parent=None): super().__init__(parent) self.setWindowModality(Qt.WindowModal) self.setWindowTitle(self.tr("Layer actions…")) self._workableLayers = [] for layer in currentGlyph.layerSet: if layer != currentGlyph.layer: self._workableLayers.append(layer) layout = QGridLayout(self) copyBox = QRadioButton(self.tr("Copy"), self) moveBox = QRadioButton(self.tr("Move"), self) swapBox = QRadioButton(self.tr("Swap"), self) self.otherCheckBoxes = (moveBox, swapBox) copyBox.setChecked(True) self.layersList = QListWidget(self) self.layersList.addItems(layer.name for layer in self._workableLayers) if self.layersList.count(): self.layersList.setCurrentRow(0) self.layersList.itemDoubleClicked.connect(self.accept) buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject) l = 0 layout.addWidget(copyBox, l, 0, 1, 2) layout.addWidget(moveBox, l, 2, 1, 2) layout.addWidget(swapBox, l, 4, 1, 2) l += 1 layout.addWidget(self.layersList, l, 0, 1, 6) l += 1 layout.addWidget(buttonBox, l, 0, 1, 6) self.setLayout(layout)
def initUI(self): self.setWindowTitle("确认删除") self.setWindowIcon(QIcon("./icon/delete.ico")) self.layout = QVBoxLayout() self.list_view = QListView() self.list_view.setViewMode(QListView.ListMode) # 列表 self.slm = QStandardItem() self.model = QStandardItemModel() max_len = 10 count = 0 for i in self.infos: if i[2]: # 有大小,是文件 self.model.appendRow(QStandardItem(self.set_file_icon(i[1]), i[1])) else: self.model.appendRow(QStandardItem(QIcon("./icon/folder.gif"), i[1])) self.out.append((i[0], i[2])) # id,文件标示 count += 1 if max_len < len(i[1]): # 使用最大文件名长度 max_len = len(i[1]) self.list_view.setModel(self.model) self.lb_name = QLabel("尝试删除以下{}个文件(夹):".format(count)) self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.layout.addWidget(self.lb_name) self.layout.addWidget(self.list_view) self.layout.addWidget(self.buttonBox) self.setLayout(self.layout) self.buttonBox.accepted.connect(self.btn_ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.setMinimumWidth(400) self.resize(int(max_len*8), int(count*34+60))
def initUI(self): self.setWindowTitle(self.title) buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonBox.accepted.connect(self.accept_btn) buttonBox.rejected.connect(self.reject_btn) layout = QFormLayout(self) label1 = QLabel("Space 1: ") label2 = QLabel("Space 2: ") comboBox1 = QComboBox(self) comboBox1.addItem("Current Space") comboBox1.addItem("Empty Space") comboBox1.addItem("Recent Save") comboBox1.addItem("Extern Space") comboBox2 = QComboBox(self) comboBox2.addItem("Empty Space") comboBox2.addItem("Current Space") comboBox2.addItem("Recent Save") comboBox2.addItem("Extern Space") comboBox1.activated[str].connect(self.selectionchange1) comboBox2.activated[str].connect(self.selectionchange2) layout.addRow(label1, comboBox1) layout.addRow(label2, comboBox2) layout.addWidget(buttonBox) self.setLayout(layout) self.show()
def slot_batch_resize(self): dialog = QDialog() dialog.setWindowTitle(i18n("Risize all pages.")) buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttons.accepted.connect(dialog.accept) buttons.rejected.connect(dialog.reject) sizesBox = comics_export_dialog.comic_export_resize_widget("Scale", batch=True, fileType=False) exporterSizes = comics_exporter.sizesCalculator() dialog.setLayout(QVBoxLayout()) dialog.layout().addWidget(sizesBox) dialog.layout().addWidget(buttons) if dialog.exec_() == QDialog.Accepted: progress = QProgressDialog(i18n("Resizing pages..."), str(), 0, len(self.setupDictionary["pages"])) progress.setWindowTitle(i18n("Resizing pages.")) progress.setCancelButton(None) timer = QElapsedTimer() timer.start() config = {} config = sizesBox.get_config(config) for p in range(len(self.setupDictionary["pages"])): absoluteUrl = os.path.join(self.projecturl, self.setupDictionary["pages"][p]) progress.setValue(p) timePassed = timer.elapsed() if (p > 0): timeEstimated = (len(self.setupDictionary["pages"]) - p) * (timePassed / p) passedString = str(int(timePassed / 60000)) + ":" + format(int(timePassed / 1000), "02d") + ":" + format(timePassed % 1000, "03d") estimatedString = str(int(timeEstimated / 60000)) + ":" + format(int(timeEstimated / 1000), "02d") + ":" + format(int(timeEstimated % 1000), "03d") progress.setLabelText(str(i18n("{pages} of {pagesTotal} done. \nTime passed: {passedString}:\n Estimated:{estimated}")).format(pages=p, pagesTotal=len(self.setupDictionary["pages"]), passedString=passedString, estimated=estimatedString)) if os.path.exists(absoluteUrl): doc = Application.openDocument(absoluteUrl) listScales = exporterSizes.get_scale_from_resize_config(config["Scale"], [doc.width(), doc.height(), doc.resolution(), doc.resolution()]) doc.scaleImage(listScales[0], listScales[1], listScales[2], listScales[3], "bicubic") doc.waitForDone() doc.save() doc.waitForDone() doc.close()
def __init__(self, title, text, text_before="", text_after="", width=650, height=400, parent=None): QDialog.__init__(self, parent) self.setModal(True) self.setWindowTitle(title) layout = QVBoxLayout(self) label_before = QLabel() label_before.setText(text_before) layout.addWidget(label_before) text_edit = QTextEdit("", self) text_edit.append(text) text_edit.setReadOnly(True) text_area = QScrollArea(self) text_area.setWidget(text_edit) text_area.setWidgetResizable(True) text_area.setFixedHeight(height) text_area.setFixedWidth(width) layout.addWidget(text_area) label_after = QLabel() label_after.setText(text_after) layout.addWidget(label_after) bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) bbox.accepted.connect(self.accept) bbox.rejected.connect(self.reject) layout.addWidget(bbox)
def on_set_grid_action(self): dialog = QDialog() dialog.setWindowTitle("Grid size") # grid_size = self.slide_viewer.slide_graphics.slide_view_params.grid_size_0_level # if not grid_size: grid_size = (224, 224) grid_w = QSpinBox() grid_w.setMaximum(2**15) grid_w.setValue(grid_size[0]) grid_h = QSpinBox() grid_h.setMaximum(2**15) grid_h.setValue(grid_size[1]) horizontal_layout = QHBoxLayout() horizontal_layout.addWidget(grid_w) horizontal_layout.addWidget(grid_h) form_layout = QFormLayout() form_layout.addRow("grid width:", horizontal_layout) main_layout = QVBoxLayout() main_layout.addLayout(form_layout) button_box = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, dialog) main_layout.addWidget(button_box) dialog.setLayout(main_layout) button_box.accepted.connect(dialog.accept) button_box.rejected.connect(dialog.reject) res = dialog.exec() if res == QDialog.Accepted: rects, color_alphas = build_rects_and_color_alphas_for_grid( (grid_w.value(), grid_h.value()), self.slide_viewer.slide_helper.get_level_size(0)) self.slide_viewer.slide_graphics.update_grid_rects_0_level( rects, color_alphas)
def __init__( self, parent: Optional[QWidget], question: str, help: HelpPageArgument = None, edit: Optional[QLineEdit] = None, default: str = "", title: str = "Anki", minWidth: int = 400, ) -> None: QDialog.__init__(self, parent) self.setWindowTitle(title) disable_help_button(self) self.question = question self.help = help self.qlabel = QLabel(question) self.setMinimumWidth(minWidth) v = QVBoxLayout() v.addWidget(self.qlabel) if not edit: edit = QLineEdit() self.l = edit if default: self.l.setText(default) self.l.selectAll() v.addWidget(self.l) buts = QDialogButtonBox.Ok | QDialogButtonBox.Cancel if help: buts |= QDialogButtonBox.Help b = QDialogButtonBox(buts) # type: ignore v.addWidget(b) self.setLayout(v) qconnect(b.button(QDialogButtonBox.Ok).clicked, self.accept) qconnect(b.button(QDialogButtonBox.Cancel).clicked, self.reject) if help: qconnect( b.button(QDialogButtonBox.Help).clicked, self.helpRequested)
def showCalendar(self): """ Shows a calendar with current date :return: CalendarWidget() """ logging.debug("Showing calendar") header = self.app.layout_props.getDefaultHeaderColorLight() select = self.app.layout_props.getDefaultSelectColor() calendar = CalendarWidget(header, select) setting_hint = "hints/showCalendarReminderHint" should_show_hint = not self.settings.contains( setting_hint) or self.settings.value(setting_hint) is True logging.info("%s: %s", setting_hint, str(should_show_hint)) if should_show_hint: hint = DialogBuilder(calendar, "Setting Reminders", "Hint: Select a date to create a Reminder!") hint.addButtonBox(QDialogButtonBox(QDialogButtonBox.Ok)) hint.exec() self.settings.setValue(setting_hint, not should_show_hint) def onCalendarReminder(): """ Creates a calendar reminder """ date: QDate = calendar.selectedDate() logging.info(date.toString("MM-dd-yyyy")) self.app.reminders.showDialog(calendar, False, date) calendar.selectionChanged.connect(onCalendarReminder) dialog = DialogBuilder() dialog.addWidget(calendar) dialog.layout().setContentsMargins(0, 0, 0, 0) dialog.setMinimumWidth(int(dialog.width() / 1.2)) dialog.setMinimumHeight(int(dialog.height() / 1.2)) dialog.exec()
def __init__(self, app): self.app = app super(data_entry, self).__init__() self.makeform() runButton = QPushButton(self.tr("&Run")) runButton.setDefault(True) exitButton = QPushButton(self.tr("&Exit")) exitButton.setAutoDefault(False) buttonBox = QDialogButtonBox() buttonBox.addButton(runButton, QDialogButtonBox.AcceptRole) buttonBox.addButton(exitButton, QDialogButtonBox.RejectRole) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject) mainLayout = QVBoxLayout() mainLayout.addWidget(self.formGroupBox) mainLayout.addWidget(buttonBox) self.setLayout(mainLayout) self.setWindowTitle("Enter Specimen Information") #self.showMaximized() #THEME COLOR self.palette = self.palette() #self.palette.setColor(QPalette.Window, QColor("#82CAFA")) self.palette.setBrush(QPalette.Background, QBrush(QPixmap("background/texture.jpg"))) #self.palette.setColor(QPalette.Button, QColor('red')) self.setPalette(self.palette) self.formGroupBox.setStyleSheet( "QGroupBox {background-image: url(background/texture.jpg)}") self.success = False print("Data Entry Screen") self.setFocus() self.exec()
def __init__(self, main_window): super().__init__(main_window) self.main_window = main_window self.project = main_window.project self.setWindowTitle('Enter Project Information') l = QFormLayout(self) project_name_label = QLabel('Project Name: ') project_name_label.setFont(QFont("Times", weight=QFont.Bold)) self.project_name_input = QLineEdit(self.project.get_name()) analyst_label = QLabel('Enter Analyst Name: ') analyst_label.setFont(QFont("Times", weight=QFont.Bold)) self.analyst_input = QLineEdit(self.project.get_analyst()) agency_label = QLabel('Enter Agency: ') agency_label.setFont(QFont("Times", weight=QFont.Bold)) self.agency_input = QLineEdit(self.project.get_agency()) speed_limit_label = QLabel('Speed Limit (mph): ') speed_limit_label.setFont(QFont("Times", weight=QFont.Bold)) self.speed_limit_input = QLineEdit(str(self.project.speed_limit)) # speed_lower_label = QLabel('Lower Limit Speed (mph): ') # speed_lower_label.setFont(QFont("Times", weight=QFont.Bold)) # self.speed_lower_input = QLineEdit(str(self.project.min_speed)) # speed_upper_label = QLabel('Upper Limit Speed (mph): ') # speed_upper_label.setFont(QFont("Times", weight=QFont.Bold)) # self.speed_upper_input = QLineEdit(str(self.project.max_speed)) l.addRow(project_name_label, self.project_name_input) l.addRow(analyst_label, self.analyst_input) l.addRow(agency_label, self.agency_input) l.addRow(speed_limit_label, self.speed_limit_input) # l.addRow(speed_lower_label, self.speed_lower_input) # l.addRow(speed_upper_label, self.speed_upper_input) buttons = QDialogButtonBox(Qt.Horizontal, self) buttons.addButton(QDialogButtonBox.Ok) buttons.addButton(QDialogButtonBox.Cancel) buttons.accepted.connect(self.ok_press) buttons.rejected.connect(self.close_press) l.addWidget(buttons)
def __init__(self): QDialog.__init__(self, None, Qt.WindowTitleHint) self.config = config self.isCanceled = True self.cfg = { "username": self.config.username, "client_id": self.config.client_id, "client_secret": self.config.client_secret, "redirect_uri": self.config.redirect_uri } self.setWindowModality(Qt.ApplicationModal) self.setFixedSize(450, 233) self.setWindowTitle("Spotlightify - Authentication") self.setWindowIcon(QIcon(f"{ASSETS_DIR}svg{sep}cog")) self.setStyleSheet(f"background-color: {default_themes['dark'].background}; color: {default_themes['dark'].foreground}") self.layout_widget = VerticalLayout(self) self.layout_widget.setGeometry(QRect(10, 10, 440, 160)) self.layout_widget.add(InputField(label="Username", store=self.cfg, field="username")) self.layout_widget.add( InputField(label="Client ID", store=self.cfg, field="client_id", required_length=32)) self.layout_widget.add( InputField(label="Client Secret", store=self.cfg, field="client_secret", required_length=32)) self.layout_widget.add( InputField(label="Redirect URI", store=self.cfg, field="redirect_uri", max_length=100)) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setGeometry(QRect(10, 190, 300, 23)) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Save) self.buttonBox.accepted.connect(self.save_changes) self.buttonBox.rejected.connect(self.close)
def __init__(self, *args, **kwargs): super(ConfigTcpDialog, self).__init__(*args, **kwargs) self.setStyleSheet(open("../resources/stylesheet.css").read()) self.setWindowTitle("ConfigTcp") self.result = [] self.pincsvfile = None self.fwv2datafile = None self.fwv3datafile = None self.fwv2filename = None self.fwv3filename = None QBtn = QDialogButtonBox.Ok | QDialogButtonBox.Cancel self.buttonBox = QDialogButtonBox(QBtn) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.pincsvfilebttn = QPushButton("DeviceList") self.pincsvfilebttn.clicked.connect(self.pinCsvDialog) self.fwv2bttn = QPushButton("FWv2") self.fwv2bttn.clicked.connect(self.fwV2Dialog) self.fwv3bttn = QPushButton("FWv3") self.fwv3bttn.clicked.connect(self.fwV3Dialog) self.refreshbutton = QPushButton() self.refreshbutton.setIcon( QIcon("../resources/images/icons/refreshicon.png")) self.refreshbutton.clicked.connect(self.populateList) self.layout = QGridLayout() self.layout.addWidget(self.pincsvfilebttn, 0, 0) self.layout.addWidget(self.fwv2bttn, 1, 0) self.layout.addWidget(self.fwv3bttn, 2, 0) self.layout.addWidget(self.buttonBox, 3, 0) self.setLayout(self.layout)