class TestToolSettingWindow(MayaQWidgetBaseMixin, QMainWindow): # サブウィンドウのクラス(設定画面) def __init__(self, parent=None): super(TestToolSettingWindow, self).__init__(parent) self.sub_window = QDialog(parent) self.parent = parent self.ui = demowindow.gui(self.sub_window, SETTING_UI_FILE, SETTING_UI_TITLE) demowindow.set_imagefile(self.ui.label_image, IMAGE_PATH) self.set_signals() # ===================================== def set_signals(self): # シグナルの登録 self.ui.button.clicked.connect(self.send_value) # ===================================== def send_value(self): # 設定を反映 value = self.ui.lineEdit.text() self.parent.apply_value(value) # ===================================== def show(self): # ウィンドウ表示 self.sub_window.exec_()
class LostFolderDialog(object): def __init__(self, parent, path, restoreFolder, dialog_id=0): super(LostFolderDialog, self).__init__() self._path = path self._restoreFolder = restoreFolder self._dialog_id = dialog_id self._dialog = QDialog( parent, Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint) self._dialog.setAttribute(Qt.WA_MacFrameworkScaled) self._dialog.setWindowIcon(QIcon(':/images/icon.png')) self._ui = lost_folder_dialog.Ui_Dialog() self._ui.setupUi(self._dialog) self._ui.textLabel.setText(self._ui.textLabel.text().replace( '{PATH}', path)) self._connect_slots() def _connect_slots(self): ui = self._ui ui.tryAgainButton.clicked.connect(self._on_tryAgain) ui.restoreFolderButton.clicked.connect(self._on_restoreFolder) def show(self): self._dialog.raise_() self._dialog.exec_() def _on_tryAgain(self): if op.isdir(self._path): self._dialog.accept() def _on_restoreFolder(self): self._dialog.accept() self._restoreFolder(self._dialog_id, 0)
def create_issue(self): """ Opens a QDialog to create new Issue. """ # Load the QDialog to create new issue. issue_dialog = QDialog() issue_dialog.setWindowFlags(Qt.WindowTitleHint) issue_dialog.setWindowFlags(Qt.WindowSystemMenuHint) issue_dialog.setWindowFlags(Qt.WindowCloseButtonHint) self.create_issue_dialog_ui.setupUi(issue_dialog) # Add the list of current projects from redmine. projects_list = self.redmine_manager.get_projects() self.create_issue_dialog_ui.projectComboBox.addItems(projects_list) # Add the trackers of the selected project. self.create_issue_dialog_ui.projectComboBox.currentIndexChanged.connect( self.add_project_trackers) # Add priorities for the new issue. priorities_list = [ priority_name for priority_name in constants.PRIORITIES_DICT ] self.create_issue_dialog_ui.priorityComboBox.addItems(priorities_list) # Detect clicked signal for the create button. self.create_issue_dialog_ui.newIssueButton.clicked.connect( self.create_new_issue_clicked) issue_dialog.exec_()
def tags_selection(self): def add_tags(): added_tags = "" for _tag, box in tags.items(): if box.isChecked(): added_tags += _tag + ', ' self.tags.setText(added_tags.strip(', ')) selection = QDialog(self.parent) layout = QVBoxLayout() tags = dict() for tag in self.npc.get_tag_list(): tags[tag] = QCheckBox(tag) layout.addWidget(tags[tag]) button_line = QHBoxLayout() add_button = QPushButton("Ajouter") add_button.clicked.connect(add_tags) add_button.clicked.connect(selection.close) button_line.addWidget(add_button) close_button = QPushButton("Annuler") close_button.clicked.connect(selection.close) button_line.addWidget(close_button) layout.addLayout(button_line) selection.setLayout(layout) selection.exec_()
def save_to_filewriter_json(self): filename = file_dialog(True, "Save Filewriter JSON File", JSON_FILE_TYPES) if filename: dialog = QDialog() dialog.setModal(True) dialog.setLayout(QGridLayout()) command_widget = FilewriterCommandWidget() dialog.layout().addWidget(command_widget) dialog.exec_() ( nexus_file_name, broker, start_time, stop_time, service_id, abort_on_uninitialised_stream, use_swmr, ) = command_widget.get_arguments() with open(filename, "w") as file: filewriter_json_writer.generate_json( self.instrument, file, nexus_file_name=nexus_file_name, broker=broker, start_time=start_time, stop_time=stop_time, service_id=service_id, abort_uninitialised=abort_on_uninitialised_stream, use_swmr=use_swmr, )
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 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 callDialog(self, question, ANSWER, TIME): # 打开答案窗口 dialog = Ui_Dialog() dialogWindow = QDialog() dialog.setupUi(dialogWindow) dialog.setupUi_(question, ANSWER, TIME) dialogWindow.exec_()
def mysecond(e, s): # here is the second window which the plotting will present itself. mydialog = QDialog() mydialog.setModal(True) sc = MplCanvas(w, width=5, height=3, dpi=100) sc.axes.plot(s, e) w.setCentralWidget(sc) mydialog.exec_()
def exportToCSV(self): def doexport(): filetype = filetypes.currentText() exportTables = [] db = self.consolesTableView.model.database() if tablesBox.currentIndex() == 0: for table in tables[1:]: exportTables.append(table.lower()) elif tablesBox.currentIndex() == 1: exportTables.append("games") elif tablesBox.currentIndex() == 2: exportTables.append("consoles") elif tablesBox.currentIndex() == 3: exportTables.append("accessories") sql2csv(db, exportTables, filetype) exportWindow.close() exportWindow = QDialog() tables = ["All", "Games", "Consoles", "Accessories"] tablesLabel = QLabel("Tables to export") tablesBox = QComboBox() # tablesBox.addItem(None, text="All") tablesBox.addItems(tables) tablesLayout = QHBoxLayout() tablesLayout.addWidget(tablesLabel) tablesLayout.addWidget(tablesBox) filetypesLabel = QLabel("Filetype") filetypes = QComboBox() filetypes.addItems(["csv", "tsv"]) filetypesLayout = QHBoxLayout() filetypesLayout.addWidget(filetypesLabel) filetypesLayout.addWidget(filetypes) # filenameLabel = QLabel("Filename") # filename = QLineEdit() # filesLayout = QHBoxLayout() # filesLayout.addWidget(filenameLabel) # filesLayout.addWidget(filename) ok = QPushButton("Ok") ok.clicked.connect(doexport) cancel = QPushButton("Cancel") cancel.clicked.connect(exportWindow.close) buttonLayout = QHBoxLayout() buttonLayout.addWidget(ok) buttonLayout.addWidget(cancel) layout = QVBoxLayout() layout.addLayout(tablesLayout) # layout.addLayout(filesLayout) layout.addLayout(filetypesLayout) layout.addLayout(buttonLayout) exportWindow.setLayout(layout) exportWindow.exec_()
def resize(self): self.timer.stop() temp=QDialog() temp.ui=Ui_Dialog_Resize(self.image_stack[-1]) temp.ui.setupUi(temp) temp.show() temp.exec_() self.image_stack.append(temp.ui.image) self.timer.start(1) pass
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 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 cropping(self): if type(self.image_stack[-1])==type(None): print("lol") return self.timer.stop() temp=QDialog() temp.ui=Ui_Dialog(self.image_stack[-1]) temp.ui.setupUi(temp) temp.show() temp.exec_() self.image_stack.append(temp.ui.image) self.timer.start(1) pass
def passError(self, s): passError = QDialog(self) msg = QLabel(s) layout = QVBoxLayout() layout.addWidget(msg) passError.setLayout(layout) okBtn = QPushButton('OK') okBtn.clicked.connect(passError.reject) layout.addWidget(okBtn) passError.exec_() return
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 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 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 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 fix_pyside_exec(namespace): if namespace.get("__name__") == "AnyQt.QtWidgets": from PySide2.QtWidgets import QApplication, QDialog, QMenu if "exec" not in QApplication.__dict__: QApplication.exec = lambda self: QApplication.exec_() if not hasattr(QDialog, "exec"): QDialog.exec = lambda self: QDialog.exec_(self) if not hasattr(QMenu, "exec"): QMenu.exec = lambda self: QMenu.exec_(self) if namespace.get("__name__") == "AnyQt.QtGui": from PySide2.QtGui import QGuiApplication, QDrag if "exec" not in QGuiApplication.__dict__: QGuiApplication.exec = lambda self: QGuiApplication.exec_() if not hasattr(QDrag, "exec"): QDrag.exec = (lambda self, *args, **kwargs: QDrag.exec_( self, *args, **kwargs)) elif namespace.get("__name__") == "AnyQt.QtCore": from PySide2.QtCore import QCoreApplication, QEventLoop, QThread if not hasattr(QCoreApplication, "exec"): QCoreApplication.exec = lambda self: QCoreApplication.exec_() if not hasattr(QEventLoop, "exec"): QEventLoop.exec = (lambda self, *args, **kwargs: QEventLoop.exec_( self, *args, **kwargs)) if not hasattr(QThread, "exec"): QThread.exec = lambda self: QThread.exec_(self) elif namespace.get("__name__") == "AnyQt.QtPrintSupport": from PySide2.QtPrintSupport import QPageSetupDialog, QPrintDialog if "exec" not in QPageSetupDialog.__dict__: QPageSetupDialog.exec = lambda self: QPageSetupDialog.exec_(self) if "exec" not in QPrintDialog.__dict__: QPrintDialog.exec = lambda self: QPrintDialog.exec_(self)
def select_data_range(self): dialog = QDialog(self.ui) layout = QVBoxLayout() dialog.setLayout(layout) range_widget = RangeWidget(dialog) range_widget.bounds = self.data_bounds range_widget.min = self.data_range[0] range_widget.max = self.data_range[1] layout.addWidget(range_widget.ui) buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel button_box = QDialogButtonBox(buttons, dialog) button_box.accepted.connect(dialog.accept) button_box.rejected.connect(dialog.reject) layout.addWidget(button_box) if not dialog.exec_(): # User canceled return data_range = range_widget.range if data_range[0] >= data_range[1]: message = 'Min cannot be greater than or equal to the max' QMessageBox.critical(self.ui, 'Validation Error', message) return if self.data_range == data_range: # Nothing changed... return self.data_range = data_range self.modified()
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_()
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 selecCentre(self): qt = self.ui wAffichCentre = QDialog() uiAffichCentre = Ui_Form() uiAffichCentre.setupUi(wAffichCentre) rowSelec = qt.tableWidget.currentItem().row() idSelec = int(qt.tableWidget.item(rowSelec, 0).text()) listIdSelec = reqPostgresql(f"""SELECT * FROM centre WHERE id_c = {idSelec};""") listAnIdSelect = reqOnePostgresql(f"""SELECT intitule FROM animation a JOIN proposer p ON a.id_an = p.id_an JOIN centre c ON p.id_c = c.id_c WHERE c.id_c = {idSelec};""") textDescr = "" for i in range(len(self.namesColList)): if i != 0: textDescr += self.namesColList[i] + " : " + listIdSelec[0][i] + "\n" textAnim = "Animation(s) proposée(s) : \n" for elem in listAnIdSelect: textAnim += elem + "\n" uiAffichCentre.teDescr.setText(textDescr) uiAffichCentre.teAnim.setText(textAnim) freq = [np.random.randint(100, 200), np.random.randint(100, 200), np.random.randint(100, 200), np.random.randint(200, 300), np.random.randint(300, 400), np.random.randint(500, 600), np.random.randint(700, 800), np.random.randint(700, 800), np.random.randint(500, 600), np.random.randint(300, 400), np.random.randint(200, 300), np.random.randint(100, 200)] mois = range(1, 13) fig, ax = plt.subplots() ax.plot(mois, freq) plt.xticks(np.arange(min(mois), max(mois) + 1, 1.0)) ax.set(xlabel='mois', ylabel='fréq.', title='Fréquentation du centre') ax.grid(True, linestyle='dotted') canvas = FigureCanvas(fig) uiAffichCentre.horizontalLayout_2.addWidget(canvas) self.setLayout(uiAffichCentre.horizontalLayout_2) wAffichCentre.exec_()
def contextMenuEvent(self, event): menu = QtWidgets.QMenu(self) add_Action = menu.addAction("добавить") edit_Action = menu.addAction("редактировать") remove_Action = menu.addAction("удалить") action = menu.exec_(self.mapToGlobal(event.pos())) if action == add_Action: widget = QDialog() ui = GoodsForm(table=self) ui.setupUi(widget) widget.exec_() if action == remove_Action: reply = QtWidgets.QMessageBox.question( self, "Удалить товар?", "Вы уверенны что хотите удалить?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No, ) if reply == QtWidgets.QMessageBox.Yes: values = self.parse_row() if values["Кол-во."] != "0": # widget = QDialog() error_dialog = QtWidgets.QErrorMessage(self) error_dialog.showMessage("товар с количеством удалить нельзя") else: db = Bicycle_db() db.insert( "DELETE FROM goods WHERE article LIKE '%{}%'".format( values["Арт"] ) ) self.update_table() db.close() if action == edit_Action: widget = QDialog() ui = GoodsForm( table=self, values=self.parse_row(), category_widget=self.category_widget, ) ui.setupUi(widget) widget.exec_()
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 _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 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_()