ProjectPyramid/Project.py

changeset 9
0ebc5b152c6c
parent 8
ac62d7dc6a37
child 10
3330f7087434
diff -r ac62d7dc6a37 -r 0ebc5b152c6c ProjectPyramid/Project.py
--- a/ProjectPyramid/Project.py	Wed Aug 29 15:33:31 2012 +0200
+++ b/ProjectPyramid/Project.py	Wed Aug 29 15:48:01 2012 +0200
@@ -62,7 +62,6 @@
         Public method to define the Pyramid actions.
         """
         # TODO: create action for: prequest
-        # TODO: create action for: proutes
         # TODO: create action for: ptweens
         self.actions = []
     
@@ -210,6 +209,20 @@
         self.showViewsAct.triggered[()].connect(self.__showMatchingViews)
         self.actions.append(self.showViewsAct)
         
+        self.showRoutesAct = E5Action(self.trUtf8('Show All Routes'),
+                self.trUtf8('Show All &Routes'), 
+                0, 0,
+                self,'pyramid_show_routes')
+        self.showRoutesAct.setStatusTip(self.trUtf8(
+            'Show all URL dispatch routes used by a Pyramid application'))
+        self.showRoutesAct.setWhatsThis(self.trUtf8(
+            """<b>Show All Routes</b>"""
+            """<p>Show all URL dispatch routes used by a Pyramid application"""
+            """ in the order in which they are evaluated.</p>"""
+        ))
+        self.showRoutesAct.triggered[()].connect(self.__showRoutes)
+        self.actions.append(self.showRoutesAct)
+        
         ##################################
         ## distribution actions below   ##
         ##################################
@@ -286,6 +299,7 @@
         menu.addAction(self.initializeDbAct)
         menu.addSeparator()
         menu.addAction(self.showViewsAct)
+        menu.addAction(self.showRoutesAct)
         menu.addSeparator()
         menu.addAction(self.runPythonShellAct)
         menu.addSeparator()
@@ -921,6 +935,30 @@
         if res:
             dia.exec_()
     
+    def __showRoutes(self):
+        """
+        Private slot showing all URL dispatch routes.
+        """
+        # TODO: use a specialized dialog parsing the output of proutes
+        title = self.trUtf8("Show All Routes")
+        try:
+            projectPath = self.__projectPath()
+        except PyramidNoProjectSelectedException:
+            E5MessageBox.warning(self.__ui,
+                title,
+                self.trUtf8('No current Pyramid project selected or no Pyramid project'
+                            ' created yet. Aborting...'))
+            return
+        
+        cmd = self.getPyramidCommand("proutes")
+        args = []
+        args.append("development.ini")
+
+        dia = PyramidDialog(title, fixed=True, linewrap=False)
+        res = dia.startProcess(cmd, args, projectPath)
+        if res:
+            dia.exec_()
+    
     ##################################################################
     ## slots below implement documentation functions
     ##################################################################

eric ide

mercurial