25 exeDisplayDataTemplate, |
25 exeDisplayDataTemplate, |
26 installDependenciesTemplate, |
26 installDependenciesTemplate, |
27 mainTemplate, |
27 mainTemplate, |
28 moduleSetupTemplate, |
28 moduleSetupTemplate, |
29 onDemandTemplate, |
29 onDemandTemplate, |
|
30 pluginTypeTemplate, |
30 previewPixmapTemplate, |
31 previewPixmapTemplate, |
31 ) |
32 ) |
32 from .Ui_PluginWizardDialog import Ui_PluginWizardDialog |
33 from .Ui_PluginWizardDialog import Ui_PluginWizardDialog |
33 |
34 |
34 |
35 |
35 class PluginWizardDialog(QDialog, Ui_PluginWizardDialog): |
36 class PluginWizardDialog(QDialog, Ui_PluginWizardDialog): |
36 """ |
37 """ |
37 Class implementing the eric plug-in wizard dialog. |
38 Class implementing the eric plug-in wizard dialog. |
38 """ |
39 """ |
|
40 |
|
41 OnDemandPluginTypes = ["", "viewmanager", "version_control"] |
|
42 AutoActivatePluginTypes = ["", "virtualenv"] |
39 |
43 |
40 def __init__(self, parent=None): |
44 def __init__(self, parent=None): |
41 """ |
45 """ |
42 Constructor |
46 Constructor |
43 |
47 |
63 self.packageNameEdit.textChanged.connect(self.__enableOkButton) |
67 self.packageNameEdit.textChanged.connect(self.__enableOkButton) |
64 self.shortDescriptionEdit.textChanged.connect(self.__enableOkButton) |
68 self.shortDescriptionEdit.textChanged.connect(self.__enableOkButton) |
65 self.longDescriptionEdit.textChanged.connect(self.__enableOkButton) |
69 self.longDescriptionEdit.textChanged.connect(self.__enableOkButton) |
66 self.preferencesKeyEdit.textChanged.connect(self.__enableOkButton) |
70 self.preferencesKeyEdit.textChanged.connect(self.__enableOkButton) |
67 self.configurationGroup.toggled.connect(self.__enableOkButton) |
71 self.configurationGroup.toggled.connect(self.__enableOkButton) |
68 self.autoActivateCheckBox.toggled.connect(self.__enableOkButton) |
|
69 self.pluginTypeCombo.currentIndexChanged.connect(self.__enableOkButton) |
72 self.pluginTypeCombo.currentIndexChanged.connect(self.__enableOkButton) |
70 self.pluginTypeNameEdit.textChanged.connect(self.__enableOkButton) |
73 self.pluginTypeNameEdit.textChanged.connect(self.__enableOkButton) |
71 |
74 |
72 self.pluginTypeCombo.addItems(["", "viewmanager", "version_control"]) |
75 self.on_autoActivateCheckBox_toggled(True) # default state of the option |
73 |
76 |
74 def __enableOkButton(self): |
77 def __enableOkButton(self): |
75 """ |
78 """ |
76 Private slot to set the state of the OK button. |
79 Private slot to set the state of the OK button. |
77 """ |
80 """ |
94 and bool(self.pluginTypeNameEdit.text()) |
97 and bool(self.pluginTypeNameEdit.text()) |
95 ) |
98 ) |
96 |
99 |
97 self.__okButton.setEnabled(enable) |
100 self.__okButton.setEnabled(enable) |
98 |
101 |
|
102 @pyqtSlot(bool) |
|
103 def on_autoActivateCheckBox_toggled(self, checked): |
|
104 """ |
|
105 Public slot to handle a change of state of the 'Activate Automatically' |
|
106 option. |
|
107 |
|
108 @param checked state of the option |
|
109 @type bool |
|
110 """ |
|
111 self.pluginTypeCombo.clear() |
|
112 |
|
113 if checked: |
|
114 self.pluginTypeCombo.addItems(PluginWizardDialog.AutoActivatePluginTypes) |
|
115 else: |
|
116 self.pluginTypeCombo.addItems(PluginWizardDialog.OnDemandPluginTypes) |
|
117 |
|
118 self.__enableOkButton() |
|
119 |
99 @pyqtSlot() |
120 @pyqtSlot() |
100 def on_projectButton_clicked(self): |
121 def on_projectButton_clicked(self): |
101 """ |
122 """ |
102 Private slot to populate some fields with data retrieved from the |
123 Private slot to populate some fields with data retrieved from the |
103 current project. |
124 current project. |
165 templateData["config2"] = "" |
186 templateData["config2"] = "" |
166 templateData["config3"] = "" |
187 templateData["config3"] = "" |
167 |
188 |
168 if self.autoActivateCheckBox.isChecked(): |
189 if self.autoActivateCheckBox.isChecked(): |
169 templateData["onDemand"] = "" |
190 templateData["onDemand"] = "" |
|
191 templateData["pluginType"] = ( |
|
192 pluginTypeTemplate.format( |
|
193 pluginType=self.pluginTypeCombo.currentText() |
|
194 ) |
|
195 if bool(self.pluginTypeCombo.currentText()) |
|
196 else "" |
|
197 ) |
170 else: |
198 else: |
171 templateData["onDemand"] = onDemandTemplate.format( |
199 templateData["onDemand"] = onDemandTemplate.format( |
172 pluginType=self.pluginTypeCombo.currentText(), |
200 pluginType=self.pluginTypeCombo.currentText(), |
173 pluginTypename=self.pluginTypeNameEdit.text(), |
201 pluginTypename=self.pluginTypeNameEdit.text(), |
174 ) |
202 ) |
|
203 templateData["pluginType"] = "" |
175 |
204 |
176 if self.pixmapCheckBox.isChecked(): |
205 if self.pixmapCheckBox.isChecked(): |
177 templateData["preview"] = previewPixmapTemplate |
206 templateData["preview"] = previewPixmapTemplate |
178 else: |
207 else: |
179 templateData["preview"] = "" |
208 templateData["preview"] = "" |