5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog for entering the create parameters. |
7 Module implementing a dialog for entering the create parameters. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt5.QtCore import pyqtSlot, QProcess |
10 from PyQt6.QtCore import pyqtSlot, QProcess |
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
12 |
12 |
13 from E5Gui import E5MessageBox |
13 from EricWidgets import EricMessageBox |
14 |
14 |
15 from .Ui_CreateParametersDialog import Ui_CreateParametersDialog |
15 from .Ui_CreateParametersDialog import Ui_CreateParametersDialog |
16 |
16 |
17 import Preferences |
17 import Preferences |
18 |
18 |
23 """ |
23 """ |
24 def __init__(self, project, parent=None): |
24 def __init__(self, project, parent=None): |
25 """ |
25 """ |
26 Constructor |
26 Constructor |
27 |
27 |
28 @param project reference to the project object (Project) |
28 @param project reference to the project object |
29 @param parent reference to the parent widget (QWidget) |
29 @type Project |
|
30 @param parent reference to the parent widget |
|
31 @type QWidget |
30 """ |
32 """ |
31 super().__init__(parent) |
33 super().__init__(parent) |
32 self.setupUi(self) |
34 self.setupUi(self) |
33 |
35 |
34 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
36 self.__okButton = self.buttonBox.button( |
|
37 QDialogButtonBox.StandardButton.Ok) |
35 self.__okButton.setEnabled(False) |
38 self.__okButton.setEnabled(False) |
36 |
39 |
37 errMsg = "" |
40 errMsg = "" |
38 proc = QProcess() |
41 proc = QProcess() |
39 args = [] |
42 args = [] |
59 for line in sorted(lines[1:]): |
62 for line in sorted(lines[1:]): |
60 self.scaffoldCombo.addItem( |
63 self.scaffoldCombo.addItem( |
61 self.__prepareScaffoldString(line)) |
64 self.__prepareScaffoldString(line)) |
62 self.scaffoldCombo.setCurrentIndex(0) |
65 self.scaffoldCombo.setCurrentIndex(0) |
63 else: |
66 else: |
64 E5MessageBox.critical( |
67 EricMessageBox.critical( |
65 None, |
68 None, |
66 self.tr('Process Generation Error'), |
69 self.tr('Process Generation Error'), |
67 errMsg) |
70 errMsg) |
68 |
71 |
69 msh = self.minimumSizeHint() |
72 msh = self.minimumSizeHint() |
72 @pyqtSlot(str) |
75 @pyqtSlot(str) |
73 def on_nameEdit_textChanged(self, text): |
76 def on_nameEdit_textChanged(self, text): |
74 """ |
77 """ |
75 Private slot to handle changes of the site name. |
78 Private slot to handle changes of the site name. |
76 |
79 |
77 @param text text of the site entry (string) |
80 @param text text of the site entry |
|
81 @type str |
78 """ |
82 """ |
79 self.__updateUi() |
83 self.__updateUi() |
80 |
84 |
81 @pyqtSlot(str) |
85 @pyqtSlot(str) |
82 def on_scaffoldCombo_currentIndexChanged(self, text): |
86 def on_scaffoldCombo_currentTextChanged(self, text): |
83 """ |
87 """ |
84 Private slot to handle changes of the selected scaffold. |
88 Private slot to handle changes of the selected scaffold. |
85 |
89 |
86 @param text text of the combo box (string) |
90 @param text text of the combo box |
|
91 @type str |
87 """ |
92 """ |
88 self.__updateUi() |
93 self.__updateUi() |
89 |
94 |
90 def __updateUi(self): |
95 def __updateUi(self): |
91 """ |
96 """ |
112 |
117 |
113 def getData(self): |
118 def getData(self): |
114 """ |
119 """ |
115 Public method to get the data. |
120 Public method to get the data. |
116 |
121 |
117 @return tuple giving the scaffold (string), the project name (string), |
122 @return tuple giving the scaffold, the project name, a flag indicating |
118 a flag indicating to overwrite existing files (boolean) and a flag |
123 to overwrite existing files and a flag indicating to simulate the |
119 indicating to simulate the creation (boolean) |
124 creation |
|
125 @rtype tuple of (str, str, bool, bool) |
120 """ |
126 """ |
121 return ( |
127 return ( |
122 self.scaffoldCombo.currentText().split(":")[0], |
128 self.scaffoldCombo.currentText().split(":")[0], |
123 self.nameEdit.text(), |
129 self.nameEdit.text(), |
124 self.overwriteCheckBox.isChecked(), |
130 self.overwriteCheckBox.isChecked(), |