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 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 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 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 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 save_design(self, _=None): """Handles click on save design.""" if self.design: # get file path filename = self.design.save_path if not filename: QMessageBox.warning( self, 'Warning', 'This will save a .metal.py script ' 'that needs to be copied into a jupyter notebook to run.' 'The "Load" button has not yet been implemented.') filename = QFileDialog.getSaveFileName( None, 'Select a new location to save Metal design to', self.design.get_design_name() + '.metal.py', selectedFilter='*.metal.py')[0] self.design.save_path = filename # save python script to file path pyscript = self.design.to_python_script() with open(filename, 'w') as f: f.write(pyscript) #make it clear it's saving saving_dialog = QDialog(self) saving_dialog.setWindowModality(Qt.NonModal) v = QVBoxLayout() saving_dialog.setLayout(v) v.addWidget(QLabel("Saving...")) saving_dialog.open() saving_dialog.show() QTimer.singleShot(200, saving_dialog.close) else: self.logger.info('No design present.') QMessageBox.warning(self, 'Warning', 'No design present! Can' 't save')
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 open_error_dialog(self): error_dialog = QDialog(self) label = QLabel() label.setText('Sorry...\nNot support this apk.') layout = QHBoxLayout() layout.addWidget(label) error_dialog.setLayout(layout) error_dialog.show()
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 _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 save_image_B(self, fname): try: save_image(fname, self.im_array_B) except ValueError: dialog = QDialog(self) msg = "Invalid filename extension.\nPlease enter a valid image extension (such as .png or .jpg)" label = QLabel(msg) layout = QHBoxLayout() layout.addWidget(label) dialog.setLayout(layout) dialog.show()
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 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 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 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 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]
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 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 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 __disable(self): """Restores the ownership of the inner widget to its GraphicsNode.""" self.setWidget(None) self.__inner_widget.setParent(None) dialog = QDialog() layout = QVBoxLayout() layout.addWidget(self.__inner_widget) dialog.setLayout(layout) dialog.show() self.__inner_widget.setParent(None) self.__inner_widget.resize(self.__last_size) self.__graphics_node.set_inner_widget(self.__inner_widget) dialog.close()
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 get_date(self, is_start): w = QDialog() w.setLayout(QFormLayout()) calendar_input = QCalendarWidget() w.layout().addRow(calendar_input) accept_button = QPushButton("Accept") accept_button.clicked.connect(w.accept) cancel_button = QPushButton("Cancel") cancel_button.clicked.connect(w.reject) w.layout().addRow(accept_button, cancel_button) if w.exec() == QDialog.Accepted: selected_date = calendar_input.selectedDate() new_date = datetime.date(selected_date.year(), selected_date.month(), selected_date.day()) print("New date is", new_date) if is_start: self.start_date = new_date self.start_button.setText(str(new_date)) if self.end_date: print("Number of days is", self.end_date - self.start_date) self.calendar_view.setColumnCount( (self.end_date - self.start_date).days) date_labels = [ str(date) for date in date_iterator( self.start_date, self.end_date) ] self.calendar_view.setHorizontalHeaderLabels(date_labels) else: self.end_date = new_date self.end_button.setText(str(new_date)) if self.start_date: print("Number of days is", (self.end_date - self.start_date).days) self.calendar_view.setColumnCount( (self.end_date - self.start_date).days) date_labels = [ str(date) for date in date_iterator( self.start_date, self.end_date) ] self.calendar_view.setHorizontalHeaderLabels(date_labels)
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)