def view_fit_grains_results(self): for result in self.fit_grains_results: print(result) # Build grains table num_grains = len(self.fit_grains_results) shape = (num_grains, 21) grains_table = np.empty(shape) gw = instrument.GrainDataWriter(array=grains_table) for result in self.fit_grains_results: gw.dump_grain(*result) gw.close() # Display grains table in popup dialog dialog = QDialog(self.parent) dialog.setWindowTitle('Fit Grains Results') model = FitGrainsResultsModel(grains_table, dialog) view = QTableView(dialog) view.setModel(model) view.verticalHeader().hide() view.resizeColumnToContents(0) layout = QVBoxLayout(dialog) layout.addWidget(view) dialog.setLayout(layout) dialog.resize(960, 320) dialog.exec_()
def enter_address(self): """ opens a dialog to enter the dev's address :return: """ if self.can_generate_report(): address_dialog = QDialog(self) address_dialog.setWindowTitle("Email to...") form_layout = QFormLayout() email_line_edit = QLineEdit("*****@*****.**") cc_line_edit = QLineEdit() form_layout.addRow("Email:", email_line_edit) form_layout.addRow("CC:", cc_line_edit) accept_button = QPushButton("Send") accept_button.clicked.connect(lambda: self.send_email( email_line_edit.text(), cc_line_edit.text())) accept_button.clicked.connect(address_dialog.close) cancel_button = QPushButton("Cancel") cancel_button.clicked.connect(address_dialog.close) form_layout.addRow(accept_button, cancel_button) address_dialog.setLayout(form_layout) address_dialog.setFixedWidth(500) address_dialog.exec_() else: self.show_missing()
def SaveZeroPoint(offset: float, zeroPointManager: ZeroPointManager): dialog = QDialog() dialog.setWindowTitle("Save Zero Position") zeroPositionNameLineEdit = QLineEdit("Default Name: ") zeroPositionOffsetLineEdit = QLineEdit(str(offset)) zeroPositionOffsetLineEdit.setEnabled(False) buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) def createNewZeroPoint(): zeroPointManager.createZeroPoint( zeroPositionNameLineEdit.text(), float(zeroPositionOffsetLineEdit.text())) dialog.close() buttonBox.accepted.connect(createNewZeroPoint) buttonBox.rejected.connect(dialog.reject) layout = QFormLayout() layout.addRow(QLabel("Name: "), zeroPositionNameLineEdit) layout.addRow(QLabel("Offset: "), zeroPositionOffsetLineEdit) layout.addRow(buttonBox) dialog.setLayout(layout) return dialog
def create_new_show(self): w = QDialog() w.setWindowTitle("Create New Show") w.setLayout(QFormLayout()) show_name = QLineEdit("New Show") w.layout().addRow(QLabel("New Show Title:"), show_name) prod_days = QSpinBox() w.layout().addRow(QLabel("Days of production:"), prod_days) calendar_input = QCalendarWidget() w.layout().addRow(QLabel("Start date:")) w.layout().addRow(calendar_input) if self.shows: # If a show has already been created. previous_show = self.shows[-1] prod_days.setValue(previous_show.prod_days) accept = QPushButton("Create") accept.clicked.connect(w.accept) reject = QPushButton("Cancel") reject.clicked.connect(w.reject) w.layout().addRow(accept, reject) if w.exec_() == QDialog.Accepted: print("New show name:", show_name.text(), "Days of pre-production", prod_days.value()) selected_date = calendar_input.selectedDate() start_date = datetime.date(selected_date.year(), selected_date.month(), selected_date.day()) self.shows.append( Show(show_name.text(), prod_days.value(), start_date))
def __open_settings_window(self): settings_window = QDialog(self) settings_window.setWindowTitle("Settings") printer_settings = QGroupBox("Printer Settings:", settings_window) printer_type_label = QLabel("Printer Type:", printer_settings) self.printer_type_combo = QComboBox(printer_settings) self.printer_type_combo.addItems(self.supported_printers) self.printer_type_combo.setCurrentIndex( self.supported_printers.index(self.selected_printer)) apply_button = QPushButton("Apply Changes", printer_settings) apply_button.clicked.connect(self.__apply_settings) apply_button.clicked.connect(settings_window.close) apply_button.setAutoDefault(False) printer_settings_layout = QGridLayout(printer_settings) printer_settings_layout.addWidget(printer_type_label, 0, 0) printer_settings_layout.addWidget(self.printer_type_combo, 0, 1) printer_settings_layout.addWidget(apply_button, 4, 1) if self.selected_printer is self.supported_printers[0]: extra_settings = self.dlp_gui.get_settings_window(settings_window) elif self.selected_printer is self.supported_printers[1]: extra_settings = self.metal_gui.get_settings_window( settings_window) settings_layout = QVBoxLayout(settings_window) settings_layout.addWidget(printer_settings) settings_layout.addWidget(extra_settings) settings_window.open()
def createDurationDialog(self): popup = QDialog(self) popup.setFixedSize(150, 150) popup.setWindowTitle("Nouvelle durée") layout = QVBoxLayout() hourLayout = QHBoxLayout() hourLabel = QLabel("Heures:") hourSpin = QSpinBox() hourLayout.addWidget(hourLabel) hourLayout.addWidget(hourSpin) minuteLayout = QHBoxLayout() minuteLabel = QLabel("Minutes:") minuteSpin = QSpinBox() minuteLayout.addWidget(minuteLabel) minuteLayout.addWidget(minuteSpin) secondLayout = QHBoxLayout() secondLabel = QLabel("Secondes:") secondSpin = QSpinBox() secondLayout.addWidget(secondLabel) secondLayout.addWidget(secondSpin) layout.addLayout(hourLayout) layout.addLayout(minuteLayout) layout.addLayout(secondLayout) button = QPushButton("Ok") button.clicked.connect(lambda: self.createDuration( popup, hourSpin.value(), minuteSpin.value(), secondSpin.value())) layout.addWidget(button) popup.setLayout(layout) popup.exec_()
def _askForFieldsDialog(self, options, fields_type="inputs"): #Display a dialog to ask the user to choose what inputs/outputs they want dialog = QDialog(self) dialog.setWindowTitle(f"Select the model {fields_type.upper()}") dialogButtons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) dialogButtons.button(QDialogButtonBox.Ok).setDisabled(0) dialogButtons.accepted.connect(dialog.accept) dialogButtons.rejected.connect(dialog.reject) mainLayout = QVBoxLayout(dialog) scroll = QScrollArea(dialog) scroll.setWidgetResizable(True) layoutWidget = QWidget() layout = QVBoxLayout(layoutWidget) scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) scroll.setWidget(layoutWidget) chosenFields=[] checkboxes=[] def handleCheckboxClicked(): dialogButtons.button(QDialogButtonBox.Ok).setDisabled(1) count = 0 for checkbox in checkboxes: if checkbox.isChecked(): count += 1 if fields_type.lower() == "output": setDisabled = True if count > 1 else False else: setDisabled = True if count == 0 else False dialogButtons.button(QDialogButtonBox.Ok).setDisabled(setDisabled) for input in options: checkbox = QCheckBox(text=input) checkbox.clicked.connect(handleCheckboxClicked) checkbox.setChecked(True) checkboxes.append(checkbox) layout.addWidget(checkbox) mainLayout.addWidget(QLabel(text=f"Please select the {fields_type.lower()} from the following:")) mainLayout.addWidget(scroll) mainLayout.addWidget(dialogButtons) dialog.setLayout(mainLayout) handleCheckboxClicked() if dialog.exec_() == QDialog.Accepted: for checkbox in checkboxes: if checkbox.isChecked(): chosenFields.append(checkbox.text()) self.logger.log(f"The chosen {fields_type.lower()} are: "+ ', '.join(chosenFields), type ="INFO") return chosenFields else: return []
def about(self): my_dialog = QDialog(self) my_dialog.setWindowTitle("About") my_dialog.setGeometry(0, 0, 250, 100) label = create_qt_label("aboutLabel", 50, 0, 200, 100, my_dialog) label.setText("DnD 5e Character sheet editor" + "\n" "folderisland.(com/net)" + "\n" "Version: {0}.{1}.{2}".format( VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)) my_dialog.exec_( ) # blocks all other windows until this window is closed.
def quit_message(self) -> QDialog: """Displays a window while SCOUTS is exiting""" message = QDialog(self) message.setWindowTitle('Exiting SCOUTS') message.resize(300, 50) label = QLabel('SCOUTS is exiting, please wait...', message) label.setStyleSheet(self.style['label']) label.adjustSize() label.setAlignment(Qt.AlignCenter) label.move(int((message.width() - label.width()) / 2), int((message.height() - label.height()) / 2)) return message
def loading_message(self) -> QDialog: """Returns the message box to be displayed while the user waits for the input data to load.""" message = QDialog(self) message.setWindowTitle('Loading') message.resize(300, 50) label = QLabel('loading DataFrame into memory...', message) label.setStyleSheet(self.style['label']) label.adjustSize() label.setAlignment(Qt.AlignCenter) label.move(int((message.width() - label.width()) / 2), int((message.height() - label.height()) / 2)) return message
def _open_position_dialog(self, item: FSTTreeItem): window = Ui_NodeFieldWindow() dialog = QDialog( self, Qt.WindowSystemMenuHint | Qt.WindowTitleHint | Qt.WindowCloseButtonHint) window.setupUi(dialog) dialog.setWindowTitle(item.text(0)) dialog.setModal(True) window.label.setText("Position:") if item.node._position: window.plainTextEdit.setPlainText(f"0x{item.node._position:X}") else: window.plainTextEdit.setPlainText("-1") dialog.show() if dialog.exec_() != QFileDialog.Accepted: return False, "" text = window.plainTextEdit.toPlainText() try: if text.startswith("0x"): position = int(text, 16) else: position = int(text) except ValueError: dialog = JobFailedDialog(self) dialog.setText( f"Invalid input \"{text}\" could not be converted to int") return False, dialog if position < 0: if item.node._position: item.node._position = None self.iso.pre_calc_metadata(self.iso.MaxSize - self.iso.get_auto_blob_size()) self.ui.fileSystemStartInfoTextBox.setPlainText( f"0x{item.node._fileoffset:X}") return True, "" else: newPos = min(position, self.iso.MaxSize - 4) & -4 if item.node._position != newPos: item.node._position = newPos self.iso.pre_calc_metadata(self.iso.MaxSize - self.iso.get_auto_blob_size()) self.ui.fileSystemStartInfoTextBox.setPlainText( f"0x{item.node._position:X}") return True, ""
def show_text(txt, parent, type_text: bool = False, run: bool = True, min_width: int = 500, min_height: int = 400, title: str = APP_NAME_SHORT, copy_btn: bool = False, send_issue: bool = False): diag = QDialog(parent) diag.setWindowTitle(title) layout = QVBoxLayout(diag) diag.setLayout(layout) text = QTextBrowser() text.setOpenExternalLinks(True) if type_text: text.setPlainText(txt) else: text.setHtml(txt) layout.addWidget(text) box = QDialogButtonBox(QDialogButtonBox.Close) layout.addWidget(box) if copy_btn: def onCopy(): QApplication.clipboard().setText(text.toPlainText()) btn = QPushButton("Copy to Clipboard") btn.clicked.connect(onCopy) box.addButton(btn, QDialogButtonBox.ActionRole) if send_issue: def on_send(): title = 'An error occurred' body = text.toPlainText() IssueReporter().sent_report(title, body) btn = QPushButton("Report Issue") btn.clicked.connect(on_send) box.addButton(btn, QDialogButtonBox.ActionRole) def onReject(): QDialog.reject(diag) box.rejected.connect(onReject) diag.setMinimumHeight(min_height) diag.setMinimumWidth(min_width) if run: diag.exec_() else: return diag
def handle_dateSelectButton(self): # method to handle the okay button when it is pressed def handle_okayButton(): # get date from calendar widget and create a string out of it q_date = calendar.selectedDate() if q_date.day() < 10: day = str(0) + str(q_date.day()) else: day = str(q_date.day()) if q_date.month() < 10: month = str(0) + str(q_date.month()) else: month = str(q_date.month()) year = str(q_date.year()) date = day + '/' + month + '/' + year self.dateDisplay.setText(date) popup.accept() # method to handle the cancel button when it is pressed def handle_cancelButton(): popup.reject() # initialise the dialog popup = QDialog() popup.setWindowTitle('Select Date') # create the widgets and connect them to functions calendar = QCalendarWidget() okayButton = QPushButton('Okay') okayButton.clicked.connect(handle_okayButton) cancelButton = QPushButton('Cancel') cancelButton.clicked.connect(handle_cancelButton) # initialise the layout manager layout = QVBoxLayout() # add the widgets to the layout manager layout.addWidget(calendar) layout.addWidget(cancelButton) layout.addWidget(okayButton) popup.setLayout(layout) # set the dialog as modal so that the user cannot interact with the main window when the dialog is open popup.setModal(True) popup.show() popup.exec_()
def _open_alignment_dialog(self, item: FSTTreeItem): window = Ui_NodeFieldWindow() dialog = QDialog( self, Qt.WindowSystemMenuHint | Qt.WindowTitleHint | Qt.WindowCloseButtonHint) window.setupUi(dialog) dialog.setWindowTitle(item.text(0)) dialog.setModal(True) window.label.setText("Alignment:") if item.node._alignment: window.plainTextEdit.setPlainText(str(item.node._alignment)) else: window.plainTextEdit.setPlainText("4") dialog.show() if dialog.exec_() != QFileDialog.Accepted: return False, "" text = window.plainTextEdit.toPlainText() try: if text.startswith("0x"): alignment = int(text, 16) else: alignment = int(text) except ValueError: dialog = JobFailedDialog(self) dialog.setText( f"Invalid input \"{text}\" could not be converted to int") return False, dialog alignment = _round_up_to_power_of_2(max(4, min(alignment, 32768))) if item.node.is_file() and item.node._alignment != alignment: item.node._alignment = alignment self.iso.pre_calc_metadata(self.iso.MaxSize - self.iso.get_auto_blob_size()) self.ui.fileSystemStartInfoTextBox.setPlainText( f"0x{item.node._fileoffset:X}") if item.node.is_dir(): for child in item.node.rchildren(): child._alignment = _round_up_to_power_of_2(alignment) self.iso.pre_calc_metadata(self.iso.MaxSize - self.iso.get_auto_blob_size()) return True, ""
def on_click(self): dialog = QDialog(self) dialog.setWindowTitle("Dialog") layout = QVBoxLayout() dialog.setLayout(layout) label = QLabel("Message") label.setAlignment(Qt.AlignCenter) layout.addWidget(label) btns = QDialogButtonBox.Ok | QDialogButtonBox.Cancel btnbox = QDialogButtonBox(btns) layout.addWidget(btnbox) dialog.exec_()
def empty_dialog(self): """ Is triggered if course selection is empty """ d = QDialog() b1 = QPushButton("Ok", d) lbl1 = QLabel("Your selection of courses is empty") vbox = QVBoxLayout() vbox.addWidget(lbl1) vbox.addStretch() vbox.addWidget(b1) vbox.addStretch() d.setWindowTitle("Selection empty") d.setLayout(vbox) b1.clicked.connect(d.accept) d.setWindowIcon(QIcon("res/logo.ico")) d.exec_()
def add_url_to_group_callback(self): """ Callback method for the button "Add url to group" It creates a window that allows the user to mark the groups that and urls that are supposed to be added to them """ w = QWidget() f = QHBoxLayout(w) db = DatabaseHandler() entries = db.get_entry(CredentialsHandler.lastUsername) ldata = [url for url in entries['groups']] ldata = self.exclude_groups(ldata) ls = ListerView('Groups', 'Groups', ldata, self.parent) rdata = [] for index in entries['groups']['All']: rdata.append(entries['urls'][index]['actual_url']) rs = ListerView('Urls', 'Urls', rdata, self.parent) rs.layout().setContentsMargins(0, 0, 0, 0) ls.layout().setContentsMargins(0, 0, 0, 0) f.addWidget(ls) f.addWidget(rs) q = QDialog(self.parent) q.setWindowTitle('Add URL to Group') mf = QVBoxLayout(q) mf.addWidget(w) buttonBox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self.parent) mf.addWidget(buttonBox) buttonBox.accepted.connect(q.accept) buttonBox.rejected.connect(q.reject) if q.exec_(): groups = ls.get_results() urls = rs.get_results() for group in groups: for url in urls: index = URLHandler.add_url_to_group(url, group) if index > -1: self.mainView.group_view.add_url(url, group, index)
def get_connector(self, importee): """Shows a QDialog to select a connector for the given source file. Mimics similar routine in `spine_io.widgets.import_widget.ImportDialog` Args: importee (str): Label of the file acting as an importee Returns: Asynchronous data reader class for the given importee """ connector_list = [ CSVConnector, ExcelConnector, GdxConnector, JSONConnector ] # add others as needed connector_names = [c.DISPLAY_NAME for c in connector_list] dialog = QDialog(self._toolbox) dialog.setLayout(QVBoxLayout()) connector_list_wg = QListWidget() connector_list_wg.addItems(connector_names) # Set current item in `connector_list_wg` based on file extension _filename, file_extension = os.path.splitext(importee) file_extension = file_extension.lower() if file_extension.startswith(".xls"): row = connector_list.index(ExcelConnector) elif file_extension in (".csv", ".dat", ".txt"): row = connector_list.index(CSVConnector) elif file_extension == ".gdx": row = connector_list.index(GdxConnector) elif file_extension == ".json": row = connector_list.index(JSONConnector) else: row = None if row is not None: connector_list_wg.setCurrentRow(row) button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) button_box.button(QDialogButtonBox.Ok).clicked.connect(dialog.accept) button_box.button(QDialogButtonBox.Cancel).clicked.connect( dialog.reject) connector_list_wg.doubleClicked.connect(dialog.accept) dialog.layout().addWidget(connector_list_wg) dialog.layout().addWidget(button_box) _dirname, filename = os.path.split(importee) dialog.setWindowTitle("Select connector for '{}'".format(filename)) answer = dialog.exec_() if answer: row = connector_list_wg.currentIndex().row() return connector_list[row]
def fail_dialog(self): """ Is triggered if schedules cannot be created """ d = QDialog() b1 = QPushButton("Ok", d) lbl1 = QLabel("Cannot create a schedule with these subjects") vbox = QVBoxLayout() vbox.addWidget(lbl1) vbox.addStretch() vbox.addWidget(b1) vbox.addStretch() d.setWindowTitle("Failed") d.setLayout(vbox) b1.clicked.connect(d.accept) d.setWindowIcon(QIcon("res/logo.ico")) self.get_finallistsize() d.exec_()
def success_dialog(self, desc): """ Is triggered if schedules were created """ d = QDialog() b1 = QPushButton("Ok", d) lbl1 = QLabel(f"Results successfully saved as result{desc}.txt") vbox = QVBoxLayout() vbox.addWidget(lbl1) vbox.addStretch() vbox.addWidget(b1) vbox.addStretch() d.setWindowTitle("Success") d.setLayout(vbox) b1.clicked.connect(d.accept) d.setWindowIcon(QIcon("res/logo.ico")) self.get_finallistsize() d.exec_()
class DialogSteamapiKey: steamapi_window: QDialog def is_valid_steampi_key(self, key): if len(key) == 32: return True return False def steamapi_key_dialog(self): self.steamapi_window = QDialog() self.steamapi_window.setWindowTitle(_("Set steamapi key")) self.steamapi_window.setWindowIcon(self.switcher_logo) layout = QVBoxLayout() self.steamapi_window.setLayout(layout) text_label = QLabel( _("Used for getting avatars. Get yours from <a href='https://steamcommunity.com/dev/apikey'>steam</a>" )) apikey_edit = QLineEdit() save_button = QPushButton(_("Save")) text_label.setOpenExternalLinks(True) apikey_edit.setText(self.switcher.settings.get("steam_api_key")) layout.addWidget(text_label) layout.addWidget(apikey_edit) layout.addWidget(save_button) def save_enabled(): save_button.setEnabled( self.is_valid_steampi_key(apikey_edit.text())) def save(): self.switcher.settings["steam_api_key"] = apikey_edit.text() self.switcher.settings_write() self.steamapi_window.hide() if self.switcher.first_run: self.import_accounts_dialog() save_enabled() apikey_edit.textChanged.connect(lambda: save_enabled()) save_button.clicked.connect(lambda: save()) self.steamapi_window.show()
def renderSettingsSlot(self): dialog = QDialog(self) dialog.ui = Ui_Dialog() dialog.ui.setupUi(dialog) renderSettings = self.viewport.getRenderSettings() dialog.ui.checkBoxLightSampling.setChecked( renderSettings.useLightSampling) dialog.ui.checkBoxCaustics.setChecked(renderSettings.renderCaustics) dialog.ui.spinBoxBounces.setValue(renderSettings.bounces) dialog.setWindowTitle('Render Settings') if dialog.exec_(): self.viewport.setRenderSettings( Rendersettings(dialog.ui.checkBoxLightSampling.isChecked(), dialog.ui.checkBoxCaustics.isChecked(), dialog.ui.spinBoxBounces.value()))
def error_modal(self, window_title, msg_str): modal = QDialog(self) modal.setWindowTitle(window_title) msg = QLabel(msg_str) msg.setWordWrap(True) msg.setStyleSheet("""margin-bottom: 1em;""") msg.setAlignment(Qt.AlignCenter) buttonBox = QDialogButtonBox(QDialogButtonBox.Close) buttonBox.rejected.connect(modal.reject) buttonBox.setCenterButtons(True) layout = QGridLayout() layout.addWidget(msg, 0, 0) layout.addWidget(buttonBox, 1, 0) layout.setContentsMargins(16, 16, 16, 16) modal.setLayout(layout) modal.exec_()
def demo_combine_meshes(): """ Demonstrates combining the mesh of two scene nodes Prompt user to select two nodes to be merged and merge them. """ dialog = QDialog(GetQMaxMainWindow()) dialog.resize(250, 100) dialog.setWindowTitle('DEMO - Combine 2 Nodes') main_layout = QVBoxLayout() label = QLabel("Combine 2 Nodes") main_layout.addWidget(label) combine_btn = QPushButton("Combine") combine_btn.clicked.connect(combine_two_meshes) main_layout.addWidget(combine_btn) dialog.setLayout(main_layout) dialog.show()
def colorize(self): color_im_arr = false_color(self.im_array_A, self.im_array_B) color_im = Image.fromarray(color_im_arr).resize((self.w, self.h)) color_im_label = QLabel() color_im_label.setPixmap(color_im.toqpixmap()) color_im_dialog = QDialog(self) color_im_dialog.setWindowTitle("Colorized image") save_button = QPushButton("Save") save_button.clicked.connect(partial(self.save_colorized, color_im_arr)) layout = QVBoxLayout() layout.addWidget(color_im_label) layout.addWidget(save_button) color_im_dialog.setLayout(layout) color_im_dialog.show()
def on_help_clicked(self): """ Help pop-up """ d = QDialog() l1 = QLabel( "1. Press |Load| to download the latest data for the semester.\n\n3. With |Edit| button access the selection menu,\nadded courses will appear on the Main window.\n\n4. Use |Generate| button to generate and\n save your schedule as result<unixtimestamp>.txt" ) b1 = QPushButton("Ok", d) vbox = QVBoxLayout() vbox.addWidget(l1) hbox = QHBoxLayout() hbox.addStretch() hbox.addWidget(b1) hbox.addStretch() vbox.addItem(hbox) d.setWindowIcon(QIcon("res/logo.ico")) d.setWindowTitle("Help") d.setLayout(vbox) b1.clicked.connect(d.accept) d.exec_()
def on_about_clicked(self): """ About pop-up """ d = QDialog() l1 = QLabel( "nu-schedule\n\nA course schedule generator for the Nazarbayev University\nHomepage: https://github.com/ac130kz/nu-schedule\nApache 2.0 License\n\n© Mikhail Krassavin, 2020" ) b1 = QPushButton("Ok", d) vbox = QVBoxLayout() vbox.addWidget(l1) hbox = QHBoxLayout() hbox.addStretch() hbox.addWidget(b1) hbox.addStretch() vbox.addItem(hbox) d.setWindowIcon(QIcon("res/logo.ico")) d.setWindowTitle("About") d.setLayout(vbox) b1.clicked.connect(d.accept) d.exec_()
def add_crew_member(self): w = QDialog() w.setWindowTitle("Add New Crew Member") w.setLayout(QFormLayout()) crew_name = QLineEdit("New Crew Member") w.layout().addRow(QLabel("Crew Member Name:"), crew_name) specialization = QComboBox() specialization.addItems([ "Directing", "Cinematography", "Producing", "Production Design", "Editing", "Visual Effects" ]) w.layout().addRow(QLabel("Specialization:"), specialization) accept = QPushButton("Create") accept.clicked.connect(w.accept) reject = QPushButton("Cancel") reject.clicked.connect(w.reject) w.layout().addRow(accept, reject) if w.exec_() == QDialog.Accepted: new_crew_item = QListWidgetItem(crew_name.text()) new_crew_item.setFlags(new_crew_item.flags() | Qt.ItemIsEditable) self.crew_list_widget.addItem(new_crew_item)
def reminder(self): box = QDialog(self) algo = self.algoCombo.currentText() pixmap = QPixmap(f'images/{algo.lower()}.png') labelImage = QLabel() labelImage.setPixmap(pixmap) labelImage.setAlignment(Qt.AlignHCenter) labelText = QLabel(algoDict[algo].__doc__) labelText.setAlignment(Qt.AlignJustify) box.setWindowTitle(f"{algo} reminder") layout = QVBoxLayout() layout.addWidget(labelImage) layout.addWidget(labelText) box.setLayout(layout) box.show()
class DialogAbout: about_dialog: QDialog def about_dialog(self): self.about_dialog = QDialog(self) self.about_dialog.setWindowTitle("About") layout = QVBoxLayout() self.about_dialog.setLayout(layout) text_label = QLabel( _("Steam account switcher<br>" "Author: Tommi Saira <[email protected]><br>" "Url: <a href='https://github.com/tommis/steam_account_switcher'>github.com/tommis/steam_account_switcher</a>" )) text_label.setOpenExternalLinks(True) layout.addWidget(text_label) self.about_dialog.show()