ProjectPyramid/Project.py

changeset 8
ac62d7dc6a37
parent 5
455dc39cd212
child 9
0ebc5b152c6c
equal deleted inserted replaced
7:d8545e81637f 8:ac62d7dc6a37
10 import os 10 import os
11 import configparser 11 import configparser
12 import re 12 import re
13 13
14 from PyQt4.QtCore import QObject, QFileInfo, QProcess, QTimer, QUrl 14 from PyQt4.QtCore import QObject, QFileInfo, QProcess, QTimer, QUrl
15 from PyQt4.QtGui import QMenu, QDialog, QInputDialog, QDesktopServices 15 from PyQt4.QtGui import QMenu, QDialog, QInputDialog, QDesktopServices, QLineEdit
16 16
17 from E5Gui.E5Application import e5App 17 from E5Gui.E5Application import e5App
18 from E5Gui import E5MessageBox, E5FileDialog 18 from E5Gui import E5MessageBox, E5FileDialog
19 from E5Gui.E5Action import E5Action 19 from E5Gui.E5Action import E5Action
20 20
61 """ 61 """
62 Public method to define the Pyramid actions. 62 Public method to define the Pyramid actions.
63 """ 63 """
64 # TODO: create action for: prequest 64 # TODO: create action for: prequest
65 # TODO: create action for: proutes 65 # TODO: create action for: proutes
66 # TODO: create action for: pviews
67 # TODO: create action for: ptweens 66 # TODO: create action for: ptweens
68 self.actions = [] 67 self.actions = []
69 68
70 self.selectProjectAct = E5Action(self.trUtf8('Current Pyramid Project'), 69 self.selectProjectAct = E5Action(self.trUtf8('Current Pyramid Project'),
71 "", 70 "",
191 """<p>Initializes (or re-initializes) the database of the current""" 190 """<p>Initializes (or re-initializes) the database of the current"""
192 """ Pyramid project.</p>""" 191 """ Pyramid project.</p>"""
193 )) 192 ))
194 self.initializeDbAct.triggered[()].connect(self.__initializeDatabase) 193 self.initializeDbAct.triggered[()].connect(self.__initializeDatabase)
195 self.actions.append(self.initializeDbAct) 194 self.actions.append(self.initializeDbAct)
195
196 ###############################
197 ## show actions below ##
198 ###############################
199
200 self.showViewsAct = E5Action(self.trUtf8('Show Matching Views'),
201 self.trUtf8('Show Matching &Views'),
202 0, 0,
203 self,'pyramid_show_views')
204 self.showViewsAct.setStatusTip(self.trUtf8(
205 'Show views matching a given URL'))
206 self.showViewsAct.setWhatsThis(self.trUtf8(
207 """<b>Show Matching Views</b>"""
208 """<p>Show views matching a given URL.</p>"""
209 ))
210 self.showViewsAct.triggered[()].connect(self.__showMatchingViews)
211 self.actions.append(self.showViewsAct)
196 212
197 ################################## 213 ##################################
198 ## distribution actions below ## 214 ## distribution actions below ##
199 ################################## 215 ##################################
200 216
266 menu.addAction(self.createProjectAct) 282 menu.addAction(self.createProjectAct)
267 menu.addSeparator() 283 menu.addSeparator()
268 menu.addAction(self.setupDevelopAct) 284 menu.addAction(self.setupDevelopAct)
269 menu.addSeparator() 285 menu.addSeparator()
270 menu.addAction(self.initializeDbAct) 286 menu.addAction(self.initializeDbAct)
287 menu.addSeparator()
288 menu.addAction(self.showViewsAct)
271 menu.addSeparator() 289 menu.addSeparator()
272 menu.addAction(self.runPythonShellAct) 290 menu.addAction(self.runPythonShellAct)
273 menu.addSeparator() 291 menu.addSeparator()
274 menu.addAction(self.buildDistroAct) 292 menu.addAction(self.buildDistroAct)
275 menu.addSeparator() 293 menu.addSeparator()
865 res = dia.startProcess(cmd, args, projectPath) 883 res = dia.startProcess(cmd, args, projectPath)
866 if res: 884 if res:
867 dia.exec_() 885 dia.exec_()
868 886
869 ################################################################## 887 ##################################################################
888 ## slots below implement various debugging functions
889 ##################################################################
890
891 def __showMatchingViews(self):
892 """
893 Private slot showing all views that would match a given URL.
894 """
895 title = self.trUtf8("Show Matching Views")
896 try:
897 projectPath = self.__projectPath()
898 except PyramidNoProjectSelectedException:
899 E5MessageBox.warning(self.__ui,
900 title,
901 self.trUtf8('No current Pyramid project selected or no Pyramid project'
902 ' created yet. Aborting...'))
903 return
904
905 url, ok = QInputDialog.getText(
906 self.__ui,
907 self.trUtf8("Show Matching Views"),
908 self.trUtf8("Enter the URL to be matched:"),
909 QLineEdit.Normal,
910 "/")
911 if not ok or url == "":
912 return
913
914 cmd = self.getPyramidCommand("pviews")
915 args = []
916 args.append("development.ini")
917 args.append(url)
918
919 dia = PyramidDialog(title, fixed=True, linewrap=False)
920 res = dia.startProcess(cmd, args, projectPath)
921 if res:
922 dia.exec_()
923
924 ##################################################################
870 ## slots below implement documentation functions 925 ## slots below implement documentation functions
871 ################################################################## 926 ##################################################################
872 927
873 def __showDocumentation(self): 928 def __showDocumentation(self):
874 """ 929 """

eric ide

mercurial