203 self.actions.append(self.aboutFlaskAct) |
203 self.actions.append(self.aboutFlaskAct) |
204 |
204 |
205 self.__pybabelProject.initActions() |
205 self.__pybabelProject.initActions() |
206 self.__migrateProject.initActions() |
206 self.__migrateProject.initActions() |
207 |
207 |
|
208 ###################################### |
|
209 ## configuration action below ## |
|
210 ###################################### |
|
211 |
|
212 self.flaskConfigAct = E5Action( |
|
213 self.tr('Configure Flask for Project'), |
|
214 self.tr('Configure Flask for &Project'), |
|
215 0, 0, |
|
216 self, 'flask_config_for_project') |
|
217 self.flaskConfigAct.setStatusTip(self.tr( |
|
218 'Shows a dialog to edit the project specific flask configuration')) |
|
219 self.flaskConfigAct.setWhatsThis(self.tr( |
|
220 """<b>Configure Migrate</b>""" |
|
221 """<p>Shows a dialog to edit the project specific flask""" |
|
222 """ configuration.</p>""" |
|
223 )) |
|
224 self.flaskConfigAct.triggered.connect( |
|
225 self.__configureFlaskForProject) |
|
226 self.actions.append(self.flaskConfigAct) |
|
227 |
208 def initMenu(self): |
228 def initMenu(self): |
209 """ |
229 """ |
210 Public method to initialize the Flask menu. |
230 Public method to initialize the Flask menu. |
211 |
231 |
212 @return the menu generated |
232 @return the menu generated |
218 self.__menus["flask-migrate"] = self.__migrateProject.initMenu() |
238 self.__menus["flask-migrate"] = self.__migrateProject.initMenu() |
219 |
239 |
220 menu = QMenu(self.tr('&Flask'), self.__ui) |
240 menu = QMenu(self.tr('&Flask'), self.__ui) |
221 menu.setTearOffEnabled(True) |
241 menu.setTearOffEnabled(True) |
222 |
242 |
|
243 menu.addAction(self.flaskConfigAct) |
|
244 menu.addSeparator() |
223 menu.addAction(self.runServerAct) |
245 menu.addAction(self.runServerAct) |
224 menu.addAction(self.runDevServerAct) |
246 menu.addAction(self.runDevServerAct) |
225 menu.addAction(self.askForServerOptionsAct) |
247 menu.addAction(self.askForServerOptionsAct) |
226 menu.addSeparator() |
248 menu.addSeparator() |
227 menu.addAction(self.runPythonShellAct) |
249 menu.addAction(self.runPythonShellAct) |
359 Public method to get the path of the virtual environment. |
381 Public method to get the path of the virtual environment. |
360 |
382 |
361 @return path of the virtual environment |
383 @return path of the virtual environment |
362 @rtype str |
384 @rtype str |
363 """ |
385 """ |
|
386 # TODO: use project specific override first, global setting second |
364 language = self.__e5project.getProjectLanguage() |
387 language = self.__e5project.getProjectLanguage() |
365 if language == "Python3": |
388 if language == "Python3": |
366 venvName = self.__plugin.getPreferences( |
389 venvName = self.__plugin.getPreferences( |
367 "VirtualEnvironmentNamePy3") |
390 "VirtualEnvironmentNamePy3") |
368 else: |
391 else: |
691 def __configureFlaskForProject(self): |
714 def __configureFlaskForProject(self): |
692 """ |
715 """ |
693 Private slot to configure the project specific flask parameters. |
716 Private slot to configure the project specific flask parameters. |
694 """ |
717 """ |
695 # TODO: implement the flask project config dialog |
718 # TODO: implement the flask project config dialog |
696 # 1. check boxes to override flask-babel and flask-migrate |
|
697 # 2. support for project specific virtual environment |
719 # 2. support for project specific virtual environment |
|
720 from .FlaskConfigDialog import FlaskConfigDialog |
|
721 |
|
722 config = self.getData("flask", "") |
|
723 dlg = FlaskConfigDialog(config) |
|
724 if dlg.exec() == QDialog.Accepted: |
|
725 config = dlg.getConfiguration() |
|
726 self.setData("flask", "", config) |
698 |
727 |
699 ################################################################## |
728 ################################################################## |
700 ## slot below implements documentation function |
729 ## slot below implements documentation function |
701 ################################################################## |
730 ################################################################## |
702 |
731 |