5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to select the template type. |
7 Module implementing a dialog to select the template type. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt5.QtCore import pyqtSlot, QCoreApplication |
10 from PyQt6.QtCore import pyqtSlot, QCoreApplication |
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
12 |
12 |
13 from .Ui_FormSelectionDialog import Ui_FormSelectionDialog |
13 from .Ui_FormSelectionDialog import Ui_FormSelectionDialog |
14 |
14 |
15 |
15 |
16 class FormSelectionDialog(QDialog, Ui_FormSelectionDialog): |
16 class FormSelectionDialog(QDialog, Ui_FormSelectionDialog): |
89 @type QWidget |
89 @type QWidget |
90 """ |
90 """ |
91 super().__init__(parent) |
91 super().__init__(parent) |
92 self.setupUi(self) |
92 self.setupUi(self) |
93 |
93 |
94 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
94 self.buttonBox.button( |
|
95 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
95 |
96 |
96 self.typeCombo.addItem("") |
97 self.typeCombo.addItem("") |
97 for templateType in FormSelectionDialog.Templates: |
98 for templateType in FormSelectionDialog.Templates: |
98 self.typeCombo.addItem( |
99 self.typeCombo.addItem( |
99 FormSelectionDialog.Templates[templateType]["title"], |
100 FormSelectionDialog.Templates[templateType]["title"], |
110 """ |
111 """ |
111 templateType = self.typeCombo.itemData(index) |
112 templateType = self.typeCombo.itemData(index) |
112 if templateType: |
113 if templateType: |
113 self.preview.setPlainText( |
114 self.preview.setPlainText( |
114 FormSelectionDialog.Templates[templateType]["template"]) |
115 FormSelectionDialog.Templates[templateType]["template"]) |
115 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True) |
116 self.buttonBox.button( |
|
117 QDialogButtonBox.StandardButton.Ok).setEnabled(True) |
116 else: |
118 else: |
117 self.preview.clear() |
119 self.preview.clear() |
118 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
120 self.buttonBox.button( |
|
121 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
119 |
122 |
120 def getTemplateText(self): |
123 def getTemplateText(self): |
121 """ |
124 """ |
122 Public method to get the template text. |
125 Public method to get the template text. |
123 |
126 |