--- a/ProjectPyramid/Project.py Wed Aug 29 15:32:44 2012 +0200 +++ b/ProjectPyramid/Project.py Wed Aug 29 15:33:31 2012 +0200 @@ -12,7 +12,7 @@ import re from PyQt4.QtCore import QObject, QFileInfo, QProcess, QTimer, QUrl -from PyQt4.QtGui import QMenu, QDialog, QInputDialog, QDesktopServices +from PyQt4.QtGui import QMenu, QDialog, QInputDialog, QDesktopServices, QLineEdit from E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog @@ -63,7 +63,6 @@ """ # TODO: create action for: prequest # TODO: create action for: proutes - # TODO: create action for: pviews # TODO: create action for: ptweens self.actions = [] @@ -194,6 +193,23 @@ self.initializeDbAct.triggered[()].connect(self.__initializeDatabase) self.actions.append(self.initializeDbAct) + ############################### + ## show actions below ## + ############################### + + self.showViewsAct = E5Action(self.trUtf8('Show Matching Views'), + self.trUtf8('Show Matching &Views'), + 0, 0, + self,'pyramid_show_views') + self.showViewsAct.setStatusTip(self.trUtf8( + 'Show views matching a given URL')) + self.showViewsAct.setWhatsThis(self.trUtf8( + """<b>Show Matching Views</b>""" + """<p>Show views matching a given URL.</p>""" + )) + self.showViewsAct.triggered[()].connect(self.__showMatchingViews) + self.actions.append(self.showViewsAct) + ################################## ## distribution actions below ## ################################## @@ -269,6 +285,8 @@ menu.addSeparator() menu.addAction(self.initializeDbAct) menu.addSeparator() + menu.addAction(self.showViewsAct) + menu.addSeparator() menu.addAction(self.runPythonShellAct) menu.addSeparator() menu.addAction(self.buildDistroAct) @@ -867,6 +885,43 @@ dia.exec_() ################################################################## + ## slots below implement various debugging functions + ################################################################## + + def __showMatchingViews(self): + """ + Private slot showing all views that would match a given URL. + """ + title = self.trUtf8("Show Matching Views") + 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 + + url, ok = QInputDialog.getText( + self.__ui, + self.trUtf8("Show Matching Views"), + self.trUtf8("Enter the URL to be matched:"), + QLineEdit.Normal, + "/") + if not ok or url == "": + return + + cmd = self.getPyramidCommand("pviews") + args = [] + args.append("development.ini") + args.append(url) + + dia = PyramidDialog(title, fixed=True, linewrap=False) + res = dia.startProcess(cmd, args, projectPath) + if res: + dia.exec_() + + ################################################################## ## slots below implement documentation functions ##################################################################