Wed, 29 Aug 2012 15:33:31 +0200
Added code for the 'pviews' command.
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3 | # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de> |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the Pyramid project support. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | import os |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | import configparser |
3
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
12 | import re |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | from PyQt4.QtCore import QObject, QFileInfo, QProcess, QTimer, QUrl |
8
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
15 | from PyQt4.QtGui import QMenu, QDialog, QInputDialog, QDesktopServices, QLineEdit |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | from E5Gui.E5Application import e5App |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | from E5Gui import E5MessageBox, E5FileDialog |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | from E5Gui.E5Action import E5Action |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | from .FormSelectionDialog import FormSelectionDialog |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | from .CreateParametersDialog import CreateParametersDialog |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | from .PyramidDialog import PyramidDialog |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | from .DistributionTypeSelectionDialog import DistributionTypeSelectionDialog |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | import Utilities |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | from Globals import isWindowsPlatform |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | import UI.PixmapCache |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | class PyramidNoProjectSelectedException(Exception): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | Exception thrown to signal, that there is no current Pyramid project. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | pass |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | class Project(QObject): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | Class implementing the Pyramid project support. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | def __init__(self, plugin, parent = None): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | Constructor |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | @param plugin reference to the plugin object |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | @param parent parent (QObject) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | super().__init__(parent) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | self.__plugin = plugin |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | self.__ui = parent |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | self.__e5project = e5App().getObject("Project") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | self.__hooksInstalled = False |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | self.__mainMenu = None |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | self.__serverProc = None |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | def initActions(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | Public method to define the Pyramid actions. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | """ |
5
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
64 | # TODO: create action for: prequest |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
65 | # TODO: create action for: proutes |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
66 | # TODO: create action for: ptweens |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | self.actions = [] |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | self.selectProjectAct = E5Action(self.trUtf8('Current Pyramid Project'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | "", |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | 0, 0, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | self,'pyramid_current_project') |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | self.selectProjectAct.setStatusTip(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | 'Selects the current Pyramid project')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | self.selectProjectAct.setWhatsThis(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | """<b>Current Pyramid Project</b>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | """<p>Selects the Pyramid project. Used for multi-project """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | """Pyramid projects to switch between the projects.</p>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | )) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | self.selectProjectAct.triggered[()].connect(self.__selectProject) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | self.actions.append(self.selectProjectAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | ############################### |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | ## create actions below ## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | ############################### |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | self.createProjectAct = E5Action(self.trUtf8('Create Pyramid Project'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | self.trUtf8('Create Pyramid &Project'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | 0, 0, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | self,'pyramid_create_project') |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | self.createProjectAct.setStatusTip(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | 'Creates a new Pyramid project')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | self.createProjectAct.setWhatsThis(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | """<b>Create Pyramid Project</b>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | """<p>Creates a new Pyramid project using "pcreate".</p>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | )) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | self.createProjectAct.triggered[()].connect(self.__createProject) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | self.actions.append(self.createProjectAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | ############################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | ## run actions below ## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | ############################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | self.runServerAct = E5Action(self.trUtf8('Run Server'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | self.trUtf8('Run &Server'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | 0, 0, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | self,'pyramid_run_server') |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | self.runServerAct.setStatusTip(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
109 | 'Starts the Pyramid Web server')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | self.runServerAct.setWhatsThis(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | """<b>Run Server</b>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | """<p>Starts the Pyramid Web server using""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | """ "pserve --reload development.ini".</p>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | )) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | self.runServerAct.triggered[()].connect(self.__runServer) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | self.actions.append(self.runServerAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | self.runLoggingServerAct = E5Action(self.trUtf8('Run Server with Logging'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | self.trUtf8('Run Server with &Logging'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | 0, 0, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | self,'pyramid_run_logging_server') |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | self.runLoggingServerAct.setStatusTip(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | 'Starts the Pyramid Web server with logging')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | self.runLoggingServerAct.setWhatsThis(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | """<b>Run Server with Logging</b>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | """<p>Starts the Pyramid Web server with logging using""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | """ "pserve --log-file=server.log --reload development.ini".</p>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | )) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | self.runLoggingServerAct.triggered[()].connect(self.__runLoggingServer) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | self.actions.append(self.runLoggingServerAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | self.runBrowserAct = E5Action(self.trUtf8('Run Web-Browser'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | self.trUtf8('Run &Web-Browser'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | 0, 0, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | self,'pyramid_run_browser') |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | self.runBrowserAct.setStatusTip(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | 'Starts the default Web-Browser with the URL of the Pyramid Web server')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | self.runBrowserAct.setWhatsThis(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | """<b>Run Web-Browser</b>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | """<p>Starts the default Web-Browser with the URL of the """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | """Pyramid Web server.</p>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | )) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | self.runBrowserAct.triggered[()].connect(self.__runBrowser) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | self.actions.append(self.runBrowserAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | self.runPythonShellAct = E5Action(self.trUtf8('Start Pyramid Python Console'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | self.trUtf8('Start Pyramid &Python Console'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | 0, 0, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | self,'pyramid_python_console') |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | self.runPythonShellAct.setStatusTip(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | 'Starts an interactive Python interpreter')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | self.runPythonShellAct.setWhatsThis(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | """<b>Start Pyramid Python Console</b>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | """<p>Starts an interactive Python interpreter.</p>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | )) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | self.runPythonShellAct.triggered[()].connect(self.__runPythonShell) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | self.actions.append(self.runPythonShellAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | ############################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | ## setup actions below ## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | ############################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | self.setupDevelopAct = E5Action(self.trUtf8('Setup Development Environment'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | self.trUtf8('Setup &Development Environment'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | 0, 0, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | self,'pyramid_setup_development') |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | self.setupDevelopAct.setStatusTip(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | 'Setup the Pyramid project in development mode')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | self.setupDevelopAct.setWhatsThis(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | """<b>Setup Development Environment</b>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | """<p>Setup the Pyramid project in development mode using""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | """ "python setup.py develop".</p>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
173 | )) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | self.setupDevelopAct.triggered[()].connect(self.__setupDevelop) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
175 | self.actions.append(self.setupDevelopAct) |
5
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
176 | |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
177 | ############################### |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
178 | ## database actions below ## |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
179 | ############################### |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
180 | |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
181 | self.initializeDbAct = E5Action(self.trUtf8('Initialize Database'), |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
182 | self.trUtf8('Initialize &Database'), |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
183 | 0, 0, |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
184 | self,'pyramid_initialize_database') |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
185 | self.initializeDbAct.setStatusTip(self.trUtf8( |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
186 | 'Initializes (or re-initializes) the database of the current' |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
187 | ' Pyramid project')) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
188 | self.initializeDbAct.setWhatsThis(self.trUtf8( |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
189 | """<b>Initialize Database</b>""" |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
190 | """<p>Initializes (or re-initializes) the database of the current""" |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
191 | """ Pyramid project.</p>""" |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
192 | )) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
193 | self.initializeDbAct.triggered[()].connect(self.__initializeDatabase) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
194 | self.actions.append(self.initializeDbAct) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
195 | |
8
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
196 | ############################### |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
197 | ## show actions below ## |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
198 | ############################### |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
199 | |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
200 | self.showViewsAct = E5Action(self.trUtf8('Show Matching Views'), |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
201 | self.trUtf8('Show Matching &Views'), |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
202 | 0, 0, |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
203 | self,'pyramid_show_views') |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
204 | self.showViewsAct.setStatusTip(self.trUtf8( |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
205 | 'Show views matching a given URL')) |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
206 | self.showViewsAct.setWhatsThis(self.trUtf8( |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
207 | """<b>Show Matching Views</b>""" |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
208 | """<p>Show views matching a given URL.</p>""" |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
209 | )) |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
210 | self.showViewsAct.triggered[()].connect(self.__showMatchingViews) |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
211 | self.actions.append(self.showViewsAct) |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
212 | |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | ################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | ## distribution actions below ## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
215 | ################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
216 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
217 | self.buildDistroAct = E5Action(self.trUtf8('Build Distribution'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | self.trUtf8('Build &Distribution'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | 0, 0, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | self,'pyramid_build_distribution') |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | self.buildDistroAct.setStatusTip(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | 'Builds a distribution file for the Pyramid project')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | self.buildDistroAct.setWhatsThis(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
224 | """<b>Build Distribution</b>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
225 | """<p>Builds a distribution file for the Pyramid project using""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
226 | """ "python setup.py sdist".</p>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | )) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
228 | self.buildDistroAct.triggered[()].connect(self.__buildDistribution) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
229 | self.actions.append(self.buildDistroAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
230 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | ################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | ## documentation action below ## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
233 | ################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
234 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | self.documentationAct = E5Action(self.trUtf8('Documentation'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
236 | self.trUtf8('D&ocumentation'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | 0, 0, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
238 | self,'pyramid_documentation') |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
239 | self.documentationAct.setStatusTip(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
240 | 'Shows the help viewer with the Pyramid documentation')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
241 | self.documentationAct.setWhatsThis(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
242 | """<b>Documentation</b>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | """<p>Shows the help viewer with the Pyramid documentation.</p>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
244 | )) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
245 | self.documentationAct.triggered[()].connect(self.__showDocumentation) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | self.actions.append(self.documentationAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
248 | ############################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | ## about action below ## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
250 | ############################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
251 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
252 | self.aboutPyramidAct = E5Action(self.trUtf8('About Pyramid'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
253 | self.trUtf8('About P&yramid'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | 0, 0, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
255 | self,'pyramid_about') |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
256 | self.aboutPyramidAct.setStatusTip(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
257 | 'Shows some information about Pyramid')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
258 | self.aboutPyramidAct.setWhatsThis(self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
259 | """<b>About Pyramid</b>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | """<p>Shows some information about Pyramid.</p>""" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
261 | )) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
262 | self.aboutPyramidAct.triggered[()].connect(self.__pyramidInfo) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | self.actions.append(self.aboutPyramidAct) |
5
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
264 | |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
265 | self.__setCurrentProject(None) |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
266 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
267 | def initMenu(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
268 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
269 | Public slot to initialize the Pyramid menu. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
270 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
271 | @return the menu generated (QMenu) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
272 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
273 | menu = QMenu(self.trUtf8('P&yramid'), self.__ui) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | menu.setTearOffEnabled(True) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
275 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
276 | menu.addAction(self.selectProjectAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
277 | menu.addSeparator() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
278 | menu.addAction(self.runServerAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
279 | menu.addAction(self.runLoggingServerAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | menu.addAction(self.runBrowserAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
281 | menu.addSeparator() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
282 | menu.addAction(self.createProjectAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
283 | menu.addSeparator() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
284 | menu.addAction(self.setupDevelopAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
285 | menu.addSeparator() |
5
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
286 | menu.addAction(self.initializeDbAct) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
287 | menu.addSeparator() |
8
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
288 | menu.addAction(self.showViewsAct) |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
289 | menu.addSeparator() |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | menu.addAction(self.runPythonShellAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
291 | menu.addSeparator() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
292 | menu.addAction(self.buildDistroAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
293 | menu.addSeparator() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
294 | menu.addAction(self.documentationAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
295 | menu.addSeparator() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
296 | menu.addAction(self.aboutPyramidAct) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
297 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
298 | self.__mainMenu = menu |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
299 | return menu |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
300 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | def projectOpenedHooks(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
302 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
303 | Public method to add our hook methods. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | if self.__e5project.getProjectType() == "Pyramid": |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
306 | self.__formsBrowser = \ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
307 | e5App().getObject("ProjectBrowser").getProjectBrowser("forms") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
308 | self.__formsBrowser.addHookMethodAndMenuEntry("newForm", |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
309 | self.newForm, self.trUtf8("New template...")) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
310 | |
3
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
311 | if self.__e5project.getProjectLanguage() == "Python2": |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
312 | # Babel and lingua are not yet available for Python 3 |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
313 | self.__e5project.projectLanguageAddedByCode.connect( |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
314 | self.__projectLanguageAdded) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
315 | self.__translationsBrowser = \ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
316 | e5App().getObject("ProjectBrowser").getProjectBrowser("translations") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
317 | self.__translationsBrowser.addHookMethodAndMenuEntry("extractMessages", |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
318 | self.extractMessages, self.trUtf8("Extract Messages")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
319 | self.__translationsBrowser.addHookMethodAndMenuEntry("releaseAll", |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
320 | self.compileCatalogs, self.trUtf8("Compile All Catalogs")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
321 | self.__translationsBrowser.addHookMethodAndMenuEntry("releaseSelected", |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
322 | self.compileSelectedCatalogs, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
323 | self.trUtf8("Compile Selected Catalogs")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
324 | self.__translationsBrowser.addHookMethodAndMenuEntry("generateAll", |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
325 | self.updateCatalogs, self.trUtf8("Update All Catalogs")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
326 | self.__translationsBrowser.addHookMethodAndMenuEntry("generateSelected", |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
327 | self.updateSelectedCatalogs, self.trUtf8("Update Selected Catalogs")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
328 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
329 | self.__hooksInstalled = True |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | def projectClosedHooks(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | Public method to remove our hook methods. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
335 | if self.__hooksInstalled: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
336 | self.__formsBrowser.removeHookMethod("newForm") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | self.__formsBrowser = None |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
338 | |
3
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
339 | self.__e5project.projectLanguageAddedByCode.disconnect( |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
340 | self.__projectLanguageAdded) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
341 | self.__translationsBrowser.removeHookMethod("extractMessages") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
342 | self.__translationsBrowser.removeHookMethod("releaseAll") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
343 | self.__translationsBrowser.removeHookMethod("releaseSelected") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
344 | self.__translationsBrowser.removeHookMethod("generateAll") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
345 | self.__translationsBrowser.removeHookMethod("generateSelected") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
346 | self.__translationsBrowser = None |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
347 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
348 | self.__hooksInstalled = False |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
349 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
350 | def newForm(self, path): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
351 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
352 | Public method to create a new form. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
353 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
354 | @param path full directory path for the new form file (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
355 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
356 | dlg = FormSelectionDialog() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
357 | if dlg.exec_() == QDialog.Accepted: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
358 | template = dlg.getTemplateText() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
359 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
360 | filter = self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
361 | "Chameleon Templates (*.pt);;" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
362 | "Chameleon Text Templates (*.txt);;" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
363 | "Mako Templates (*.mako);;" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
364 | "Mako Templates (*.mak);;" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
365 | "HTML Files (*.html);;" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
366 | "HTML Files (*.htm);;" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
367 | "All Files (*)") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
368 | fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
369 | self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
370 | self.trUtf8("New Form"), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
371 | path, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
372 | filter, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
373 | None, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
374 | E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
375 | if fname: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
376 | ext = QFileInfo(fname).suffix() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
377 | if not ext: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
378 | ex = selectedFilter.split("(*")[1].split(")")[0] |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
379 | if ex: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
380 | fname += ex |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
381 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
382 | if os.path.exists(fname): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
383 | res = E5MessageBox.yesNo(self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
384 | self.trUtf8("New Form"), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
385 | self.trUtf8("""The file already exists! Overwrite it?"""), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
386 | icon = E5MessageBox.Warning) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
387 | if not res: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
388 | # user selected to not overwrite |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
389 | return |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
390 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
391 | try: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
392 | f = open(fname, "w", encoding="utf-8") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
393 | f.write(template) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
394 | f.close() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
395 | except IOError as e: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
396 | E5MessageBox.critical(self, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
397 | self.trUtf8("New Form"), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
398 | self.trUtf8("<p>The new form file <b>{0}</b> could not be" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | " created.<br/>" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
400 | "Problem: {1}</p>").format(fname, e)) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
401 | return |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
402 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
403 | self.__e5project.appendFile(fname) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
404 | self.__formsBrowser.sourceFile.emit(fname) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
405 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
406 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
407 | ## methods below implement general functionality |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
408 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
409 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
410 | def projectClosed(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
411 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
412 | Public method to handle the closing of a project. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
413 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
414 | if self.__serverProc is not None: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
415 | self.__serverProcFinished() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | self.__setCurrentProject(None) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
417 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
418 | def __getVirtualEnvironment(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
419 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
420 | Private method to get the path of the virtual environment. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
422 | @return path of the virtual environment (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
423 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
424 | language = self.__e5project.getProjectLanguage() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
425 | if language == "Python3": |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
426 | virtEnv = self.__plugin.getPreferences("VirtualEnvironmentPy3") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
427 | elif language == "Python2": |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
428 | virtEnv = self.__plugin.getPreferences("VirtualEnvironmentPy2") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
429 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
430 | virtEnv = "" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
431 | if virtEnv and not os.path.exists(virtEnv): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
432 | virtEnv = "" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
433 | return virtEnv |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
434 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
435 | def getPyramidCommand(self, cmd): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
436 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
437 | Public method to build a Pyramid command. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
438 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
439 | @param cmd command (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
440 | @return full pyramid command (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
441 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
442 | virtualEnv = self.__getVirtualEnvironment() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
443 | if virtualEnv: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
444 | if isWindowsPlatform(): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
445 | cmd = os.path.join(virtualEnv, "Scripts", cmd) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
446 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
447 | cmd = os.path.join(virtualEnv, "bin", cmd) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
448 | return cmd |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
449 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
450 | def getPythonCommand(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
451 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
452 | Public method to build the Python command. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
453 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
454 | @return python command (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
455 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
456 | python = "python" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
457 | if isWindowsPlatform(): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
458 | python += ".exe" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
459 | virtualEnv = self.__getVirtualEnvironment() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
460 | if virtualEnv: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
461 | if isWindowsPlatform(): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
462 | python = os.path.join(virtualEnv, "Scripts", python) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
463 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
464 | python = os.path.join(virtualEnv, "bin", python) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
465 | return python |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
466 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
467 | def __pyramidInfo(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
468 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
469 | Private slot to show some info about Pyramid. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
470 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
471 | url = "http://www.pylonsproject.org/projects/pyramid/about" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
472 | msgBox = E5MessageBox.E5MessageBox(E5MessageBox.Question, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
473 | self.trUtf8("About Pyramid"), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
474 | self.trUtf8( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
475 | "<p>Pyramid is a high-level Python Web framework that encourages rapid " |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
476 | "development and clean, pragmatic design.</p>" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
477 | "<p>URL: <a href=\"{0}\">{0}</a></p>" |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | ).format(url), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
479 | modal=True, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
480 | buttons=E5MessageBox.Ok) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
481 | msgBox.setIconPixmap(UI.PixmapCache.getPixmap( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
482 | os.path.join("ProjectPyramid", "icons", "pyramid64.png"))) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
483 | msgBox.exec_() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
484 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
485 | def isSpawningConsole(self, consoleCmd): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
486 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
487 | Public method to check, if the given console is a spawning console. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
488 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
489 | @param consoleCmd console command (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
490 | @return tuple of two entries giving an indication, if the console |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
491 | is spawning (boolean) and the (possibly) cleaned console command |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
492 | (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
493 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
494 | if consoleCmd and consoleCmd[0] == '@': |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
495 | return (True, consoleCmd[1:]) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
496 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
497 | return (False, consoleCmd) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
498 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
499 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
500 | ## slots below implement creation functions |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
501 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
502 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
503 | def __createProject(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
504 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
505 | Private slot to create a new Pyramid project. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
506 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
507 | dlg = CreateParametersDialog(self) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
508 | if dlg.exec_() == QDialog.Accepted: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
509 | scaffold, project, overwrite, simulate = dlg.getData() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
510 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
511 | cmd = self.getPyramidCommand("pcreate") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
512 | args = [] |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
513 | if overwrite: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
514 | args.append("--overwrite") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
515 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
516 | args.append("--interactive") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
517 | if simulate: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
518 | args.append("--simulate") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
519 | args.append("--scaffold={0}".format(scaffold)) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
520 | args.append(project) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
521 | dlg = PyramidDialog(self.trUtf8("Create Pyramid Project"), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
522 | linewrap=False, parent=self.__ui) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
523 | if dlg.startProcess(cmd, args, self.__e5project.getProjectPath()): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
524 | dlg.exec_() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
525 | if dlg.normalExit() and not simulate: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
526 | # search for files created by pcreate and add them to the project |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
527 | projectPath = os.path.join(self.__e5project.getProjectPath(), project) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
528 | for entry in os.walk(projectPath): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
529 | for fileName in entry[2]: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
530 | fullName = os.path.join(entry[0], fileName) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
531 | self.__e5project.appendFile(fullName) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
532 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
533 | # create the base directory for translations |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
534 | i18nPath = os.path.join(projectPath, project.lower(), "i18n") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
535 | if not os.path.exists(i18nPath): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
536 | os.makedirs(i18nPath) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
537 | self.__e5project.setDirty(True) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
538 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
539 | self.__setCurrentProject(project) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
540 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
541 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
542 | ## methods below implement site related functions |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
543 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
544 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
545 | def __findProjects(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
546 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
547 | Private method to determine the relative path of all Pyramid |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
548 | projects (= top level dirs). |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
549 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
550 | @return list of projects (list of string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
551 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
552 | projects = [] |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
553 | ppath = self.__e5project.getProjectPath() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
554 | for entry in os.listdir(ppath): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
555 | if entry[0] not in "._" and \ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
556 | os.path.isdir(os.path.join(ppath, entry)): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
557 | projects.append(entry) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
558 | return projects |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
559 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
560 | def __selectProject(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
561 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
562 | Private method to select a Pyramid project to work with. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
563 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
564 | @return selected project (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
565 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
566 | projects = self.__findProjects() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
567 | if len(projects) == 0: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
568 | project = None |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
569 | elif len(projects) == 1: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
570 | project = projects[0] |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
571 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
572 | if self.__currentProject is not None: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
573 | try: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
574 | cur = projects.index(self.__currentProject) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
575 | except ValueError: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
576 | cur = 0 |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
577 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
578 | cur = 0 |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
579 | project, ok = QInputDialog.getItem( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
580 | self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
581 | self.trUtf8("Select Pyramid Project"), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
582 | self.trUtf8("Select the Pyramid project to work with."), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
583 | projects, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
584 | cur, False) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
585 | if not ok: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
586 | projects = None |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
587 | self.__setCurrentProject(project) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
588 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
589 | def __projectPath(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
590 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
591 | Private method to calculate the full path of the Pyramid project. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
592 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
593 | @exception PyramidNoProjectSelectedException raised, if no project is selected |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
594 | @return path of the project (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
595 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
596 | if self.__currentProject is None: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
597 | self.__selectProject() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
598 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
599 | if self.__currentProject is None: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
600 | raise PyramidNoProjectSelectedException |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
601 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
602 | return os.path.join(self.__e5project.getProjectPath(), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
603 | self.__currentProject) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
604 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
605 | def __setCurrentProject(self, project): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
606 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
607 | Private slot to set the current project. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
608 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
609 | @param project name of the project (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
610 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
611 | if project is not None and len(project) == 0: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
612 | self.__currentProject = None |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
613 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
614 | self.__currentProject = project |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
615 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
616 | if self.__currentProject is None: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
617 | curProject = self.trUtf8("None") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
618 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
619 | curProject = self.__currentProject |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
620 | self.selectProjectAct.setText( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
621 | self.trUtf8('&Current Pyramid Project ({0})').format(curProject)) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
622 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
623 | if self.__currentProject is None: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
624 | self.__e5project.pdata["TRANSLATIONPATTERN"] = [] |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
625 | else: |
3
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
626 | config = configparser.ConfigParser() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
627 | config.read(os.path.join(self.__projectPath(), "setup.cfg")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
628 | outputDir = config.get("init_catalog", "output_dir") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
629 | domain = config.get("init_catalog", "domain") |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
630 | self.__e5project.pdata["TRANSLATIONPATTERN"] = [ |
3
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
631 | os.path.join(project, outputDir, "%language%", |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
632 | "LC_MESSAGES", "{0}.po".format(domain)) |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
633 | ] |
5
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
634 | |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
635 | if self.__currentProject is None: |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
636 | self.initializeDbAct.setEnabled(False) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
637 | else: |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
638 | initCmd = self.__getInitDbCommand() |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
639 | self.initializeDbAct.setEnabled(os.path.exists(initCmd)) |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
640 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
641 | def __project(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
642 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
643 | Private method to get the name of the current Pyramid project. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
644 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
645 | @exception PyramidNoProjectSelectedException raised, if no project is selected |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
646 | @return name of the project (string) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
647 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
648 | if self.__currentProject is None: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
649 | self.__selectProject() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
650 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
651 | if self.__currentProject is None: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
652 | raise PyramidNoProjectSelectedException |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
653 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
654 | return self.__currentProject |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
655 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
656 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
657 | ## slots below implement run functions |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
658 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
659 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
660 | def __runServer(self, logging = False): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
661 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
662 | Private slot to start the Pyramid Web server. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
663 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
664 | @param logging flag indicating to enable logging (boolean) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
665 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
666 | consoleCmd = self.isSpawningConsole( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
667 | self.__plugin.getPreferences("ConsoleCommand"))[1] |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
668 | if consoleCmd: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
669 | try: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
670 | projectPath = self.__projectPath() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
671 | except PyramidNoProjectSelectedException: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
672 | E5MessageBox.warning(self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
673 | self.trUtf8('Run Server'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
674 | self.trUtf8('No current Pyramid project selected or no Pyramid ' |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
675 | 'project created yet. Aborting...')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
676 | return |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
677 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
678 | args = Utilities.parseOptionString(consoleCmd) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
679 | args[0] = Utilities.getExecutablePath(args[0]) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
680 | args.append(self.getPyramidCommand("pserve")) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
681 | if logging: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
682 | args.append("--log-file=server.log") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
683 | args.append("--reload") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
684 | args.append(os.path.join(projectPath, "development.ini")) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
685 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
686 | if isWindowsPlatform(): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
687 | serverProcStarted, pid = \ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
688 | QProcess.startDetached(args[0], args[1:], projectPath) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
689 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
690 | if self.__serverProc is not None: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
691 | self.__serverProcFinished() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
692 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
693 | self.__serverProc = QProcess() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
694 | self.__serverProc.finished.connect(self.__serverProcFinished) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
695 | self.__serverProc.setWorkingDirectory(projectPath) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
696 | self.__serverProc.start(args[0], args[1:]) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
697 | serverProcStarted = self.__serverProc.waitForStarted() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
698 | if not serverProcStarted: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
699 | E5MessageBox.critical(self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
700 | self.trUtf8('Process Generation Error'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
701 | self.trUtf8('The Pyramid server could not be started.')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
702 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
703 | def __runLoggingServer(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
704 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
705 | Private slot to start the Pyramid Web server with logging. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
706 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
707 | self.__runServer(True) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
708 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
709 | def __serverProcFinished(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
710 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
711 | Private slot connected to the finished signal. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
712 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
713 | if self.__serverProc is not None and \ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
714 | self.__serverProc.state() != QProcess.NotRunning: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
715 | self.__serverProc.terminate() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
716 | QTimer.singleShot(2000, self.__serverProc.kill) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
717 | self.__serverProc.waitForFinished(3000) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
718 | self.__serverProc = None |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
719 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
720 | def __runBrowser(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
721 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
722 | Private slot to start the default web browser with the server URL. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
723 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
724 | try: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
725 | projectPath = self.__projectPath() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
726 | except PyramidNoProjectSelectedException: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
727 | E5MessageBox.warning(self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
728 | self.trUtf8('Run Web-Browser'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
729 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
730 | ' created yet. Aborting...')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
731 | return |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
732 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
733 | config = configparser.ConfigParser() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
734 | config.read(os.path.join(projectPath, "development.ini")) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
735 | port = config.get("server:main", "port", fallback="6543") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
736 | url = QUrl("http://localhost:{0}".format(port)) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
737 | res = QDesktopServices.openUrl(url) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
738 | if not res: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
739 | E5MessageBox.critical(self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
740 | self.trUtf8('Run Web-Browser'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
741 | self.trUtf8('Could not start the web-browser for the URL "{0}".')\ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
742 | .format(url.toString())) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
743 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
744 | def __runPythonShell(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
745 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
746 | Private slot to start a Python console for a Pyramid project. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
747 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
748 | consoleCmd = self.isSpawningConsole( |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
749 | self.__plugin.getPreferences("ConsoleCommand"))[1] |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
750 | if consoleCmd: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
751 | try: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
752 | projectPath = self.__projectPath() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
753 | except PyramidNoProjectSelectedException: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
754 | E5MessageBox.warning(self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
755 | self.trUtf8('Start Pyramid Python Console'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
756 | self.trUtf8('No current Pyramid project selected or no Pyramid ' |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
757 | 'project created yet. Aborting...')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
758 | return |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
759 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
760 | args = Utilities.parseOptionString(consoleCmd) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
761 | args[0] = Utilities.getExecutablePath(args[0]) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
762 | args.append(self.getPyramidCommand("pshell")) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
763 | language = self.__e5project.getProjectLanguage() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
764 | if language == "Python2": |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
765 | consoleType = self.__plugin.getPreferences("Python2ConsoleType") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
766 | else: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
767 | consoleType = self.__plugin.getPreferences("Python3ConsoleType") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
768 | args.append("--python-shell={0}".format(consoleType)) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
769 | args.append(os.path.join(projectPath, "development.ini")) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
770 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
771 | started, pid = QProcess.startDetached(args[0], args[1:], projectPath) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
772 | if not started: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
773 | E5MessageBox.critical(self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
774 | self.trUtf8('Process Generation Error'), |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
775 | self.trUtf8('The Pyramid Shell process could not be started.')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
776 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
777 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
778 | ## slots below implement setup functions |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
779 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
780 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
781 | def __setupDevelop(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
782 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
783 | Private slot to set up the development environment for the current project. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
784 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
785 | title = self.trUtf8("Setup Development Environment") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
786 | try: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
787 | wd = self.__projectPath() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
788 | except PyramidNoProjectSelectedException: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
789 | E5MessageBox.warning(self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
790 | title, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
791 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
792 | ' created yet. Aborting...')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
793 | return |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
794 | |
5
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
795 | cmd = self.getPythonCommand() |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
796 | args = [] |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
797 | args.append("setup.py") |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
798 | args.append("develop") |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
799 | |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
800 | dia = PyramidDialog(title, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
801 | msgSuccess = \ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
802 | self.trUtf8("Pyramid development environment setup successfully.")) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
803 | res = dia.startProcess(cmd, args, wd) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
804 | if res: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
805 | dia.exec_() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
806 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
807 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
808 | ## slots below implement distribution functions |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
809 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
810 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
811 | def __buildDistribution(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
812 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
813 | Private slot to build a distribution file for the current Pyramid project. |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
814 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
815 | title = self.trUtf8("Build Distribution File") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
816 | try: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
817 | projectPath = self.__projectPath() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
818 | except PyramidNoProjectSelectedException: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
819 | E5MessageBox.warning(self.__ui, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
820 | title, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
821 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
822 | ' created yet. Aborting...')) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
823 | return |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
824 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
825 | dlg = DistributionTypeSelectionDialog(self, projectPath, self.__ui) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
826 | if dlg.exec_() == QDialog.Accepted: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
827 | formats = dlg.getFormats() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
828 | cmd = self.getPythonCommand() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
829 | args = [] |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
830 | args.append("setup.py") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
831 | args.append("sdist") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
832 | if formats: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
833 | args.append("--formats={0}".format(','.join(formats))) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
834 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
835 | dia = PyramidDialog(title, |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
836 | msgSuccess = \ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
837 | self.trUtf8("Python distribution file built successfully.")) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
838 | res = dia.startProcess(cmd, args, projectPath) |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
839 | if res: |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
840 | dia.exec_() |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
841 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
842 | ################################################################## |
5
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
843 | ## slots below implement database functions |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
844 | ################################################################## |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
845 | |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
846 | def __getInitDbCommand(self): |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
847 | """ |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
848 | Private method to create the path to the initialization script. |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
849 | |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
850 | @return path to the initialization script (string) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
851 | """ |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
852 | try: |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
853 | cmd = "initialize_{0}_db".format(self.__project()) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
854 | return self.getPyramidCommand(cmd) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
855 | except PyramidNoProjectSelectedException: |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
856 | E5MessageBox.warning(self.__ui, |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
857 | self.trUtf8("Initialize Database"), |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
858 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
859 | ' created yet. Aborting...')) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
860 | return "" |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
861 | |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
862 | def __initializeDatabase(self): |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
863 | """ |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
864 | Private slot to initialize the database of the Pyramid project. |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
865 | """ |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
866 | title = self.trUtf8("Initialize Database") |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
867 | try: |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
868 | projectPath = self.__projectPath() |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
869 | except PyramidNoProjectSelectedException: |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
870 | E5MessageBox.warning(self.__ui, |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
871 | title, |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
872 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
873 | ' created yet. Aborting...')) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
874 | return |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
875 | |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
876 | cmd = self.__getInitDbCommand() |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
877 | args = [] |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
878 | args.append("development.ini") |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
879 | |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
880 | dia = PyramidDialog(title, |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
881 | msgSuccess = \ |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
882 | self.trUtf8("Database initialized successfully.")) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
883 | res = dia.startProcess(cmd, args, projectPath) |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
884 | if res: |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
885 | dia.exec_() |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
886 | |
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
887 | ################################################################## |
8
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
888 | ## slots below implement various debugging functions |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
889 | ################################################################## |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
890 | |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
891 | def __showMatchingViews(self): |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
892 | """ |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
893 | Private slot showing all views that would match a given URL. |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
894 | """ |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
895 | title = self.trUtf8("Show Matching Views") |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
896 | try: |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
897 | projectPath = self.__projectPath() |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
898 | except PyramidNoProjectSelectedException: |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
899 | E5MessageBox.warning(self.__ui, |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
900 | title, |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
901 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
902 | ' created yet. Aborting...')) |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
903 | return |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
904 | |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
905 | url, ok = QInputDialog.getText( |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
906 | self.__ui, |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
907 | self.trUtf8("Show Matching Views"), |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
908 | self.trUtf8("Enter the URL to be matched:"), |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
909 | QLineEdit.Normal, |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
910 | "/") |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
911 | if not ok or url == "": |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
912 | return |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
913 | |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
914 | cmd = self.getPyramidCommand("pviews") |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
915 | args = [] |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
916 | args.append("development.ini") |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
917 | args.append(url) |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
918 | |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
919 | dia = PyramidDialog(title, fixed=True, linewrap=False) |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
920 | res = dia.startProcess(cmd, args, projectPath) |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
921 | if res: |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
922 | dia.exec_() |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
923 | |
ac62d7dc6a37
Added code for the 'pviews' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5
diff
changeset
|
924 | ################################################################## |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
925 | ## slots below implement documentation functions |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
926 | ################################################################## |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
927 | |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
928 | def __showDocumentation(self): |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
929 | """ |
5
455dc39cd212
Added action to initialize a Pyramid project database.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3
diff
changeset
|
930 | Private slot to show the helpviewer with the Pyramid documentation. |
2
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
931 | """ |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
932 | page = self.__plugin.getPreferences("PyramidDocUrl") |
e691c51ab655
Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
933 | self.__ui.launchHelpViewer(page) |
3
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
934 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
935 | ################################################################## |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
936 | ## slots below implement translation functions |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
937 | ################################################################## |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
938 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
939 | def __getLocale(self, filename): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
940 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
941 | Private method to extract the locale out of a file name. |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
942 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
943 | @param filename name of the file used for extraction (string) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
944 | @return extracted locale (string) or None |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
945 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
946 | if self.__e5project.pdata["TRANSLATIONPATTERN"]: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
947 | pattern = self.__e5project.pdata["TRANSLATIONPATTERN"][0]\ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
948 | .replace("%language%", "(.*?)") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
949 | match = re.search(pattern, filename) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
950 | if match is not None: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
951 | loc = match.group(1) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
952 | return loc |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
953 | else: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
954 | loc = None |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
955 | else: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
956 | loc = None |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
957 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
958 | return loc |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
959 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
960 | def __normalizeList(self, filenames): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
961 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
962 | Private method to normalize a list of file names. |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
963 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
964 | @param filenames list of file names to normalize (list of string) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
965 | @return normalized file names (list of string) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
966 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
967 | nfilenames = [] |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
968 | for filename in filenames: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
969 | if filename.endswith(".mo"): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
970 | filename = filename.replace(".mo", ".po") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
971 | if filename not in nfilenames: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
972 | nfilenames.append(filename) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
973 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
974 | return nfilenames |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
975 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
976 | def __projectFilteredList(self, filenames): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
977 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
978 | Private method to filter a list of file names by Pyramid project. |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
979 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
980 | @param filenames list of file names to be filtered (list of string) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
981 | @return file names belonging to the current site (list of string) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
982 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
983 | project = self.__project() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
984 | nfilenames = [] |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
985 | for filename in filenames: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
986 | if filename.startswith(project + os.sep): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
987 | nfilenames.append(filename) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
988 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
989 | return nfilenames |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
990 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
991 | def extractMessages(self): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
992 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
993 | Public method to extract the messages catalog template file. |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
994 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
995 | title = self.trUtf8("Extract messages") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
996 | try: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
997 | projectPath = self.__projectPath() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
998 | except PyramidNoProjectSelectedException: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
999 | E5MessageBox.warning(self.__ui, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1000 | title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1001 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1002 | ' created yet. Aborting...')) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1003 | return |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1004 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1005 | cmd = self.getPythonCommand() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1006 | args = [] |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1007 | args.append("setup.py") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1008 | args.append("extract_messages") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1009 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1010 | dia = PyramidDialog(title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1011 | msgSuccess = \ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1012 | self.trUtf8("\nMessages extracted successfully.")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1013 | res = dia.startProcess(cmd, args, projectPath) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1014 | if res: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1015 | dia.exec_() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1016 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1017 | config = configparser.ConfigParser() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1018 | config.read(os.path.join(projectPath, "setup.cfg")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1019 | potFile = config.get("extract_messages", "output_file") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1020 | if potFile: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1021 | self.__e5project.appendFile(os.path.join(projectPath, potFile)) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1022 | else: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1023 | try: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1024 | lowerProject = self.__project().lower() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1025 | except PyramidNoProjectSelectedException: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1026 | E5MessageBox.warning(self.__ui, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1027 | title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1028 | self.trUtf8('No current Pyramid project selected or no Pyramid' |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1029 | ' project created yet. Aborting...')) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1030 | return |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1031 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1032 | self.__e5project.appendFile(os.path.join( |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1033 | projectPath, lowerProject, "locale", "%s.pot" % lowerProject)) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1034 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1035 | def __projectLanguageAdded(self, code): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1036 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1037 | Private slot handling the addition of a new language. |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1038 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1039 | @param code language code of the new language (string) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1040 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1041 | title = self.trUtf8("Initializing message catalog for '%1'").arg(code) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1042 | try: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1043 | projectPath = self.__projectPath() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1044 | except PyramidNoProjectSelectedException: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1045 | E5MessageBox.warning(self.__ui, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1046 | title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1047 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1048 | ' created yet. Aborting...')) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1049 | return |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1050 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1051 | cmd = self.getPythonCommand() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1052 | args = [] |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1053 | args.append("setup.py") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1054 | args.append("init_catalog") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1055 | args.append("-l") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1056 | args.append(code) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1057 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1058 | dia = PyramidDialog(title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1059 | msgSuccess = \ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1060 | self.trUtf8("\nMessage catalog initialized successfully.")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1061 | res = dia.startProcess(cmd, args, projectPath) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1062 | if res: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1063 | dia.exec_() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1064 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1065 | langFile = self.__e4project.pdata["TRANSLATIONPATTERN"][0]\ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1066 | .replace("%language%", code) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1067 | self.__e5project.appendFile(langFile) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1068 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1069 | def compileCatalogs(self, filenames): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1070 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1071 | Public method to compile the message catalogs. |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1072 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1073 | @param filenames list of filenames (not used) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1074 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1075 | title = self.trUtf8("Compiling message catalogs") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1076 | try: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1077 | projectPath = self.__projectPath() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1078 | except PyramidNoProjectSelectedException: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1079 | E5MessageBox.warning(self.__ui, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1080 | title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1081 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1082 | ' created yet. Aborting...')) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1083 | return |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1084 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1085 | cmd = self.getPythonCommand() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1086 | args = [] |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1087 | args.append("setup.py") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1088 | args.append("compile_catalog") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1089 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1090 | dia = PyramidDialog(title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1091 | msgSuccess = \ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1092 | self.trUtf8("\nMessage catalogs compiled successfully.")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1093 | res = dia.startProcess(cmd, args, projectPath) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1094 | if res: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1095 | dia.exec_() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1096 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1097 | for entry in os.walk(projectPath): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1098 | for fileName in entry[2]: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1099 | fullName = os.path.join(entry[0], fileName) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1100 | if fullName.endswith('.mo'): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1101 | self.__e5project.appendFile(fullName) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1102 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1103 | def compileSelectedCatalogs(self, filenames): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1104 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1105 | Public method to update the message catalogs. |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1106 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1107 | @param filenames list of file names (list of string) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1108 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1109 | title = self.trUtf8("Compiling message catalogs") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1110 | try: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1111 | projectPath = self.__projectPath() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1112 | except PyramidNoProjectSelectedException: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1113 | E5MessageBox.warning(self.__ui, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1114 | title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1115 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1116 | ' created yet. Aborting...')) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1117 | return |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1118 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1119 | argsLists = [] |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1120 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1121 | for filename in self.__normalizeList(self.__projectFilteredList(filenames)): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1122 | locale = self.__getLocale(filename) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1123 | if locale: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1124 | args = [] |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1125 | args.append(self.getPythonCommand()) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1126 | args.append("setup.py") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1127 | args.append("compile_catalog") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1128 | args.append("-l") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1129 | args.append(locale) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1130 | argsLists.append(args) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1131 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1132 | if len(argsLists) == 0: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1133 | E5MessageBox.warning(self.__ui, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1134 | title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1135 | self.trUtf8('No locales detected. Aborting...')) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1136 | return |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1137 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1138 | dia = PyramidDialog(title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1139 | msgSuccess = \ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1140 | self.trUtf8("\nMessage catalogs compiled successfully.")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1141 | res = dia.startBatchProcesses(argsLists, projectPath) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1142 | if res: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1143 | dia.exec_() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1144 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1145 | for entry in os.walk(self.__sitePath()): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1146 | for fileName in entry[2]: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1147 | fullName = os.path.join(entry[0], fileName) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1148 | if fullName.endswith('.mo'): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1149 | self.__e5project.appendFile(fullName) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1150 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1151 | def updateCatalogs(self, filenames): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1152 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1153 | Public method to update the message catalogs. |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1154 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1155 | @param filenames list of filenames (not used) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1156 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1157 | title = self.trUtf8("Updating message catalogs") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1158 | try: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1159 | projectPath = self.__projectPath() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1160 | except PyramidNoProjectSelectedException: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1161 | E5MessageBox.warning(self.__ui, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1162 | title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1163 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1164 | ' created yet. Aborting...')) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1165 | return |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1166 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1167 | cmd = self.getPythonCommand() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1168 | args = [] |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1169 | args.append("setup.py") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1170 | args.append("update_catalog") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1171 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1172 | dia = PyramidDialog(title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1173 | msgSuccess = \ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1174 | self.trUtf8("\nMessage catalogs updated successfully.")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1175 | res = dia.startProcess(cmd, args, projectPath) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1176 | if res: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1177 | dia.exec_() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1178 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1179 | def updateSelectedCatalogs(self, filenames): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1180 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1181 | Public method to update the message catalogs. |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1182 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1183 | @param filenames list of filenames |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1184 | """ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1185 | title = self.trUtf8("Updating message catalogs") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1186 | try: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1187 | projectPath = self.__projectPath() |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1188 | except PyramidNoProjectSelectedException: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1189 | E5MessageBox.warning(self.__ui, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1190 | title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1191 | self.trUtf8('No current Pyramid project selected or no Pyramid project' |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1192 | ' created yet. Aborting...')) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1193 | return |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1194 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1195 | argsLists = [] |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1196 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1197 | for filename in self.__normalizeList(self.__projectFilteredList(filenames)): |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1198 | locale = self.__getLocale(filename) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1199 | if locale: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1200 | args = [] |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1201 | args.append(self.getPythonCommand()) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1202 | args.append("setup.py") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1203 | args.append("update_catalog") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1204 | args.append("-l") |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1205 | args.append(locale) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1206 | argsLists.append(args) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1207 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1208 | if len(argsLists) == 0: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1209 | E5MessageBox.warning(self.__ui, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1210 | title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1211 | self.trUtf8('No locales detected. Aborting...')) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1212 | return |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1213 | |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1214 | dia = PyramidDialog(title, |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1215 | msgSuccess = \ |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1216 | self.trUtf8("\nMessage catalogs updated successfully.")) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1217 | res = dia.startBatchProcesses(argsLists, projectPath) |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1218 | if res: |
76c45d31d462
Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2
diff
changeset
|
1219 | dia.exec_() |