ProjectFlask/Project.py

changeset 26
5aac667c4f0f
parent 18
d76a0939be6a
child 27
b73e9af0d496
diff -r 04803a0e2297 -r 5aac667c4f0f ProjectFlask/Project.py
--- a/ProjectFlask/Project.py	Mon Nov 23 17:35:10 2020 +0100
+++ b/ProjectFlask/Project.py	Mon Nov 23 18:11:28 2020 +0100
@@ -64,6 +64,7 @@
         self.__projectData = {
             "flask": {},
             "pybabel": {},
+            "migrate": {},
         }
         
         self.__flaskVersions = {
@@ -170,6 +171,7 @@
         ## database action below        ##
         ##################################
         
+        # TODO: replace this with 'flask-migrate'
         self.initDatabaseAct = E5Action(
             self.tr('Initialize Database'),
             self.tr('&Initialize Database'),
@@ -186,25 +188,6 @@
         self.actions.append(self.initDatabaseAct)
         
         ##################################
-        ## pybabel action below         ##
-        ##################################
-        
-        self.pybabelConfigAct = E5Action(
-            self.tr('Configure PyBabel'),
-            self.tr('Configure Py&Babel'),
-            0, 0,
-            self, 'flask_config_pybabel')
-        self.pybabelConfigAct.setStatusTip(self.tr(
-            'Shows a dialog to edit the configuration for pybabel'))
-        self.pybabelConfigAct.setWhatsThis(self.tr(
-            """<b>Configure PyBabel</b>"""
-            """<p>Shows a dialog to edit the configuration for pybabel.</p>"""
-        ))
-        self.pybabelConfigAct.triggered.connect(
-            self.__pybabelProject.configurePyBabel)
-        self.actions.append(self.pybabelConfigAct)
-        
-        ##################################
         ## documentation action below   ##
         ##################################
         
@@ -239,6 +222,8 @@
         ))
         self.aboutFlaskAct.triggered.connect(self.__flaskInfo)
         self.actions.append(self.aboutFlaskAct)
+        
+        self.__pybabelProject.initActions()
     
     def initMenu(self):
         """
@@ -249,6 +234,8 @@
         """
         self.__menus = {}   # clear menus references
         
+        self.__menus["pybabel"] = self.__pybabelProject.initMenu()
+        
         menu = QMenu(self.tr('&Flask'), self.__ui)
         menu.setTearOffEnabled(True)
         
@@ -262,7 +249,7 @@
         menu.addSeparator()
         menu.addAction(self.initDatabaseAct)
         menu.addSeparator()
-        menu.addAction(self.pybabelConfigAct)
+        menu.addMenu(self.__menus["pybabel"])
         menu.addSeparator()
         menu.addAction(self.documentationAct)
         menu.addSeparator()
@@ -528,7 +515,8 @@
                 "<tr><td>Python Version:</td><td>{2}</td></tr>"
                 "<tr><td>Flask URL:</td><td><a href=\"{3}\">"
                 "The Pallets Projects - Flask</a></td></tr>"
-                "</table></p>"
+                "</table></p>",
+                "Do not translate the program names."
             ).format(versions["flask"], versions["werkzeug"],
                      versions["python"], url),
             modal=True,
@@ -669,7 +657,6 @@
         """
         # 1. support for flask-babel (i.e. pybabel)
         self.__pybabelProject.determineCapability()
-        self.pybabelConfigAct.setEnabled(self.hasCapability("pybabel"))
         
         # 2. support for flask-migrate
         # TODO: add support for flask-migrate

eric ide

mercurial