ProjectPyramid/Project.py

changeset 19
f4adfe6e51b0
parent 14
e3cb581b4653
child 34
d20f7218d53c
equal deleted inserted replaced
18:c27d4435675a 19:f4adfe6e51b0
38 38
39 class Project(QObject): 39 class Project(QObject):
40 """ 40 """
41 Class implementing the Pyramid project support. 41 Class implementing the Pyramid project support.
42 """ 42 """
43 def __init__(self, plugin, parent = None): 43 def __init__(self, plugin, parent=None):
44 """ 44 """
45 Constructor 45 Constructor
46 46
47 @param plugin reference to the plugin object 47 @param plugin reference to the plugin object
48 @param parent parent (QObject) 48 @param parent parent (QObject)
65 self.actions = [] 65 self.actions = []
66 66
67 self.selectProjectAct = E5Action(self.trUtf8('Current Pyramid Project'), 67 self.selectProjectAct = E5Action(self.trUtf8('Current Pyramid Project'),
68 "", 68 "",
69 0, 0, 69 0, 0,
70 self,'pyramid_current_project') 70 self, 'pyramid_current_project')
71 self.selectProjectAct.setStatusTip(self.trUtf8( 71 self.selectProjectAct.setStatusTip(self.trUtf8(
72 'Selects the current Pyramid project')) 72 'Selects the current Pyramid project'))
73 self.selectProjectAct.setWhatsThis(self.trUtf8( 73 self.selectProjectAct.setWhatsThis(self.trUtf8(
74 """<b>Current Pyramid Project</b>""" 74 """<b>Current Pyramid Project</b>"""
75 """<p>Selects the Pyramid project. Used for multi-project """ 75 """<p>Selects the Pyramid project. Used for multi-project """
81 ############################### 81 ###############################
82 ## create actions below ## 82 ## create actions below ##
83 ############################### 83 ###############################
84 84
85 self.createProjectAct = E5Action(self.trUtf8('Create Pyramid Project'), 85 self.createProjectAct = E5Action(self.trUtf8('Create Pyramid Project'),
86 self.trUtf8('Create Pyramid &Project'), 86 self.trUtf8('Create Pyramid &Project'),
87 0, 0, 87 0, 0,
88 self,'pyramid_create_project') 88 self, 'pyramid_create_project')
89 self.createProjectAct.setStatusTip(self.trUtf8( 89 self.createProjectAct.setStatusTip(self.trUtf8(
90 'Creates a new Pyramid project')) 90 'Creates a new Pyramid project'))
91 self.createProjectAct.setWhatsThis(self.trUtf8( 91 self.createProjectAct.setWhatsThis(self.trUtf8(
92 """<b>Create Pyramid Project</b>""" 92 """<b>Create Pyramid Project</b>"""
93 """<p>Creates a new Pyramid project using "pcreate".</p>""" 93 """<p>Creates a new Pyramid project using "pcreate".</p>"""
98 ############################## 98 ##############################
99 ## run actions below ## 99 ## run actions below ##
100 ############################## 100 ##############################
101 101
102 self.runServerAct = E5Action(self.trUtf8('Run Server'), 102 self.runServerAct = E5Action(self.trUtf8('Run Server'),
103 self.trUtf8('Run &Server'), 103 self.trUtf8('Run &Server'),
104 0, 0, 104 0, 0,
105 self,'pyramid_run_server') 105 self, 'pyramid_run_server')
106 self.runServerAct.setStatusTip(self.trUtf8( 106 self.runServerAct.setStatusTip(self.trUtf8(
107 'Starts the Pyramid Web server')) 107 'Starts the Pyramid Web server'))
108 self.runServerAct.setWhatsThis(self.trUtf8( 108 self.runServerAct.setWhatsThis(self.trUtf8(
109 """<b>Run Server</b>""" 109 """<b>Run Server</b>"""
110 """<p>Starts the Pyramid Web server using""" 110 """<p>Starts the Pyramid Web server using"""
112 )) 112 ))
113 self.runServerAct.triggered[()].connect(self.__runServer) 113 self.runServerAct.triggered[()].connect(self.__runServer)
114 self.actions.append(self.runServerAct) 114 self.actions.append(self.runServerAct)
115 115
116 self.runLoggingServerAct = E5Action(self.trUtf8('Run Server with Logging'), 116 self.runLoggingServerAct = E5Action(self.trUtf8('Run Server with Logging'),
117 self.trUtf8('Run Server with &Logging'), 117 self.trUtf8('Run Server with &Logging'),
118 0, 0, 118 0, 0,
119 self,'pyramid_run_logging_server') 119 self, 'pyramid_run_logging_server')
120 self.runLoggingServerAct.setStatusTip(self.trUtf8( 120 self.runLoggingServerAct.setStatusTip(self.trUtf8(
121 'Starts the Pyramid Web server with logging')) 121 'Starts the Pyramid Web server with logging'))
122 self.runLoggingServerAct.setWhatsThis(self.trUtf8( 122 self.runLoggingServerAct.setWhatsThis(self.trUtf8(
123 """<b>Run Server with Logging</b>""" 123 """<b>Run Server with Logging</b>"""
124 """<p>Starts the Pyramid Web server with logging using""" 124 """<p>Starts the Pyramid Web server with logging using"""
126 )) 126 ))
127 self.runLoggingServerAct.triggered[()].connect(self.__runLoggingServer) 127 self.runLoggingServerAct.triggered[()].connect(self.__runLoggingServer)
128 self.actions.append(self.runLoggingServerAct) 128 self.actions.append(self.runLoggingServerAct)
129 129
130 self.runBrowserAct = E5Action(self.trUtf8('Run Web-Browser'), 130 self.runBrowserAct = E5Action(self.trUtf8('Run Web-Browser'),
131 self.trUtf8('Run &Web-Browser'), 131 self.trUtf8('Run &Web-Browser'),
132 0, 0, 132 0, 0,
133 self,'pyramid_run_browser') 133 self, 'pyramid_run_browser')
134 self.runBrowserAct.setStatusTip(self.trUtf8( 134 self.runBrowserAct.setStatusTip(self.trUtf8(
135 'Starts the default Web-Browser with the URL of the Pyramid Web server')) 135 'Starts the default Web-Browser with the URL of the Pyramid Web server'))
136 self.runBrowserAct.setWhatsThis(self.trUtf8( 136 self.runBrowserAct.setWhatsThis(self.trUtf8(
137 """<b>Run Web-Browser</b>""" 137 """<b>Run Web-Browser</b>"""
138 """<p>Starts the default Web-Browser with the URL of the """ 138 """<p>Starts the default Web-Browser with the URL of the """
140 )) 140 ))
141 self.runBrowserAct.triggered[()].connect(self.__runBrowser) 141 self.runBrowserAct.triggered[()].connect(self.__runBrowser)
142 self.actions.append(self.runBrowserAct) 142 self.actions.append(self.runBrowserAct)
143 143
144 self.runPythonShellAct = E5Action(self.trUtf8('Start Pyramid Python Console'), 144 self.runPythonShellAct = E5Action(self.trUtf8('Start Pyramid Python Console'),
145 self.trUtf8('Start Pyramid &Python Console'), 145 self.trUtf8('Start Pyramid &Python Console'),
146 0, 0, 146 0, 0,
147 self,'pyramid_python_console') 147 self, 'pyramid_python_console')
148 self.runPythonShellAct.setStatusTip(self.trUtf8( 148 self.runPythonShellAct.setStatusTip(self.trUtf8(
149 'Starts an interactive Python interpreter')) 149 'Starts an interactive Python interpreter'))
150 self.runPythonShellAct.setWhatsThis(self.trUtf8( 150 self.runPythonShellAct.setWhatsThis(self.trUtf8(
151 """<b>Start Pyramid Python Console</b>""" 151 """<b>Start Pyramid Python Console</b>"""
152 """<p>Starts an interactive Python interpreter.</p>""" 152 """<p>Starts an interactive Python interpreter.</p>"""
157 ############################## 157 ##############################
158 ## setup actions below ## 158 ## setup actions below ##
159 ############################## 159 ##############################
160 160
161 self.setupDevelopAct = E5Action(self.trUtf8('Setup Development Environment'), 161 self.setupDevelopAct = E5Action(self.trUtf8('Setup Development Environment'),
162 self.trUtf8('Setup &Development Environment'), 162 self.trUtf8('Setup &Development Environment'),
163 0, 0, 163 0, 0,
164 self,'pyramid_setup_development') 164 self, 'pyramid_setup_development')
165 self.setupDevelopAct.setStatusTip(self.trUtf8( 165 self.setupDevelopAct.setStatusTip(self.trUtf8(
166 'Setup the Pyramid project in development mode')) 166 'Setup the Pyramid project in development mode'))
167 self.setupDevelopAct.setWhatsThis(self.trUtf8( 167 self.setupDevelopAct.setWhatsThis(self.trUtf8(
168 """<b>Setup Development Environment</b>""" 168 """<b>Setup Development Environment</b>"""
169 """<p>Setup the Pyramid project in development mode using""" 169 """<p>Setup the Pyramid project in development mode using"""
175 ############################### 175 ###############################
176 ## database actions below ## 176 ## database actions below ##
177 ############################### 177 ###############################
178 178
179 self.initializeDbAct = E5Action(self.trUtf8('Initialize Database'), 179 self.initializeDbAct = E5Action(self.trUtf8('Initialize Database'),
180 self.trUtf8('Initialize &Database'), 180 self.trUtf8('Initialize &Database'),
181 0, 0, 181 0, 0,
182 self,'pyramid_initialize_database') 182 self, 'pyramid_initialize_database')
183 self.initializeDbAct.setStatusTip(self.trUtf8( 183 self.initializeDbAct.setStatusTip(self.trUtf8(
184 'Initializes (or re-initializes) the database of the current' 184 'Initializes (or re-initializes) the database of the current'
185 ' Pyramid project')) 185 ' Pyramid project'))
186 self.initializeDbAct.setWhatsThis(self.trUtf8( 186 self.initializeDbAct.setWhatsThis(self.trUtf8(
187 """<b>Initialize Database</b>""" 187 """<b>Initialize Database</b>"""
194 ############################### 194 ###############################
195 ## show actions below ## 195 ## show actions below ##
196 ############################### 196 ###############################
197 197
198 self.showViewsAct = E5Action(self.trUtf8('Show Matching Views'), 198 self.showViewsAct = E5Action(self.trUtf8('Show Matching Views'),
199 self.trUtf8('Show Matching &Views'), 199 self.trUtf8('Show Matching &Views'),
200 0, 0, 200 0, 0,
201 self,'pyramid_show_views') 201 self, 'pyramid_show_views')
202 self.showViewsAct.setStatusTip(self.trUtf8( 202 self.showViewsAct.setStatusTip(self.trUtf8(
203 'Show views matching a given URL')) 203 'Show views matching a given URL'))
204 self.showViewsAct.setWhatsThis(self.trUtf8( 204 self.showViewsAct.setWhatsThis(self.trUtf8(
205 """<b>Show Matching Views</b>""" 205 """<b>Show Matching Views</b>"""
206 """<p>Show views matching a given URL.</p>""" 206 """<p>Show views matching a given URL.</p>"""
207 )) 207 ))
208 self.showViewsAct.triggered[()].connect(self.__showMatchingViews) 208 self.showViewsAct.triggered[()].connect(self.__showMatchingViews)
209 self.actions.append(self.showViewsAct) 209 self.actions.append(self.showViewsAct)
210 210
211 self.showRoutesAct = E5Action(self.trUtf8('Show Routes'), 211 self.showRoutesAct = E5Action(self.trUtf8('Show Routes'),
212 self.trUtf8('Show &Routes'), 212 self.trUtf8('Show &Routes'),
213 0, 0, 213 0, 0,
214 self,'pyramid_show_routes') 214 self, 'pyramid_show_routes')
215 self.showRoutesAct.setStatusTip(self.trUtf8( 215 self.showRoutesAct.setStatusTip(self.trUtf8(
216 'Show all URL dispatch routes used by a Pyramid application')) 216 'Show all URL dispatch routes used by a Pyramid application'))
217 self.showRoutesAct.setWhatsThis(self.trUtf8( 217 self.showRoutesAct.setWhatsThis(self.trUtf8(
218 """<b>Show Routes</b>""" 218 """<b>Show Routes</b>"""
219 """<p>Show all URL dispatch routes used by a Pyramid application""" 219 """<p>Show all URL dispatch routes used by a Pyramid application"""
221 )) 221 ))
222 self.showRoutesAct.triggered[()].connect(self.__showRoutes) 222 self.showRoutesAct.triggered[()].connect(self.__showRoutes)
223 self.actions.append(self.showRoutesAct) 223 self.actions.append(self.showRoutesAct)
224 224
225 self.showTweensAct = E5Action(self.trUtf8('Show Tween Objects'), 225 self.showTweensAct = E5Action(self.trUtf8('Show Tween Objects'),
226 self.trUtf8('Show &Tween Objects'), 226 self.trUtf8('Show &Tween Objects'),
227 0, 0, 227 0, 0,
228 self,'pyramid_show_routes') 228 self, 'pyramid_show_routes')
229 self.showTweensAct.setStatusTip(self.trUtf8( 229 self.showTweensAct.setStatusTip(self.trUtf8(
230 'Show all implicit and explicit tween objects used by a Pyramid application')) 230 'Show all implicit and explicit tween objects used by a Pyramid application'))
231 self.showTweensAct.setWhatsThis(self.trUtf8( 231 self.showTweensAct.setWhatsThis(self.trUtf8(
232 """<b>Show Tween Objects</b>""" 232 """<b>Show Tween Objects</b>"""
233 """<p>Show all implicit and explicit tween objects used by a""" 233 """<p>Show all implicit and explicit tween objects used by a"""
239 ################################## 239 ##################################
240 ## distribution actions below ## 240 ## distribution actions below ##
241 ################################## 241 ##################################
242 242
243 self.buildDistroAct = E5Action(self.trUtf8('Build Distribution'), 243 self.buildDistroAct = E5Action(self.trUtf8('Build Distribution'),
244 self.trUtf8('Build &Distribution'), 244 self.trUtf8('Build &Distribution'),
245 0, 0, 245 0, 0,
246 self,'pyramid_build_distribution') 246 self, 'pyramid_build_distribution')
247 self.buildDistroAct.setStatusTip(self.trUtf8( 247 self.buildDistroAct.setStatusTip(self.trUtf8(
248 'Builds a distribution file for the Pyramid project')) 248 'Builds a distribution file for the Pyramid project'))
249 self.buildDistroAct.setWhatsThis(self.trUtf8( 249 self.buildDistroAct.setWhatsThis(self.trUtf8(
250 """<b>Build Distribution</b>""" 250 """<b>Build Distribution</b>"""
251 """<p>Builds a distribution file for the Pyramid project using""" 251 """<p>Builds a distribution file for the Pyramid project using"""
257 ################################## 257 ##################################
258 ## documentation action below ## 258 ## documentation action below ##
259 ################################## 259 ##################################
260 260
261 self.documentationAct = E5Action(self.trUtf8('Documentation'), 261 self.documentationAct = E5Action(self.trUtf8('Documentation'),
262 self.trUtf8('D&ocumentation'), 262 self.trUtf8('D&ocumentation'),
263 0, 0, 263 0, 0,
264 self,'pyramid_documentation') 264 self, 'pyramid_documentation')
265 self.documentationAct.setStatusTip(self.trUtf8( 265 self.documentationAct.setStatusTip(self.trUtf8(
266 'Shows the help viewer with the Pyramid documentation')) 266 'Shows the help viewer with the Pyramid documentation'))
267 self.documentationAct.setWhatsThis(self.trUtf8( 267 self.documentationAct.setWhatsThis(self.trUtf8(
268 """<b>Documentation</b>""" 268 """<b>Documentation</b>"""
269 """<p>Shows the help viewer with the Pyramid documentation.</p>""" 269 """<p>Shows the help viewer with the Pyramid documentation.</p>"""
274 ############################## 274 ##############################
275 ## about action below ## 275 ## about action below ##
276 ############################## 276 ##############################
277 277
278 self.aboutPyramidAct = E5Action(self.trUtf8('About Pyramid'), 278 self.aboutPyramidAct = E5Action(self.trUtf8('About Pyramid'),
279 self.trUtf8('About P&yramid'), 279 self.trUtf8('About P&yramid'),
280 0, 0, 280 0, 0,
281 self,'pyramid_about') 281 self, 'pyramid_about')
282 self.aboutPyramidAct.setStatusTip(self.trUtf8( 282 self.aboutPyramidAct.setStatusTip(self.trUtf8(
283 'Shows some information about Pyramid')) 283 'Shows some information about Pyramid'))
284 self.aboutPyramidAct.setWhatsThis(self.trUtf8( 284 self.aboutPyramidAct.setWhatsThis(self.trUtf8(
285 """<b>About Pyramid</b>""" 285 """<b>About Pyramid</b>"""
286 """<p>Shows some information about Pyramid.</p>""" 286 """<p>Shows some information about Pyramid.</p>"""
331 Public method to add our hook methods. 331 Public method to add our hook methods.
332 """ 332 """
333 if self.__e5project.getProjectType() == "Pyramid": 333 if self.__e5project.getProjectType() == "Pyramid":
334 self.__formsBrowser = \ 334 self.__formsBrowser = \
335 e5App().getObject("ProjectBrowser").getProjectBrowser("forms") 335 e5App().getObject("ProjectBrowser").getProjectBrowser("forms")
336 self.__formsBrowser.addHookMethodAndMenuEntry("newForm", 336 self.__formsBrowser.addHookMethodAndMenuEntry("newForm",
337 self.newForm, self.trUtf8("New template...")) 337 self.newForm, self.trUtf8("New template..."))
338 338
339 if self.__e5project.getProjectLanguage() == "Python2": 339 if self.__e5project.getProjectLanguage() == "Python2":
340 # Babel and lingua are not yet available for Python 3 340 # Babel and lingua are not yet available for Python 3
341 self.__e5project.projectLanguageAddedByCode.connect( 341 self.__e5project.projectLanguageAddedByCode.connect(
342 self.__projectLanguageAdded) 342 self.__projectLanguageAdded)
343 self.__translationsBrowser = \ 343 self.__translationsBrowser = \
344 e5App().getObject("ProjectBrowser").getProjectBrowser("translations") 344 e5App().getObject("ProjectBrowser").getProjectBrowser("translations")
345 self.__translationsBrowser.addHookMethodAndMenuEntry("extractMessages", 345 self.__translationsBrowser.addHookMethodAndMenuEntry("extractMessages",
346 self.extractMessages, self.trUtf8("Extract Messages")) 346 self.extractMessages, self.trUtf8("Extract Messages"))
347 self.__translationsBrowser.addHookMethodAndMenuEntry("releaseAll", 347 self.__translationsBrowser.addHookMethodAndMenuEntry("releaseAll",
348 self.compileCatalogs, self.trUtf8("Compile All Catalogs")) 348 self.compileCatalogs, self.trUtf8("Compile All Catalogs"))
349 self.__translationsBrowser.addHookMethodAndMenuEntry("releaseSelected", 349 self.__translationsBrowser.addHookMethodAndMenuEntry("releaseSelected",
350 self.compileSelectedCatalogs, 350 self.compileSelectedCatalogs,
351 self.trUtf8("Compile Selected Catalogs")) 351 self.trUtf8("Compile Selected Catalogs"))
352 self.__translationsBrowser.addHookMethodAndMenuEntry("generateAll", 352 self.__translationsBrowser.addHookMethodAndMenuEntry("generateAll",
353 self.updateCatalogs, self.trUtf8("Update All Catalogs")) 353 self.updateCatalogs, self.trUtf8("Update All Catalogs"))
354 self.__translationsBrowser.addHookMethodAndMenuEntry("generateSelected", 354 self.__translationsBrowser.addHookMethodAndMenuEntry("generateSelected",
355 self.updateSelectedCatalogs, self.trUtf8("Update Selected Catalogs")) 355 self.updateSelectedCatalogs, self.trUtf8("Update Selected Catalogs"))
356 356
357 self.__hooksInstalled = True 357 self.__hooksInstalled = True
358 358
359 def projectClosedHooks(self): 359 def projectClosedHooks(self):
409 409
410 if os.path.exists(fname): 410 if os.path.exists(fname):
411 res = E5MessageBox.yesNo(self.__ui, 411 res = E5MessageBox.yesNo(self.__ui,
412 self.trUtf8("New Form"), 412 self.trUtf8("New Form"),
413 self.trUtf8("""The file already exists! Overwrite it?"""), 413 self.trUtf8("""The file already exists! Overwrite it?"""),
414 icon = E5MessageBox.Warning) 414 icon=E5MessageBox.Warning)
415 if not res: 415 if not res:
416 # user selected to not overwrite 416 # user selected to not overwrite
417 return 417 return
418 418
419 try: 419 try:
570 ## methods below implement site related functions 570 ## methods below implement site related functions
571 ################################################################## 571 ##################################################################
572 572
573 def __findProjects(self): 573 def __findProjects(self):
574 """ 574 """
575 Private method to determine the relative path of all Pyramid 575 Private method to determine the relative path of all Pyramid
576 projects (= top level dirs). 576 projects (= top level dirs).
577 577
578 @return list of projects (list of string) 578 @return list of projects (list of string)
579 """ 579 """
580 projects = [] 580 projects = []
625 self.__selectProject() 625 self.__selectProject()
626 626
627 if self.__currentProject is None: 627 if self.__currentProject is None:
628 raise PyramidNoProjectSelectedException 628 raise PyramidNoProjectSelectedException
629 else: 629 else:
630 return os.path.join(self.__e5project.getProjectPath(), 630 return os.path.join(self.__e5project.getProjectPath(),
631 self.__currentProject) 631 self.__currentProject)
632 632
633 def __setCurrentProject(self, project): 633 def __setCurrentProject(self, project):
634 """ 634 """
635 Private slot to set the current project. 635 Private slot to set the current project.
654 config = configparser.ConfigParser() 654 config = configparser.ConfigParser()
655 config.read(os.path.join(self.__projectPath(), "setup.cfg")) 655 config.read(os.path.join(self.__projectPath(), "setup.cfg"))
656 outputDir = config.get("init_catalog", "output_dir") 656 outputDir = config.get("init_catalog", "output_dir")
657 domain = config.get("init_catalog", "domain") 657 domain = config.get("init_catalog", "domain")
658 self.__e5project.pdata["TRANSLATIONPATTERN"] = [ 658 self.__e5project.pdata["TRANSLATIONPATTERN"] = [
659 os.path.join(project, outputDir, "%language%", 659 os.path.join(project, outputDir, "%language%",
660 "LC_MESSAGES", "{0}.po".format(domain)) 660 "LC_MESSAGES", "{0}.po".format(domain))
661 ] 661 ]
662 662
663 if self.__currentProject is None: 663 if self.__currentProject is None:
664 self.initializeDbAct.setEnabled(False) 664 self.initializeDbAct.setEnabled(False)
683 683
684 ################################################################## 684 ##################################################################
685 ## slots below implement run functions 685 ## slots below implement run functions
686 ################################################################## 686 ##################################################################
687 687
688 def __runServer(self, logging = False): 688 def __runServer(self, logging=False):
689 """ 689 """
690 Private slot to start the Pyramid Web server. 690 Private slot to start the Pyramid Web server.
691 691
692 @param logging flag indicating to enable logging (boolean) 692 @param logging flag indicating to enable logging (boolean)
693 """ 693 """
823 cmd = self.getPythonCommand() 823 cmd = self.getPythonCommand()
824 args = [] 824 args = []
825 args.append("setup.py") 825 args.append("setup.py")
826 args.append("develop") 826 args.append("develop")
827 827
828 dia = PyramidDialog(title, 828 dia = PyramidDialog(title,
829 msgSuccess = \ 829 msgSuccess=self.trUtf8("Pyramid development environment setup successfully."))
830 self.trUtf8("Pyramid development environment setup successfully."))
831 res = dia.startProcess(cmd, args, wd) 830 res = dia.startProcess(cmd, args, wd)
832 if res: 831 if res:
833 dia.exec_() 832 dia.exec_()
834 833
835 ################################################################## 834 ##################################################################
858 args.append("setup.py") 857 args.append("setup.py")
859 args.append("sdist") 858 args.append("sdist")
860 if formats: 859 if formats:
861 args.append("--formats={0}".format(','.join(formats))) 860 args.append("--formats={0}".format(','.join(formats)))
862 861
863 dia = PyramidDialog(title, 862 dia = PyramidDialog(title,
864 msgSuccess = \ 863 msgSuccess=self.trUtf8("Python distribution file built successfully."))
865 self.trUtf8("Python distribution file built successfully."))
866 res = dia.startProcess(cmd, args, projectPath) 864 res = dia.startProcess(cmd, args, projectPath)
867 if res: 865 if res:
868 dia.exec_() 866 dia.exec_()
869 867
870 ################################################################## 868 ##################################################################
903 901
904 cmd = self.__getInitDbCommand() 902 cmd = self.__getInitDbCommand()
905 args = [] 903 args = []
906 args.append("development.ini") 904 args.append("development.ini")
907 905
908 dia = PyramidDialog(title, 906 dia = PyramidDialog(title,
909 msgSuccess = \ 907 msgSuccess=self.trUtf8("Database initialized successfully."))
910 self.trUtf8("Database initialized successfully."))
911 res = dia.startProcess(cmd, args, projectPath) 908 res = dia.startProcess(cmd, args, projectPath)
912 if res: 909 if res:
913 dia.exec_() 910 dia.exec_()
914 911
915 ################################################################## 912 ##################################################################
1075 cmd = self.getPythonCommand() 1072 cmd = self.getPythonCommand()
1076 args = [] 1073 args = []
1077 args.append("setup.py") 1074 args.append("setup.py")
1078 args.append("extract_messages") 1075 args.append("extract_messages")
1079 1076
1080 dia = PyramidDialog(title, 1077 dia = PyramidDialog(title,
1081 msgSuccess = \ 1078 msgSuccess=self.trUtf8("\nMessages extracted successfully."))
1082 self.trUtf8("\nMessages extracted successfully."))
1083 res = dia.startProcess(cmd, args, projectPath) 1079 res = dia.startProcess(cmd, args, projectPath)
1084 if res: 1080 if res:
1085 dia.exec_() 1081 dia.exec_()
1086 1082
1087 config = configparser.ConfigParser() 1083 config = configparser.ConfigParser()
1123 args.append("setup.py") 1119 args.append("setup.py")
1124 args.append("init_catalog") 1120 args.append("init_catalog")
1125 args.append("-l") 1121 args.append("-l")
1126 args.append(code) 1122 args.append(code)
1127 1123
1128 dia = PyramidDialog(title, 1124 dia = PyramidDialog(title,
1129 msgSuccess = \ 1125 msgSuccess=self.trUtf8("\nMessage catalog initialized successfully."))
1130 self.trUtf8("\nMessage catalog initialized successfully."))
1131 res = dia.startProcess(cmd, args, projectPath) 1126 res = dia.startProcess(cmd, args, projectPath)
1132 if res: 1127 if res:
1133 dia.exec_() 1128 dia.exec_()
1134 1129
1135 langFile = self.__e4project.pdata["TRANSLATIONPATTERN"][0]\ 1130 langFile = self.__e4project.pdata["TRANSLATIONPATTERN"][0]\
1155 cmd = self.getPythonCommand() 1150 cmd = self.getPythonCommand()
1156 args = [] 1151 args = []
1157 args.append("setup.py") 1152 args.append("setup.py")
1158 args.append("compile_catalog") 1153 args.append("compile_catalog")
1159 1154
1160 dia = PyramidDialog(title, 1155 dia = PyramidDialog(title,
1161 msgSuccess = \ 1156 msgSuccess=self.trUtf8("\nMessage catalogs compiled successfully."))
1162 self.trUtf8("\nMessage catalogs compiled successfully."))
1163 res = dia.startProcess(cmd, args, projectPath) 1157 res = dia.startProcess(cmd, args, projectPath)
1164 if res: 1158 if res:
1165 dia.exec_() 1159 dia.exec_()
1166 1160
1167 for entry in os.walk(projectPath): 1161 for entry in os.walk(projectPath):
1203 E5MessageBox.warning(self.__ui, 1197 E5MessageBox.warning(self.__ui,
1204 title, 1198 title,
1205 self.trUtf8('No locales detected. Aborting...')) 1199 self.trUtf8('No locales detected. Aborting...'))
1206 return 1200 return
1207 1201
1208 dia = PyramidDialog(title, 1202 dia = PyramidDialog(title,
1209 msgSuccess = \ 1203 msgSuccess=self.trUtf8("\nMessage catalogs compiled successfully."))
1210 self.trUtf8("\nMessage catalogs compiled successfully."))
1211 res = dia.startBatchProcesses(argsLists, projectPath) 1204 res = dia.startBatchProcesses(argsLists, projectPath)
1212 if res: 1205 if res:
1213 dia.exec_() 1206 dia.exec_()
1214 1207
1215 for entry in os.walk(self.__sitePath()): 1208 for entry in os.walk(self.__sitePath()):
1237 cmd = self.getPythonCommand() 1230 cmd = self.getPythonCommand()
1238 args = [] 1231 args = []
1239 args.append("setup.py") 1232 args.append("setup.py")
1240 args.append("update_catalog") 1233 args.append("update_catalog")
1241 1234
1242 dia = PyramidDialog(title, 1235 dia = PyramidDialog(title,
1243 msgSuccess = \ 1236 msgSuccess=self.trUtf8("\nMessage catalogs updated successfully."))
1244 self.trUtf8("\nMessage catalogs updated successfully."))
1245 res = dia.startProcess(cmd, args, projectPath) 1237 res = dia.startProcess(cmd, args, projectPath)
1246 if res: 1238 if res:
1247 dia.exec_() 1239 dia.exec_()
1248 1240
1249 def updateSelectedCatalogs(self, filenames): 1241 def updateSelectedCatalogs(self, filenames):
1279 E5MessageBox.warning(self.__ui, 1271 E5MessageBox.warning(self.__ui,
1280 title, 1272 title,
1281 self.trUtf8('No locales detected. Aborting...')) 1273 self.trUtf8('No locales detected. Aborting...'))
1282 return 1274 return
1283 1275
1284 dia = PyramidDialog(title, 1276 dia = PyramidDialog(title,
1285 msgSuccess = \ 1277 msgSuccess=self.trUtf8("\nMessage catalogs updated successfully."))
1286 self.trUtf8("\nMessage catalogs updated successfully."))
1287 res = dia.startBatchProcesses(argsLists, projectPath) 1278 res = dia.startBatchProcesses(argsLists, projectPath)
1288 if res: 1279 if res:
1289 dia.exec_() 1280 dia.exec_()

eric ide

mercurial