ProjectPyramid/Project.py

Tue, 28 Aug 2012 19:51:52 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 28 Aug 2012 19:51:52 +0200
changeset 3
76c45d31d462
parent 2
e691c51ab655
child 5
455dc39cd212
permissions
-rw-r--r--

Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).

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
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from PyQt4.QtGui import QMenu, QDialog, QInputDialog, QDesktopServices
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 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 self.actions = []
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 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
67 "",
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 0, 0,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 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
70 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
71 '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
72 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
73 """<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
74 """<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
75 """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
76 ))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 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
78 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
79 self.__setCurrentProject(None)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 ###############################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 ## create actions below ##
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
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 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
86 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
87 0, 0,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 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
89 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
90 '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
91 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
92 """<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
93 """<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
94 ))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 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
96 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
97
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 ##############################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 ## run actions below ##
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
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 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
103 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
104 0, 0,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 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
106 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
107 '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
108 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
109 """<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
110 """<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
111 """ "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
112 ))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 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
114 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
115
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 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
117 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
118 0, 0,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 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
120 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
121 '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
122 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
123 """<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
124 """<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
125 """ "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
126 ))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 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
128 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
129
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 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
131 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
132 0, 0,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 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
134 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
135 '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
136 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
137 """<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
138 """<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
139 """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
140 ))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 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
142 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
143
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 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
145 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
146 0, 0,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 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
148 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
149 '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
150 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
151 """<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
152 """<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
153 ))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 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
155 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
156
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 ##############################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 ## setup actions below ##
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
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 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
162 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
163 0, 0,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 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
165 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
166 '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
167 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
168 """<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
169 """<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
170 """ "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
171 ))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 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
173 self.actions.append(self.setupDevelopAct)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 ##################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 ## distribution actions below ##
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 ##################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 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
180 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
181 0, 0,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 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
183 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
184 '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
185 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
186 """<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
187 """<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
188 """ "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
189 ))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 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
191 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
192
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 ##################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 ## documentation action below ##
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 ##################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 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
198 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
199 0, 0,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 self,'pyramid_documentation')
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 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
202 '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
203 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
204 """<b>Documentation</b>"""
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 """<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
206 ))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 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
208 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
209
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 ##############################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 ## about action below ##
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 ##############################
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 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
215 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
216 0, 0,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 self,'pyramid_about')
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 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
219 '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
220 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
221 """<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
222 """<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
223 ))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 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
225 self.actions.append(self.aboutPyramidAct)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 def initMenu(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 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
230
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 @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
232 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 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
234 menu.setTearOffEnabled(True)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 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
237 menu.addSeparator()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 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
239 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
240 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
241 menu.addSeparator()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 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
243 menu.addSeparator()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 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
245 menu.addSeparator()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 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
247 menu.addSeparator()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 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
249 menu.addSeparator()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 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
251 menu.addSeparator()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 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
253
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 self.__mainMenu = menu
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 return menu
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 def projectOpenedHooks(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 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
260 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 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
262 self.__formsBrowser = \
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 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
264 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
265 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
266
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
267 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
268 # 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
269 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
270 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
271 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
272 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
273 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
274 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
275 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
276 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
277 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
278 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
279 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
280 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
281 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
282 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
283 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
284
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
285 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
286
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 def projectClosedHooks(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 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
290 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 if self.__hooksInstalled:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 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
293 self.__formsBrowser = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294
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
295 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
296 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
297 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
298 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
299 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
300 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
301 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
302 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
303
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
304 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
305
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 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
307 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 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
309
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 @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
311 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 dlg = FormSelectionDialog()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 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
314 template = dlg.getTemplateText()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 filter = self.trUtf8(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 "Chameleon Templates (*.pt);;"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 "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
319 "Mako Templates (*.mako);;"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 "Mako Templates (*.mak);;"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 "HTML Files (*.html);;"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 "HTML Files (*.htm);;"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 "All Files (*)")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 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
325 self.__ui,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 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
327 path,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 filter,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 None,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 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
331 if fname:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 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
333 if not ext:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 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
335 if ex:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 fname += ex
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 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
339 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
340 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
341 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
342 icon = E5MessageBox.Warning)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 if not res:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 # 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
345 return
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 try:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 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
349 f.write(template)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 f.close()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 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
352 E5MessageBox.critical(self,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 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
354 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
355 " created.<br/>"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 "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
357 return
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 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
360 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
361
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 ## 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
364 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 def projectClosed(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 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
369 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 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
371 self.__serverProcFinished()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 self.__setCurrentProject(None)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 def __getVirtualEnvironment(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 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
377
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 @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
379 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 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
381 if language == "Python3":
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 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
383 elif language == "Python2":
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 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
385 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 virtEnv = ""
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 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
388 virtEnv = ""
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 return virtEnv
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 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
392 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 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
394
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 @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
396 @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
397 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 virtualEnv = self.__getVirtualEnvironment()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 if virtualEnv:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 if isWindowsPlatform():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 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
402 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 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
404 return cmd
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 def getPythonCommand(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 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
409
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 @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
411 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 python = "python"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 if isWindowsPlatform():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 python += ".exe"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 virtualEnv = self.__getVirtualEnvironment()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 if virtualEnv:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 if isWindowsPlatform():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 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
419 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 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
421 return python
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 def __pyramidInfo(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 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
426 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 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
428 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
429 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
430 self.trUtf8(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 "<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
432 "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
433 "<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
434 ).format(url),
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 modal=True,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 buttons=E5MessageBox.Ok)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 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
438 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
439 msgBox.exec_()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 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
442 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 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
444
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 @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
446 @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
447 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
448 (string)
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 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
451 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
452 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 return (False, consoleCmd)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454
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 ## 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
457 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 def __createProject(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 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
462 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 dlg = CreateParametersDialog(self)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 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
465 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
466
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 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
468 args = []
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469 if overwrite:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470 args.append("--overwrite")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
471 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
472 args.append("--interactive")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 if simulate:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 args.append("--simulate")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 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
476 args.append(project)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477 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
478 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
479 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
480 dlg.exec_()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 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
482 # 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
483 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
484 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
485 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
486 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
487 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
488
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 # 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
490 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
491 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
492 os.makedirs(i18nPath)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 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
494
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 self.__setCurrentProject(project)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 ## 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
499 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 def __findProjects(self):
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 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
504 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
505
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506 @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
507 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 projects = []
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 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
510 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
511 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
512 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
513 projects.append(entry)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 return projects
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 def __selectProject(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 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
519
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 @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
521 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 projects = self.__findProjects()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 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
524 project = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 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
526 project = projects[0]
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528 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
529 try:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 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
531 except ValueError:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 cur = 0
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 cur = 0
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535 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
536 self.__ui,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 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
538 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
539 projects,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 cur, False)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 if not ok:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 projects = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 self.__setCurrentProject(project)
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 __projectPath(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 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
548
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 @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
550 @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
551 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 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
553 self.__selectProject()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 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
556 raise PyramidNoProjectSelectedException
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 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
559 self.__currentProject)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 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
562 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 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
564
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 @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
566 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 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
568 self.__currentProject = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570 self.__currentProject = project
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
571
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 None:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 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
574 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
575 curProject = self.__currentProject
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576 self.selectProjectAct.setText(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577 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
578
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 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
580 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
581 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
582 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
583 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
584 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
585 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
586 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
587 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
588 "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
589 ]
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 def __project(self):
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 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
594
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 @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
596 @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
597 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 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
599 self.__selectProject()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 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
602 raise PyramidNoProjectSelectedException
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 return self.__currentProject
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605
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 ## 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
608 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 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
611 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 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
613
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614 @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
615 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
616 consoleCmd = self.isSpawningConsole(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617 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
618 if consoleCmd:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 try:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 projectPath = self.__projectPath()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 except PyramidNoProjectSelectedException:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 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
623 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
624 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
625 '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
626 return
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 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
629 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
630 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
631 if logging:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 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
633 args.append("--reload")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 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
635
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 if isWindowsPlatform():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 serverProcStarted, pid = \
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 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
639 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 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
641 self.__serverProcFinished()
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 self.__serverProc = QProcess()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 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
645 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
646 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
647 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
648 if not serverProcStarted:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 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
650 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
651 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
652
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653 def __runLoggingServer(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 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
656 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 self.__runServer(True)
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 def __serverProcFinished(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 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
662 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 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
664 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
665 self.__serverProc.terminate()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 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
667 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
668 self.__serverProc = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 def __runBrowser(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 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
673 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674 try:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 projectPath = self.__projectPath()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 except PyramidNoProjectSelectedException:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 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
678 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
679 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
680 ' created yet. Aborting...'))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681 return
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 config = configparser.ConfigParser()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 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
685 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
686 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
687 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
688 if not res:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689 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
690 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
691 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
692 .format(url.toString()))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 def __runPythonShell(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 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
697 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 consoleCmd = self.isSpawningConsole(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 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
700 if consoleCmd:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 try:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702 projectPath = self.__projectPath()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703 except PyramidNoProjectSelectedException:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704 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
705 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
706 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
707 '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
708 return
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 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
711 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
712 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
713 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
714 if language == "Python2":
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 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
716 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717 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
718 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
719 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
720
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721 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
722 if not started:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723 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
724 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
725 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
726
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 ## 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
729 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 def __setupDevelop(self):
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 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
734 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 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
736
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737 cmd = self.getPythonCommand()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 args = []
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 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
740 args.append("develop")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742 try:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 wd = self.__projectPath()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 except PyramidNoProjectSelectedException:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745 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
746 title,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747 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
748 ' created yet. Aborting...'))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749 return
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751 dia = PyramidDialog(title,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 msgSuccess = \
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 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
754 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
755 if res:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 dia.exec_()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 ## 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
760 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 def __buildDistribution(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 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
765 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 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
767 try:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768 projectPath = self.__projectPath()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769 except PyramidNoProjectSelectedException:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 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
771 title,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 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
773 ' created yet. Aborting...'))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 return
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 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
777 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
778 formats = dlg.getFormats()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 cmd = self.getPythonCommand()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 args = []
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 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
782 args.append("sdist")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 if formats:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 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
785
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 dia = PyramidDialog(title,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 msgSuccess = \
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 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
789 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
790 if res:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 dia.exec_()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 ## 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
795 ##################################################################
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 def __showDocumentation(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799 Private slot to show the helpviewer with the Pylons documentation.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801 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
802 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
803
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
804 ##################################################################
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
805 ## 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
806 ##################################################################
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
807
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
808 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
809 """
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
810 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
811
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
812 @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
813 @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
814 """
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
815 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
816 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
817 .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
818 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
819 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
820 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
821 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
822 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
823 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
824 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
825 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
826
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
827 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
828
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
829 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
830 """
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
831 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
832
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
833 @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
834 @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
835 """
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
836 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
837 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
838 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
839 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
840 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
841 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
842
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
843 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
844
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
845 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
846 """
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
847 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
848
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
849 @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
850 @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
851 """
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
852 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
853 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
854 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
855 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
856 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
857
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
858 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
859
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
860 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
861 """
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
862 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
863 """
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
864 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
865 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
866 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
867 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
868 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
869 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
870 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
871 ' 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
872 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
873
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
874 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
875 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
876 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
877 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
878
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
879 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
880 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
881 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
882 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
883 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
884 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
885
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
886 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
887 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
888 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
889 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
890 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
891 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
892 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
893 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
894 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
895 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
896 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
897 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
898 ' 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
899 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
900
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
901 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
902 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
903
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
904 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
905 """
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
906 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
907
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
908 @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
909 """
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
910 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
911 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
912 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
913 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
914 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
915 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
916 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
917 ' 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
918 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
919
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
920 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
921 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
922 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
923 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
924 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
925 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
926
76c45d31d462 Added the internationalization related functions (only for Python 2 because babel and lingua are not supported by Python 3 yet).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
927 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
928 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
929 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
930 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
931 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
932 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
933
76c45d31d462 Added the internationalization related functions (only 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 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
935 .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
936 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
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 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
939 """
76c45d31d462 Added the internationalization related functions (only 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 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
941
76c45d31d462 Added the internationalization related functions (only 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 @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
943 """
76c45d31d462 Added the internationalization related functions (only 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 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
945 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
946 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
947 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
948 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
949 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
950 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
951 ' 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
952 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
953
76c45d31d462 Added the internationalization related functions (only 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 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
955 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
956 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
957 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
958
76c45d31d462 Added the internationalization related functions (only 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 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
960 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
961 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
962 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
963 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
964 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
965
76c45d31d462 Added the internationalization related functions (only 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 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
967 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
968 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
969 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
970 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
971
76c45d31d462 Added the internationalization related functions (only 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 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
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 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
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 @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
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 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
979 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
980 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
981 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
982 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
983 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
984 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
985 ' 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
986 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
987
76c45d31d462 Added the internationalization related functions (only 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 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
989
76c45d31d462 Added the internationalization related functions (only 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 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
991 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
992 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
993 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
994 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
995 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
996 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
997 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
998 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
999 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
1000
76c45d31d462 Added the internationalization related functions (only 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 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
1002 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
1003 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
1004 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
1005 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
1006
76c45d31d462 Added the internationalization related functions (only 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 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
1008 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
1009 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
1010 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
1011 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
1012 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
1013
76c45d31d462 Added the internationalization related functions (only 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 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
1015 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
1016 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
1017 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
1018 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
1019
76c45d31d462 Added the internationalization related functions (only 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 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
1021 """
76c45d31d462 Added the internationalization related functions (only 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 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
1023
76c45d31d462 Added the internationalization related functions (only 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 @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
1025 """
76c45d31d462 Added the internationalization related functions (only 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 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
1027 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
1028 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
1029 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
1030 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
1031 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
1032 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
1033 ' 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
1034 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
1035
76c45d31d462 Added the internationalization related functions (only 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 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
1037 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
1038 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
1039 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
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 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
1042 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
1043 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
1044 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
1045 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
1046 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
1047
76c45d31d462 Added the internationalization related functions (only 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 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
1049 """
76c45d31d462 Added the internationalization related functions (only 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 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
1051
76c45d31d462 Added the internationalization related functions (only 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 @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
1053 """
76c45d31d462 Added the internationalization related functions (only 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 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
1055 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
1056 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
1057 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
1058 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
1059 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
1060 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
1061 ' 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
1062 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
1063
76c45d31d462 Added the internationalization related functions (only 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 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
1065
76c45d31d462 Added the internationalization related functions (only 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 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
1067 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
1068 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
1069 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
1070 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
1071 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
1072 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
1073 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
1074 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
1075 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
1076
76c45d31d462 Added the internationalization related functions (only 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 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
1078 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
1079 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
1080 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
1081 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
1082
76c45d31d462 Added the internationalization related functions (only 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 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
1084 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
1085 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
1086 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
1087 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
1088 dia.exec_()

eric ide

mercurial