123 |
125 |
124 ############################### |
126 ############################### |
125 ## create actions below ## |
127 ## create actions below ## |
126 ############################### |
128 ############################### |
127 |
129 |
128 self.createProjectAct = E5Action(self.trUtf8('Create Pyramid Project'), |
130 self.createProjectAct = E5Action( |
129 self.trUtf8('Create Pyramid &Project'), |
131 self.trUtf8('Create Pyramid Project'), |
130 0, 0, |
132 self.trUtf8('Create Pyramid &Project'), |
131 self, 'pyramid_create_project') |
133 0, 0, |
|
134 self, 'pyramid_create_project') |
132 self.createProjectAct.setStatusTip(self.trUtf8( |
135 self.createProjectAct.setStatusTip(self.trUtf8( |
133 'Creates a new Pyramid project')) |
136 'Creates a new Pyramid project')) |
134 self.createProjectAct.setWhatsThis(self.trUtf8( |
137 self.createProjectAct.setWhatsThis(self.trUtf8( |
135 """<b>Create Pyramid Project</b>""" |
138 """<b>Create Pyramid Project</b>""" |
136 """<p>Creates a new Pyramid project using "pcreate".</p>""" |
139 """<p>Creates a new Pyramid project using "pcreate".</p>""" |
140 |
143 |
141 ############################## |
144 ############################## |
142 ## run actions below ## |
145 ## run actions below ## |
143 ############################## |
146 ############################## |
144 |
147 |
145 self.runServerAct = E5Action(self.trUtf8('Run Server'), |
148 self.runServerAct = E5Action( |
146 self.trUtf8('Run &Server'), |
149 self.trUtf8('Run Server'), |
147 0, 0, |
150 self.trUtf8('Run &Server'), |
148 self, 'pyramid_run_server') |
151 0, 0, |
|
152 self, 'pyramid_run_server') |
149 self.runServerAct.setStatusTip(self.trUtf8( |
153 self.runServerAct.setStatusTip(self.trUtf8( |
150 'Starts the Pyramid Web server')) |
154 'Starts the Pyramid Web server')) |
151 self.runServerAct.setWhatsThis(self.trUtf8( |
155 self.runServerAct.setWhatsThis(self.trUtf8( |
152 """<b>Run Server</b>""" |
156 """<b>Run Server</b>""" |
153 """<p>Starts the Pyramid Web server using""" |
157 """<p>Starts the Pyramid Web server using""" |
154 """ "pserve --reload development.ini".</p>""" |
158 """ "pserve --reload development.ini".</p>""" |
155 )) |
159 )) |
156 self.runServerAct.triggered[()].connect(self.__runServer) |
160 self.runServerAct.triggered[()].connect(self.__runServer) |
157 self.actions.append(self.runServerAct) |
161 self.actions.append(self.runServerAct) |
158 |
162 |
159 self.runLoggingServerAct = E5Action(self.trUtf8('Run Server with Logging'), |
163 self.runLoggingServerAct = E5Action( |
160 self.trUtf8('Run Server with &Logging'), |
164 self.trUtf8('Run Server with Logging'), |
161 0, 0, |
165 self.trUtf8('Run Server with &Logging'), |
162 self, 'pyramid_run_logging_server') |
166 0, 0, |
|
167 self, 'pyramid_run_logging_server') |
163 self.runLoggingServerAct.setStatusTip(self.trUtf8( |
168 self.runLoggingServerAct.setStatusTip(self.trUtf8( |
164 'Starts the Pyramid Web server with logging')) |
169 'Starts the Pyramid Web server with logging')) |
165 self.runLoggingServerAct.setWhatsThis(self.trUtf8( |
170 self.runLoggingServerAct.setWhatsThis(self.trUtf8( |
166 """<b>Run Server with Logging</b>""" |
171 """<b>Run Server with Logging</b>""" |
167 """<p>Starts the Pyramid Web server with logging using""" |
172 """<p>Starts the Pyramid Web server with logging using""" |
168 """ "pserve --log-file=server.log --reload development.ini".</p>""" |
173 """ "pserve --log-file=server.log --reload development.ini".</p>""" |
169 )) |
174 )) |
170 self.runLoggingServerAct.triggered[()].connect(self.__runLoggingServer) |
175 self.runLoggingServerAct.triggered[()].connect(self.__runLoggingServer) |
171 self.actions.append(self.runLoggingServerAct) |
176 self.actions.append(self.runLoggingServerAct) |
172 |
177 |
173 self.runBrowserAct = E5Action(self.trUtf8('Run Web-Browser'), |
178 self.runBrowserAct = E5Action( |
174 self.trUtf8('Run &Web-Browser'), |
179 self.trUtf8('Run Web-Browser'), |
175 0, 0, |
180 self.trUtf8('Run &Web-Browser'), |
176 self, 'pyramid_run_browser') |
181 0, 0, |
|
182 self, 'pyramid_run_browser') |
177 self.runBrowserAct.setStatusTip(self.trUtf8( |
183 self.runBrowserAct.setStatusTip(self.trUtf8( |
178 'Starts the default Web-Browser with the URL of the Pyramid Web server')) |
184 'Starts the default Web-Browser with the URL of the Pyramid Web' |
|
185 ' server')) |
179 self.runBrowserAct.setWhatsThis(self.trUtf8( |
186 self.runBrowserAct.setWhatsThis(self.trUtf8( |
180 """<b>Run Web-Browser</b>""" |
187 """<b>Run Web-Browser</b>""" |
181 """<p>Starts the default Web-Browser with the URL of the """ |
188 """<p>Starts the default Web-Browser with the URL of the """ |
182 """Pyramid Web server.</p>""" |
189 """Pyramid Web server.</p>""" |
183 )) |
190 )) |
184 self.runBrowserAct.triggered[()].connect(self.__runBrowser) |
191 self.runBrowserAct.triggered[()].connect(self.__runBrowser) |
185 self.actions.append(self.runBrowserAct) |
192 self.actions.append(self.runBrowserAct) |
186 |
193 |
187 self.runPythonShellAct = E5Action(self.trUtf8('Start Pyramid Python Console'), |
194 self.runPythonShellAct = E5Action( |
188 self.trUtf8('Start Pyramid &Python Console'), |
195 self.trUtf8('Start Pyramid Python Console'), |
189 0, 0, |
196 self.trUtf8('Start Pyramid &Python Console'), |
190 self, 'pyramid_python_console') |
197 0, 0, |
|
198 self, 'pyramid_python_console') |
191 self.runPythonShellAct.setStatusTip(self.trUtf8( |
199 self.runPythonShellAct.setStatusTip(self.trUtf8( |
192 'Starts an interactive Python interpreter')) |
200 'Starts an interactive Python interpreter')) |
193 self.runPythonShellAct.setWhatsThis(self.trUtf8( |
201 self.runPythonShellAct.setWhatsThis(self.trUtf8( |
194 """<b>Start Pyramid Python Console</b>""" |
202 """<b>Start Pyramid Python Console</b>""" |
195 """<p>Starts an interactive Python interpreter.</p>""" |
203 """<p>Starts an interactive Python interpreter.</p>""" |
199 |
207 |
200 ############################## |
208 ############################## |
201 ## setup actions below ## |
209 ## setup actions below ## |
202 ############################## |
210 ############################## |
203 |
211 |
204 self.setupDevelopAct = E5Action(self.trUtf8('Setup Development Environment'), |
212 self.setupDevelopAct = E5Action( |
205 self.trUtf8('Setup &Development Environment'), |
213 self.trUtf8('Setup Development Environment'), |
206 0, 0, |
214 self.trUtf8('Setup &Development Environment'), |
207 self, 'pyramid_setup_development') |
215 0, 0, |
|
216 self, 'pyramid_setup_development') |
208 self.setupDevelopAct.setStatusTip(self.trUtf8( |
217 self.setupDevelopAct.setStatusTip(self.trUtf8( |
209 'Setup the Pyramid project in development mode')) |
218 'Setup the Pyramid project in development mode')) |
210 self.setupDevelopAct.setWhatsThis(self.trUtf8( |
219 self.setupDevelopAct.setWhatsThis(self.trUtf8( |
211 """<b>Setup Development Environment</b>""" |
220 """<b>Setup Development Environment</b>""" |
212 """<p>Setup the Pyramid project in development mode using""" |
221 """<p>Setup the Pyramid project in development mode using""" |
217 |
226 |
218 ############################### |
227 ############################### |
219 ## database actions below ## |
228 ## database actions below ## |
220 ############################### |
229 ############################### |
221 |
230 |
222 self.initializeDbAct = E5Action(self.trUtf8('Initialize Database'), |
231 self.initializeDbAct = E5Action( |
223 self.trUtf8('Initialize &Database'), |
232 self.trUtf8('Initialize Database'), |
224 0, 0, |
233 self.trUtf8('Initialize &Database'), |
225 self, 'pyramid_initialize_database') |
234 0, 0, |
|
235 self, 'pyramid_initialize_database') |
226 self.initializeDbAct.setStatusTip(self.trUtf8( |
236 self.initializeDbAct.setStatusTip(self.trUtf8( |
227 'Initializes (or re-initializes) the database of the current' |
237 'Initializes (or re-initializes) the database of the current' |
228 ' Pyramid project')) |
238 ' Pyramid project')) |
229 self.initializeDbAct.setWhatsThis(self.trUtf8( |
239 self.initializeDbAct.setWhatsThis(self.trUtf8( |
230 """<b>Initialize Database</b>""" |
240 """<b>Initialize Database</b>""" |
231 """<p>Initializes (or re-initializes) the database of the current""" |
241 """<p>Initializes (or re-initializes) the database of the""" |
232 """ Pyramid project.</p>""" |
242 """ current Pyramid project.</p>""" |
233 )) |
243 )) |
234 self.initializeDbAct.triggered[()].connect(self.__initializeDatabase) |
244 self.initializeDbAct.triggered[()].connect(self.__initializeDatabase) |
235 self.actions.append(self.initializeDbAct) |
245 self.actions.append(self.initializeDbAct) |
236 |
246 |
237 ############################### |
247 ############################### |
238 ## show actions below ## |
248 ## show actions below ## |
239 ############################### |
249 ############################### |
240 |
250 |
241 self.showViewsAct = E5Action(self.trUtf8('Show Matching Views'), |
251 self.showViewsAct = E5Action( |
242 self.trUtf8('Show Matching &Views'), |
252 self.trUtf8('Show Matching Views'), |
243 0, 0, |
253 self.trUtf8('Show Matching &Views'), |
244 self, 'pyramid_show_views') |
254 0, 0, |
|
255 self, 'pyramid_show_views') |
245 self.showViewsAct.setStatusTip(self.trUtf8( |
256 self.showViewsAct.setStatusTip(self.trUtf8( |
246 'Show views matching a given URL')) |
257 'Show views matching a given URL')) |
247 self.showViewsAct.setWhatsThis(self.trUtf8( |
258 self.showViewsAct.setWhatsThis(self.trUtf8( |
248 """<b>Show Matching Views</b>""" |
259 """<b>Show Matching Views</b>""" |
249 """<p>Show views matching a given URL.</p>""" |
260 """<p>Show views matching a given URL.</p>""" |
250 )) |
261 )) |
251 self.showViewsAct.triggered[()].connect(self.__showMatchingViews) |
262 self.showViewsAct.triggered[()].connect(self.__showMatchingViews) |
252 self.actions.append(self.showViewsAct) |
263 self.actions.append(self.showViewsAct) |
253 |
264 |
254 self.showRoutesAct = E5Action(self.trUtf8('Show Routes'), |
265 self.showRoutesAct = E5Action( |
255 self.trUtf8('Show &Routes'), |
266 self.trUtf8('Show Routes'), |
256 0, 0, |
267 self.trUtf8('Show &Routes'), |
257 self, 'pyramid_show_routes') |
268 0, 0, |
|
269 self, 'pyramid_show_routes') |
258 self.showRoutesAct.setStatusTip(self.trUtf8( |
270 self.showRoutesAct.setStatusTip(self.trUtf8( |
259 'Show all URL dispatch routes used by a Pyramid application')) |
271 'Show all URL dispatch routes used by a Pyramid application')) |
260 self.showRoutesAct.setWhatsThis(self.trUtf8( |
272 self.showRoutesAct.setWhatsThis(self.trUtf8( |
261 """<b>Show Routes</b>""" |
273 """<b>Show Routes</b>""" |
262 """<p>Show all URL dispatch routes used by a Pyramid application""" |
274 """<p>Show all URL dispatch routes used by a Pyramid application""" |
263 """ in the order in which they are evaluated.</p>""" |
275 """ in the order in which they are evaluated.</p>""" |
264 )) |
276 )) |
265 self.showRoutesAct.triggered[()].connect(self.__showRoutes) |
277 self.showRoutesAct.triggered[()].connect(self.__showRoutes) |
266 self.actions.append(self.showRoutesAct) |
278 self.actions.append(self.showRoutesAct) |
267 |
279 |
268 self.showTweensAct = E5Action(self.trUtf8('Show Tween Objects'), |
280 self.showTweensAct = E5Action( |
269 self.trUtf8('Show &Tween Objects'), |
281 self.trUtf8('Show Tween Objects'), |
270 0, 0, |
282 self.trUtf8('Show &Tween Objects'), |
271 self, 'pyramid_show_routes') |
283 0, 0, |
|
284 self, 'pyramid_show_routes') |
272 self.showTweensAct.setStatusTip(self.trUtf8( |
285 self.showTweensAct.setStatusTip(self.trUtf8( |
273 'Show all implicit and explicit tween objects used by a Pyramid application')) |
286 'Show all implicit and explicit tween objects used by a Pyramid' |
|
287 ' application')) |
274 self.showTweensAct.setWhatsThis(self.trUtf8( |
288 self.showTweensAct.setWhatsThis(self.trUtf8( |
275 """<b>Show Tween Objects</b>""" |
289 """<b>Show Tween Objects</b>""" |
276 """<p>Show all implicit and explicit tween objects used by a""" |
290 """<p>Show all implicit and explicit tween objects used by a""" |
277 """ Pyramid application.</p>""" |
291 """ Pyramid application.</p>""" |
278 )) |
292 )) |
281 |
295 |
282 ################################## |
296 ################################## |
283 ## distribution actions below ## |
297 ## distribution actions below ## |
284 ################################## |
298 ################################## |
285 |
299 |
286 self.buildDistroAct = E5Action(self.trUtf8('Build Distribution'), |
300 self.buildDistroAct = E5Action( |
287 self.trUtf8('Build &Distribution'), |
301 self.trUtf8('Build Distribution'), |
288 0, 0, |
302 self.trUtf8('Build &Distribution'), |
289 self, 'pyramid_build_distribution') |
303 0, 0, |
|
304 self, 'pyramid_build_distribution') |
290 self.buildDistroAct.setStatusTip(self.trUtf8( |
305 self.buildDistroAct.setStatusTip(self.trUtf8( |
291 'Builds a distribution file for the Pyramid project')) |
306 'Builds a distribution file for the Pyramid project')) |
292 self.buildDistroAct.setWhatsThis(self.trUtf8( |
307 self.buildDistroAct.setWhatsThis(self.trUtf8( |
293 """<b>Build Distribution</b>""" |
308 """<b>Build Distribution</b>""" |
294 """<p>Builds a distribution file for the Pyramid project using""" |
309 """<p>Builds a distribution file for the Pyramid project using""" |
299 |
314 |
300 ################################## |
315 ################################## |
301 ## documentation action below ## |
316 ## documentation action below ## |
302 ################################## |
317 ################################## |
303 |
318 |
304 self.documentationAct = E5Action(self.trUtf8('Documentation'), |
319 self.documentationAct = E5Action( |
305 self.trUtf8('D&ocumentation'), |
320 self.trUtf8('Documentation'), |
306 0, 0, |
321 self.trUtf8('D&ocumentation'), |
307 self, 'pyramid_documentation') |
322 0, 0, |
|
323 self, 'pyramid_documentation') |
308 self.documentationAct.setStatusTip(self.trUtf8( |
324 self.documentationAct.setStatusTip(self.trUtf8( |
309 'Shows the help viewer with the Pyramid documentation')) |
325 'Shows the help viewer with the Pyramid documentation')) |
310 self.documentationAct.setWhatsThis(self.trUtf8( |
326 self.documentationAct.setWhatsThis(self.trUtf8( |
311 """<b>Documentation</b>""" |
327 """<b>Documentation</b>""" |
312 """<p>Shows the help viewer with the Pyramid documentation.</p>""" |
328 """<p>Shows the help viewer with the Pyramid documentation.</p>""" |
316 |
332 |
317 ############################## |
333 ############################## |
318 ## about action below ## |
334 ## about action below ## |
319 ############################## |
335 ############################## |
320 |
336 |
321 self.aboutPyramidAct = E5Action(self.trUtf8('About Pyramid'), |
337 self.aboutPyramidAct = E5Action( |
322 self.trUtf8('About P&yramid'), |
338 self.trUtf8('About Pyramid'), |
323 0, 0, |
339 self.trUtf8('About P&yramid'), |
324 self, 'pyramid_about') |
340 0, 0, |
|
341 self, 'pyramid_about') |
325 self.aboutPyramidAct.setStatusTip(self.trUtf8( |
342 self.aboutPyramidAct.setStatusTip(self.trUtf8( |
326 'Shows some information about Pyramid')) |
343 'Shows some information about Pyramid')) |
327 self.aboutPyramidAct.setWhatsThis(self.trUtf8( |
344 self.aboutPyramidAct.setWhatsThis(self.trUtf8( |
328 """<b>About Pyramid</b>""" |
345 """<b>About Pyramid</b>""" |
329 """<p>Shows some information about Pyramid.</p>""" |
346 """<p>Shows some information about Pyramid.</p>""" |
392 Public method to add our hook methods. |
410 Public method to add our hook methods. |
393 """ |
411 """ |
394 if self.__e5project.getProjectType() == "Pyramid": |
412 if self.__e5project.getProjectType() == "Pyramid": |
395 self.__formsBrowser = \ |
413 self.__formsBrowser = \ |
396 e5App().getObject("ProjectBrowser").getProjectBrowser("forms") |
414 e5App().getObject("ProjectBrowser").getProjectBrowser("forms") |
397 self.__formsBrowser.addHookMethodAndMenuEntry("newForm", |
415 self.__formsBrowser.addHookMethodAndMenuEntry( |
398 self.newForm, self.trUtf8("New template...")) |
416 "newForm", self.newForm, self.trUtf8("New template...")) |
399 |
417 |
400 if self.__e5project.getProjectLanguage() == "Python2": |
418 if self.__e5project.getProjectLanguage() == "Python2": |
401 # Babel and lingua are not yet available for Python 3 |
419 # Babel and lingua are not yet available for Python 3 |
402 self.__e5project.projectLanguageAddedByCode.connect( |
420 self.__e5project.projectLanguageAddedByCode.connect( |
403 self.__projectLanguageAdded) |
421 self.__projectLanguageAdded) |
404 self.__translationsBrowser = \ |
422 self.__translationsBrowser = \ |
405 e5App().getObject("ProjectBrowser").getProjectBrowser("translations") |
423 e5App().getObject("ProjectBrowser")\ |
406 self.__translationsBrowser.addHookMethodAndMenuEntry("extractMessages", |
424 .getProjectBrowser("translations") |
407 self.extractMessages, self.trUtf8("Extract Messages")) |
425 self.__translationsBrowser.addHookMethodAndMenuEntry( |
408 self.__translationsBrowser.addHookMethodAndMenuEntry("releaseAll", |
426 "extractMessages", self.extractMessages, |
409 self.compileCatalogs, self.trUtf8("Compile All Catalogs")) |
427 self.trUtf8("Extract Messages")) |
410 self.__translationsBrowser.addHookMethodAndMenuEntry("releaseSelected", |
428 self.__translationsBrowser.addHookMethodAndMenuEntry( |
411 self.compileSelectedCatalogs, |
429 "releaseAll", self.compileCatalogs, |
|
430 self.trUtf8("Compile All Catalogs")) |
|
431 self.__translationsBrowser.addHookMethodAndMenuEntry( |
|
432 "releaseSelected", self.compileSelectedCatalogs, |
412 self.trUtf8("Compile Selected Catalogs")) |
433 self.trUtf8("Compile Selected Catalogs")) |
413 self.__translationsBrowser.addHookMethodAndMenuEntry("generateAll", |
434 self.__translationsBrowser.addHookMethodAndMenuEntry( |
414 self.updateCatalogs, self.trUtf8("Update All Catalogs")) |
435 "generateAll", self.updateCatalogs, |
415 self.__translationsBrowser.addHookMethodAndMenuEntry("generateSelected", |
436 self.trUtf8("Update All Catalogs")) |
416 self.updateSelectedCatalogs, self.trUtf8("Update Selected Catalogs")) |
437 self.__translationsBrowser.addHookMethodAndMenuEntry( |
|
438 "generateSelected", self.updateSelectedCatalogs, |
|
439 self.trUtf8("Update Selected Catalogs")) |
417 |
440 |
418 self.__hooksInstalled = True |
441 self.__hooksInstalled = True |
419 |
442 |
420 self.registerOpenHook() |
443 self.registerOpenHook() |
421 |
444 |
476 ex = selectedFilter.split("(*")[1].split(")")[0] |
499 ex = selectedFilter.split("(*")[1].split(")")[0] |
477 if ex: |
500 if ex: |
478 fname += ex |
501 fname += ex |
479 |
502 |
480 if os.path.exists(fname): |
503 if os.path.exists(fname): |
481 res = E5MessageBox.yesNo(self.__ui, |
504 res = E5MessageBox.yesNo( |
|
505 self.__ui, |
482 self.trUtf8("New Form"), |
506 self.trUtf8("New Form"), |
483 self.trUtf8("""The file already exists! Overwrite it?"""), |
507 self.trUtf8("""The file already exists! Overwrite""" |
|
508 """ it?"""), |
484 icon=E5MessageBox.Warning) |
509 icon=E5MessageBox.Warning) |
485 if not res: |
510 if not res: |
486 # user selected to not overwrite |
511 # user selected to not overwrite |
487 return |
512 return |
488 |
513 |
489 try: |
514 try: |
490 f = open(fname, "w", encoding="utf-8") |
515 f = open(fname, "w", encoding="utf-8") |
491 f.write(template) |
516 f.write(template) |
492 f.close() |
517 f.close() |
493 except IOError as e: |
518 except IOError as e: |
494 E5MessageBox.critical(self, |
519 E5MessageBox.critical( |
|
520 self.__ui, |
495 self.trUtf8("New Form"), |
521 self.trUtf8("New Form"), |
496 self.trUtf8("<p>The new form file <b>{0}</b> could not be" |
522 self.trUtf8("<p>The new form file <b>{0}</b> could" |
497 " created.<br/>" |
523 " not be created.<br/> Problem: {1}</p>") |
498 "Problem: {1}</p>").format(fname, e)) |
524 .format(fname, e)) |
499 return |
525 return |
500 |
526 |
501 self.__e5project.appendFile(fname) |
527 self.__e5project.appendFile(fname) |
502 self.__formsBrowser.sourceFile.emit(fname) |
528 self.__formsBrowser.sourceFile.emit(fname) |
503 |
529 |
775 if simulate: |
803 if simulate: |
776 args.append("--simulate") |
804 args.append("--simulate") |
777 args.append("--scaffold={0}".format(scaffold)) |
805 args.append("--scaffold={0}".format(scaffold)) |
778 args.append(project) |
806 args.append(project) |
779 dlg = PyramidDialog(self.trUtf8("Create Pyramid Project"), |
807 dlg = PyramidDialog(self.trUtf8("Create Pyramid Project"), |
780 linewrap=False, parent=self.__ui) |
808 linewrap=False, parent=self.__ui) |
781 if dlg.startProcess(cmd, args, self.__e5project.getProjectPath()): |
809 if dlg.startProcess(cmd, args, self.__e5project.getProjectPath()): |
782 dlg.exec_() |
810 dlg.exec_() |
783 if dlg.normalExit() and not simulate: |
811 if dlg.normalExit() and not simulate: |
784 # search for files created by pcreate and add them to the project |
812 # search for files created by pcreate and add them to the |
785 projectPath = os.path.join(self.__e5project.getProjectPath(), project) |
813 # project |
|
814 projectPath = os.path.join( |
|
815 self.__e5project.getProjectPath(), project) |
786 for entry in os.walk(projectPath): |
816 for entry in os.walk(projectPath): |
787 for fileName in entry[2]: |
817 for fileName in entry[2]: |
788 fullName = os.path.join(entry[0], fileName) |
818 fullName = os.path.join(entry[0], fileName) |
789 self.__e5project.appendFile(fullName) |
819 self.__e5project.appendFile(fullName) |
790 |
820 |
791 # create the base directory for translations |
821 # create the base directory for translations |
792 i18nPath = os.path.join(projectPath, project.lower(), "i18n") |
822 i18nPath = os.path.join( |
|
823 projectPath, project.lower(), "i18n") |
793 if not os.path.exists(i18nPath): |
824 if not os.path.exists(i18nPath): |
794 os.makedirs(i18nPath) |
825 os.makedirs(i18nPath) |
795 self.__e5project.setDirty(True) |
826 self.__e5project.setDirty(True) |
796 |
827 |
797 self.__setCurrentProject(project) |
828 self.__setCurrentProject(project) |
1017 self.__plugin.getPreferences("ConsoleCommand"))[1] |
1052 self.__plugin.getPreferences("ConsoleCommand"))[1] |
1018 if consoleCmd: |
1053 if consoleCmd: |
1019 try: |
1054 try: |
1020 projectPath = self.__projectPath() |
1055 projectPath = self.__projectPath() |
1021 except PyramidNoProjectSelectedException: |
1056 except PyramidNoProjectSelectedException: |
1022 E5MessageBox.warning(self.__ui, |
1057 E5MessageBox.warning( |
|
1058 self.__ui, |
1023 self.trUtf8('Start Pyramid Python Console'), |
1059 self.trUtf8('Start Pyramid Python Console'), |
1024 self.trUtf8('No current Pyramid project selected or no Pyramid ' |
1060 self.trUtf8('No current Pyramid project selected or no' |
1025 'project created yet. Aborting...')) |
1061 ' Pyramid project created yet. Aborting...')) |
1026 return |
1062 return |
1027 |
1063 |
1028 args = Utilities.parseOptionString(consoleCmd) |
1064 args = Utilities.parseOptionString(consoleCmd) |
1029 args[0] = Utilities.getExecutablePath(args[0]) |
1065 args[0] = Utilities.getExecutablePath(args[0]) |
1030 args.append(self.getPyramidCommand("pshell")) |
1066 args.append(self.getPyramidCommand("pshell")) |
1031 language = self.__e5project.getProjectLanguage() |
1067 language = self.__e5project.getProjectLanguage() |
1032 if language == "Python2": |
1068 if language == "Python2": |
1033 consoleType = self.__plugin.getPreferences("Python2ConsoleType") |
1069 consoleType = self.__plugin.getPreferences( |
|
1070 "Python2ConsoleType") |
1034 else: |
1071 else: |
1035 consoleType = self.__plugin.getPreferences("Python3ConsoleType") |
1072 consoleType = self.__plugin.getPreferences( |
|
1073 "Python3ConsoleType") |
1036 args.append("--python-shell={0}".format(consoleType)) |
1074 args.append("--python-shell={0}".format(consoleType)) |
1037 args.append(os.path.join(projectPath, "development.ini")) |
1075 args.append(os.path.join(projectPath, "development.ini")) |
1038 |
1076 |
1039 started, pid = QProcess.startDetached(args[0], args[1:], projectPath) |
1077 started, pid = QProcess.startDetached( |
|
1078 args[0], args[1:], projectPath) |
1040 if not started: |
1079 if not started: |
1041 E5MessageBox.critical(self.__ui, |
1080 E5MessageBox.critical( |
|
1081 self.__ui, |
1042 self.trUtf8('Process Generation Error'), |
1082 self.trUtf8('Process Generation Error'), |
1043 self.trUtf8('The Pyramid Shell process could not be started.')) |
1083 self.trUtf8('The Pyramid Shell process could not be' |
|
1084 ' started.')) |
1044 |
1085 |
1045 ################################################################## |
1086 ################################################################## |
1046 ## slots below implement setup functions |
1087 ## slots below implement setup functions |
1047 ################################################################## |
1088 ################################################################## |
1048 |
1089 |
1049 def __setupDevelop(self): |
1090 def __setupDevelop(self): |
1050 """ |
1091 """ |
1051 Private slot to set up the development environment for the current project. |
1092 Private slot to set up the development environment for the current |
|
1093 project. |
1052 """ |
1094 """ |
1053 title = self.trUtf8("Setup Development Environment") |
1095 title = self.trUtf8("Setup Development Environment") |
1054 try: |
1096 try: |
1055 wd = self.__projectPath() |
1097 wd = self.__projectPath() |
1056 except PyramidNoProjectSelectedException: |
1098 except PyramidNoProjectSelectedException: |
1057 E5MessageBox.warning(self.__ui, |
1099 E5MessageBox.warning( |
|
1100 self.__ui, |
1058 title, |
1101 title, |
1059 self.trUtf8('No current Pyramid project selected or no Pyramid project' |
1102 self.trUtf8('No current Pyramid project selected or no Pyramid' |
1060 ' created yet. Aborting...')) |
1103 ' project created yet. Aborting...')) |
1061 return |
1104 return |
1062 |
1105 |
1063 cmd = self.getPythonCommand() |
1106 cmd = self.getPythonCommand() |
1064 args = [] |
1107 args = [] |
1065 args.append("setup.py") |
1108 args.append("setup.py") |
1066 args.append("develop") |
1109 args.append("develop") |
1067 |
1110 |
1068 dia = PyramidDialog(title, |
1111 dia = PyramidDialog( |
1069 msgSuccess=self.trUtf8("Pyramid development environment setup successfully.")) |
1112 title, |
|
1113 msgSuccess=self.trUtf8("Pyramid development environment setup" |
|
1114 " successfully.")) |
1070 res = dia.startProcess(cmd, args, wd) |
1115 res = dia.startProcess(cmd, args, wd) |
1071 if res: |
1116 if res: |
1072 dia.exec_() |
1117 dia.exec_() |
1073 initCmd = self.__getInitDbCommand() |
1118 initCmd = self.__getInitDbCommand() |
1074 self.initializeDbAct.setEnabled(os.path.exists(initCmd)) |
1119 self.initializeDbAct.setEnabled(os.path.exists(initCmd)) |
1077 ## slots below implement distribution functions |
1122 ## slots below implement distribution functions |
1078 ################################################################## |
1123 ################################################################## |
1079 |
1124 |
1080 def __buildDistribution(self): |
1125 def __buildDistribution(self): |
1081 """ |
1126 """ |
1082 Private slot to build a distribution file for the current Pyramid project. |
1127 Private slot to build a distribution file for the current Pyramid |
|
1128 project. |
1083 """ |
1129 """ |
1084 title = self.trUtf8("Build Distribution File") |
1130 title = self.trUtf8("Build Distribution File") |
1085 try: |
1131 try: |
1086 projectPath = self.__projectPath() |
1132 projectPath = self.__projectPath() |
1087 except PyramidNoProjectSelectedException: |
1133 except PyramidNoProjectSelectedException: |
1088 E5MessageBox.warning(self.__ui, |
1134 E5MessageBox.warning( |
|
1135 self.__ui, |
1089 title, |
1136 title, |
1090 self.trUtf8('No current Pyramid project selected or no Pyramid project' |
1137 self.trUtf8('No current Pyramid project selected or no Pyramid' |
1091 ' created yet. Aborting...')) |
1138 ' project created yet. Aborting...')) |
1092 return |
1139 return |
1093 |
1140 |
1094 from .DistributionTypeSelectionDialog import DistributionTypeSelectionDialog |
1141 from .DistributionTypeSelectionDialog import \ |
|
1142 DistributionTypeSelectionDialog |
1095 |
1143 |
1096 dlg = DistributionTypeSelectionDialog(self, projectPath, self.__ui) |
1144 dlg = DistributionTypeSelectionDialog(self, projectPath, self.__ui) |
1097 if dlg.exec_() == QDialog.Accepted: |
1145 if dlg.exec_() == QDialog.Accepted: |
1098 formats = dlg.getFormats() |
1146 formats = dlg.getFormats() |
1099 cmd = self.getPythonCommand() |
1147 cmd = self.getPythonCommand() |
1121 """ |
1171 """ |
1122 try: |
1172 try: |
1123 cmd = "initialize_{0}_db".format(self.__project()) |
1173 cmd = "initialize_{0}_db".format(self.__project()) |
1124 return self.getPyramidCommand(cmd) |
1174 return self.getPyramidCommand(cmd) |
1125 except PyramidNoProjectSelectedException: |
1175 except PyramidNoProjectSelectedException: |
1126 E5MessageBox.warning(self.__ui, |
1176 E5MessageBox.warning( |
|
1177 self.__ui, |
1127 self.trUtf8("Initialize Database"), |
1178 self.trUtf8("Initialize Database"), |
1128 self.trUtf8('No current Pyramid project selected or no Pyramid project' |
1179 self.trUtf8('No current Pyramid project selected or no Pyramid' |
1129 ' created yet. Aborting...')) |
1180 ' project created yet. Aborting...')) |
1130 return "" |
1181 return "" |
1131 |
1182 |
1132 def __initializeDatabase(self): |
1183 def __initializeDatabase(self): |
1133 """ |
1184 """ |
1134 Private slot to initialize the database of the Pyramid project. |
1185 Private slot to initialize the database of the Pyramid project. |
1135 """ |
1186 """ |
1136 title = self.trUtf8("Initialize Database") |
1187 title = self.trUtf8("Initialize Database") |
1137 try: |
1188 try: |
1138 projectPath = self.__projectPath() |
1189 projectPath = self.__projectPath() |
1139 except PyramidNoProjectSelectedException: |
1190 except PyramidNoProjectSelectedException: |
1140 E5MessageBox.warning(self.__ui, |
1191 E5MessageBox.warning( |
|
1192 self.__ui, |
1141 title, |
1193 title, |
1142 self.trUtf8('No current Pyramid project selected or no Pyramid project' |
1194 self.trUtf8('No current Pyramid project selected or no Pyramid' |
1143 ' created yet. Aborting...')) |
1195 ' project created yet. Aborting...')) |
1144 return |
1196 return |
1145 |
1197 |
1146 cmd = self.__getInitDbCommand() |
1198 cmd = self.__getInitDbCommand() |
1147 args = [] |
1199 args = [] |
1148 args.append("development.ini") |
1200 args.append("development.ini") |
1149 |
1201 |
1150 dia = PyramidDialog(title, |
1202 dia = PyramidDialog( |
|
1203 title, |
1151 msgSuccess=self.trUtf8("Database initialized successfully.")) |
1204 msgSuccess=self.trUtf8("Database initialized successfully.")) |
1152 res = dia.startProcess(cmd, args, projectPath) |
1205 res = dia.startProcess(cmd, args, projectPath) |
1153 if res: |
1206 if res: |
1154 dia.exec_() |
1207 dia.exec_() |
1155 |
1208 |
1358 """ |
1416 """ |
1359 Private slot handling the addition of a new language. |
1417 Private slot handling the addition of a new language. |
1360 |
1418 |
1361 @param code language code of the new language (string) |
1419 @param code language code of the new language (string) |
1362 """ |
1420 """ |
1363 title = self.trUtf8("Initializing message catalog for '{0}'").format(code) |
1421 title = self.trUtf8("Initializing message catalog for '{0}'")\ |
|
1422 .format(code) |
1364 try: |
1423 try: |
1365 projectPath = self.__projectPath() |
1424 projectPath = self.__projectPath() |
1366 except PyramidNoProjectSelectedException: |
1425 except PyramidNoProjectSelectedException: |
1367 E5MessageBox.warning(self.__ui, |
1426 E5MessageBox.warning( |
|
1427 self.__ui, |
1368 title, |
1428 title, |
1369 self.trUtf8('No current Pyramid project selected or no Pyramid project' |
1429 self.trUtf8('No current Pyramid project selected or no Pyramid' |
1370 ' created yet. Aborting...')) |
1430 ' project created yet. Aborting...')) |
1371 return |
1431 return |
1372 |
1432 |
1373 cmd = self.getPythonCommand() |
1433 cmd = self.getPythonCommand() |
1374 args = [] |
1434 args = [] |
1375 args.append("setup.py") |
1435 args.append("setup.py") |
1376 args.append("init_catalog") |
1436 args.append("init_catalog") |
1377 args.append("-l") |
1437 args.append("-l") |
1378 args.append(code) |
1438 args.append(code) |
1379 |
1439 |
1380 dia = PyramidDialog(title, |
1440 dia = PyramidDialog( |
1381 msgSuccess=self.trUtf8("\nMessage catalog initialized successfully.")) |
1441 title, |
|
1442 msgSuccess=self.trUtf8("\nMessage catalog initialized" |
|
1443 " successfully.")) |
1382 res = dia.startProcess(cmd, args, projectPath) |
1444 res = dia.startProcess(cmd, args, projectPath) |
1383 if res: |
1445 if res: |
1384 dia.exec_() |
1446 dia.exec_() |
1385 |
1447 |
1386 langFile = self.__e5project.pdata["TRANSLATIONPATTERN"][0]\ |
1448 langFile = self.__e5project.pdata["TRANSLATIONPATTERN"][0]\ |
1395 """ |
1457 """ |
1396 title = self.trUtf8("Compiling message catalogs") |
1458 title = self.trUtf8("Compiling message catalogs") |
1397 try: |
1459 try: |
1398 projectPath = self.__projectPath() |
1460 projectPath = self.__projectPath() |
1399 except PyramidNoProjectSelectedException: |
1461 except PyramidNoProjectSelectedException: |
1400 E5MessageBox.warning(self.__ui, |
1462 E5MessageBox.warning( |
|
1463 self.__ui, |
1401 title, |
1464 title, |
1402 self.trUtf8('No current Pyramid project selected or no Pyramid project' |
1465 self.trUtf8('No current Pyramid project selected or no Pyramid' |
1403 ' created yet. Aborting...')) |
1466 ' project created yet. Aborting...')) |
1404 return |
1467 return |
1405 |
1468 |
1406 cmd = self.getPythonCommand() |
1469 cmd = self.getPythonCommand() |
1407 args = [] |
1470 args = [] |
1408 args.append("setup.py") |
1471 args.append("setup.py") |
1409 args.append("compile_catalog") |
1472 args.append("compile_catalog") |
1410 |
1473 |
1411 dia = PyramidDialog(title, |
1474 dia = PyramidDialog( |
1412 msgSuccess=self.trUtf8("\nMessage catalogs compiled successfully.")) |
1475 title, |
|
1476 msgSuccess=self.trUtf8("\nMessage catalogs compiled" |
|
1477 " successfully.")) |
1413 res = dia.startProcess(cmd, args, projectPath) |
1478 res = dia.startProcess(cmd, args, projectPath) |
1414 if res: |
1479 if res: |
1415 dia.exec_() |
1480 dia.exec_() |
1416 |
1481 |
1417 for entry in os.walk(projectPath): |
1482 for entry in os.walk(projectPath): |
1475 """ |
1545 """ |
1476 title = self.trUtf8("Updating message catalogs") |
1546 title = self.trUtf8("Updating message catalogs") |
1477 try: |
1547 try: |
1478 projectPath = self.__projectPath() |
1548 projectPath = self.__projectPath() |
1479 except PyramidNoProjectSelectedException: |
1549 except PyramidNoProjectSelectedException: |
1480 E5MessageBox.warning(self.__ui, |
1550 E5MessageBox.warning( |
|
1551 self.__ui, |
1481 title, |
1552 title, |
1482 self.trUtf8('No current Pyramid project selected or no Pyramid project' |
1553 self.trUtf8('No current Pyramid project selected or no Pyramid' |
1483 ' created yet. Aborting...')) |
1554 ' project created yet. Aborting...')) |
1484 return |
1555 return |
1485 |
1556 |
1486 cmd = self.getPythonCommand() |
1557 cmd = self.getPythonCommand() |
1487 args = [] |
1558 args = [] |
1488 args.append("setup.py") |
1559 args.append("setup.py") |
1489 args.append("update_catalog") |
1560 args.append("update_catalog") |
1490 |
1561 |
1491 dia = PyramidDialog(title, |
1562 dia = PyramidDialog( |
|
1563 title, |
1492 msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) |
1564 msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) |
1493 res = dia.startProcess(cmd, args, projectPath) |
1565 res = dia.startProcess(cmd, args, projectPath) |
1494 if res: |
1566 if res: |
1495 dia.exec_() |
1567 dia.exec_() |
1496 |
1568 |