class Ui_successDialog(object): def setupUi(self, successDialog): if not successDialog.objectName(): successDialog.setObjectName(u"successDialog") successDialog.resize(294, 108) self.successButton = QDialogButtonBox(successDialog) self.successButton.setObjectName(u"successButton") self.successButton.setGeometry(QRect(100, 60, 91, 31)) self.successButton.setOrientation(Qt.Horizontal) self.successButton.setStandardButtons(QDialogButtonBox.Ok) self.successButton.setCenterButtons(True) self.successLabel = QLabel(successDialog) self.successLabel.setObjectName(u"successLabel") self.successLabel.setGeometry(QRect(50, 20, 201, 31)) self.successLabel.setTextFormat(Qt.MarkdownText) self.successLabel.setAlignment(Qt.AlignCenter) self.retranslateUi(successDialog) self.successButton.accepted.connect(successDialog.accept) self.successButton.rejected.connect(successDialog.reject) QMetaObject.connectSlotsByName(successDialog) # setupUi def retranslateUi(self, successDialog): successDialog.setWindowTitle( QCoreApplication.translate("successDialog", u"\u64cd\u4f5c\u6210\u529f", None)) self.successLabel.setText( QCoreApplication.translate("successDialog", u"**\u64cd\u4f5c\u6210\u529f\uff01**", None))
def add_item_to_model(submodel): dialog = QDialog() v_layout = QVBoxLayout() form_layout = QFormLayout() item_type = submodel.custom_table_item item_columns = item_type.columns_names widget_per_column = {} for index, name in item_columns.items(): line_edit = QLineEdit() form_layout.addRow(name, line_edit) widget_per_column[name] = line_edit button_box = QDialogButtonBox() button_box.setObjectName("buttonBox") button_box.setOrientation(Qt.Horizontal) button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) button_box.accepted.connect(dialog.accept) button_box.rejected.connect(dialog.reject) v_layout.addLayout(form_layout) v_layout.addWidget(button_box) dialog.forms = form_layout dialog.setLayout(v_layout) status = dialog.exec() if status == QDialog.Accepted: new_item = item_type() for index, name in new_item.columns_names.items(): value_of_row = widget_per_column[name].text() new_item.set_column(index, value_of_row) submodel.add_item(new_item) logger.info(f"New item of type {item_type} added")
class Ui_spellDialog(object): def setupUi(self, spellDialog): if spellDialog.objectName(): spellDialog.setObjectName(u"spellDialog") spellDialog.resize(400, 372) self.verticalLayout = QVBoxLayout(spellDialog) self.verticalLayout.setObjectName(u"verticalLayout") self.formLayout = QFormLayout() self.formLayout.setObjectName(u"formLayout") self.preparedLabel = QLabel(spellDialog) self.preparedLabel.setObjectName(u"preparedLabel") self.formLayout.setWidget(0, QFormLayout.LabelRole, self.preparedLabel) self.preparedCheckBox = QCheckBox(spellDialog) self.preparedCheckBox.setObjectName(u"preparedCheckBox") self.formLayout.setWidget(0, QFormLayout.FieldRole, self.preparedCheckBox) self.levelLabel = QLabel(spellDialog) self.levelLabel.setObjectName(u"levelLabel") self.formLayout.setWidget(1, QFormLayout.LabelRole, self.levelLabel) self.levelSpinBox = QSpinBox(spellDialog) self.levelSpinBox.setObjectName(u"levelSpinBox") self.formLayout.setWidget(1, QFormLayout.FieldRole, self.levelSpinBox) self.spellNameLabel = QLabel(spellDialog) self.spellNameLabel.setObjectName(u"spellNameLabel") self.formLayout.setWidget(2, QFormLayout.LabelRole, self.spellNameLabel) self.spellNameLineEdit = QLineEdit(spellDialog) self.spellNameLineEdit.setObjectName(u"spellNameLineEdit") self.formLayout.setWidget(2, QFormLayout.FieldRole, self.spellNameLineEdit) self.sourceLabel = QLabel(spellDialog) self.sourceLabel.setObjectName(u"sourceLabel") self.formLayout.setWidget(3, QFormLayout.LabelRole, self.sourceLabel) self.sourceLineEdit = QLineEdit(spellDialog) self.sourceLineEdit.setObjectName(u"sourceLineEdit") self.formLayout.setWidget(3, QFormLayout.FieldRole, self.sourceLineEdit) self.saveAttackLabel = QLabel(spellDialog) self.saveAttackLabel.setObjectName(u"saveAttackLabel") self.formLayout.setWidget(4, QFormLayout.LabelRole, self.saveAttackLabel) self.saveAttackLineEdit = QLineEdit(spellDialog) self.saveAttackLineEdit.setObjectName(u"saveAttackLineEdit") self.formLayout.setWidget(4, QFormLayout.FieldRole, self.saveAttackLineEdit) self.timeLabel = QLabel(spellDialog) self.timeLabel.setObjectName(u"timeLabel") self.formLayout.setWidget(5, QFormLayout.LabelRole, self.timeLabel) self.timeLineEdit = QLineEdit(spellDialog) self.timeLineEdit.setObjectName(u"timeLineEdit") self.formLayout.setWidget(5, QFormLayout.FieldRole, self.timeLineEdit) self.rangeLabel = QLabel(spellDialog) self.rangeLabel.setObjectName(u"rangeLabel") self.formLayout.setWidget(6, QFormLayout.LabelRole, self.rangeLabel) self.rangeLineEdit = QLineEdit(spellDialog) self.rangeLineEdit.setObjectName(u"rangeLineEdit") self.formLayout.setWidget(6, QFormLayout.FieldRole, self.rangeLineEdit) self.componentsLabel = QLabel(spellDialog) self.componentsLabel.setObjectName(u"componentsLabel") self.formLayout.setWidget(7, QFormLayout.LabelRole, self.componentsLabel) self.componentsLineEdit = QLineEdit(spellDialog) self.componentsLineEdit.setObjectName(u"componentsLineEdit") self.formLayout.setWidget(7, QFormLayout.FieldRole, self.componentsLineEdit) self.durationLabel = QLabel(spellDialog) self.durationLabel.setObjectName(u"durationLabel") self.formLayout.setWidget(8, QFormLayout.LabelRole, self.durationLabel) self.durationLineEdit = QLineEdit(spellDialog) self.durationLineEdit.setObjectName(u"durationLineEdit") self.formLayout.setWidget(8, QFormLayout.FieldRole, self.durationLineEdit) self.pageReferenceLabel = QLabel(spellDialog) self.pageReferenceLabel.setObjectName(u"pageReferenceLabel") self.formLayout.setWidget(9, QFormLayout.LabelRole, self.pageReferenceLabel) self.pageReferenceLineEdit = QLineEdit(spellDialog) self.pageReferenceLineEdit.setObjectName(u"pageReferenceLineEdit") self.formLayout.setWidget(9, QFormLayout.FieldRole, self.pageReferenceLineEdit) self.notesLabel = QLabel(spellDialog) self.notesLabel.setObjectName(u"notesLabel") self.formLayout.setWidget(10, QFormLayout.LabelRole, self.notesLabel) self.notesLineEdit = QLineEdit(spellDialog) self.notesLineEdit.setObjectName(u"notesLineEdit") self.formLayout.setWidget(10, QFormLayout.FieldRole, self.notesLineEdit) self.verticalLayout.addLayout(self.formLayout) self.buttonBox = QDialogButtonBox(spellDialog) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(spellDialog) self.buttonBox.accepted.connect(spellDialog.accept) self.buttonBox.rejected.connect(spellDialog.reject) QMetaObject.connectSlotsByName(spellDialog) # setupUi def retranslateUi(self, spellDialog): spellDialog.setWindowTitle( QCoreApplication.translate("spellDialog", u"dialog", None)) self.preparedLabel.setText( QCoreApplication.translate("spellDialog", u"Prepared", None)) self.levelLabel.setText( QCoreApplication.translate("spellDialog", u"Level", None)) self.spellNameLabel.setText( QCoreApplication.translate("spellDialog", u"Spell Name", None)) self.sourceLabel.setText( QCoreApplication.translate("spellDialog", u"Source", None)) self.saveAttackLabel.setText( QCoreApplication.translate("spellDialog", u"Save/Attack", None)) self.timeLabel.setText( QCoreApplication.translate("spellDialog", u"Time", None)) self.rangeLabel.setText( QCoreApplication.translate("spellDialog", u"Range", None)) self.componentsLabel.setText( QCoreApplication.translate("spellDialog", u"Components", None)) self.durationLabel.setText( QCoreApplication.translate("spellDialog", u"Duration", None)) self.pageReferenceLabel.setText( QCoreApplication.translate("spellDialog", u"Page Reference", None)) self.notesLabel.setText( QCoreApplication.translate("spellDialog", u"Notes", None))
class PdfDialog(QDialog): def __init__(self, parent, importers_stringlist): super(PdfDialog, self).__init__(parent) self.resize(320, 240) self.importer_selected = 0 self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setObjectName("verticalLayout") self.formLayout = QFormLayout() self.formLayout.setObjectName("formLayout") self.selected_file_label = QLabel(self) self.selected_file_label.setObjectName("selected_file_label") self.formLayout.setWidget(0, QFormLayout.LabelRole, self.selected_file_label) self.importer_label = QLabel(self) self.importer_label.setObjectName("importer_label") self.formLayout.setWidget(1, QFormLayout.LabelRole, self.importer_label) self.importer_combo_box = QComboBox(self) self.importer_combo_box.setObjectName("importer_combo_box") self.importer_combo_box.addItems(importers_stringlist) def set_importer_selected(x): self.importer_selected = x self.importer_combo_box.currentIndexChanged.connect( set_importer_selected) self.formLayout.setWidget(1, QFormLayout.FieldRole, self.importer_combo_box) self.selected_label = QLabel(self) self.selected_label.setObjectName("selected_label") self.formLayout.setWidget(0, QFormLayout.FieldRole, self.selected_label) self.importer_status = QLabel(self) self.importer_status.setObjectName("importer_status") self.formLayout.setWidget(2, QFormLayout.FieldRole, self.importer_status) self.verticalLayout.addLayout(self.formLayout) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setObjectName("buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(self) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) QMetaObject.connectSlotsByName(self) # setupUi def retranslateUi(self, dialog): dialog.setWindowTitle( QCoreApplication.translate("dialog", "Import Character Sheet", None)) self.selected_file_label.setText( QCoreApplication.translate("dialog", "Selected File", None)) self.importer_label.setText( QCoreApplication.translate("dialog", "Importer", None)) self.selected_label.setText( QCoreApplication.translate("dialog", "TextLabel", None)) self.importer_status.setText( QCoreApplication.translate("dialog", "TextLabel", None))
class Ui_EquipmentDialog(object): def setupUi(self, EquipmentDialog): if EquipmentDialog.objectName(): EquipmentDialog.setObjectName(u"EquipmentDialog") EquipmentDialog.setWindowModality(Qt.WindowModal) EquipmentDialog.resize(400, 162) self.verticalLayout = QVBoxLayout(EquipmentDialog) self.verticalLayout.setObjectName(u"verticalLayout") self.formLayout = QFormLayout() self.formLayout.setObjectName(u"formLayout") self.nameLabel = QLabel(EquipmentDialog) self.nameLabel.setObjectName(u"nameLabel") self.formLayout.setWidget(0, QFormLayout.LabelRole, self.nameLabel) self.nameLineEdit = QLineEdit(EquipmentDialog) self.nameLineEdit.setObjectName(u"nameLineEdit") self.formLayout.setWidget(0, QFormLayout.FieldRole, self.nameLineEdit) self.amountLabel = QLabel(EquipmentDialog) self.amountLabel.setObjectName(u"amountLabel") self.formLayout.setWidget(1, QFormLayout.LabelRole, self.amountLabel) self.amountSpinBox = QSpinBox(EquipmentDialog) self.amountSpinBox.setObjectName(u"amountSpinBox") self.formLayout.setWidget(1, QFormLayout.FieldRole, self.amountSpinBox) self.weightLabel = QLabel(EquipmentDialog) self.weightLabel.setObjectName(u"weightLabel") self.formLayout.setWidget(2, QFormLayout.LabelRole, self.weightLabel) self.weightLineEdit = QLineEdit(EquipmentDialog) self.weightLineEdit.setObjectName(u"weightLineEdit") self.formLayout.setWidget(2, QFormLayout.FieldRole, self.weightLineEdit) self.attunedLabel = QLabel(EquipmentDialog) self.attunedLabel.setObjectName(u"attunedLabel") self.formLayout.setWidget(3, QFormLayout.LabelRole, self.attunedLabel) self.attunedCheckBox = QCheckBox(EquipmentDialog) self.attunedCheckBox.setObjectName(u"attunedCheckBox") self.formLayout.setWidget(3, QFormLayout.FieldRole, self.attunedCheckBox) self.verticalLayout.addLayout(self.formLayout) self.buttonBox = QDialogButtonBox(EquipmentDialog) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(EquipmentDialog) self.buttonBox.accepted.connect(EquipmentDialog.accept) self.buttonBox.rejected.connect(EquipmentDialog.reject) QMetaObject.connectSlotsByName(EquipmentDialog) # setupUi def retranslateUi(self, EquipmentDialog): EquipmentDialog.setWindowTitle( QCoreApplication.translate("EquipmentDialog", u"dialog", None)) self.nameLabel.setText( QCoreApplication.translate("EquipmentDialog", u"Name", None)) self.amountLabel.setText( QCoreApplication.translate("EquipmentDialog", u"Amount", None)) self.weightLabel.setText( QCoreApplication.translate("EquipmentDialog", u"Weight", None)) self.attunedLabel.setText( QCoreApplication.translate("EquipmentDialog", u"Attuned", None))