PluginProjectPyramid.py

Thu, 20 Jun 2013 18:59:13 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 20 Jun 2013 18:59:13 +0200
changeset 48
c313efdb01de
parent 44
989c961c33ab
child 54
71c83a661c83
child 56
c7adc68350dd
permissions
-rw-r--r--

Added a menu entry to call a translations editor from the translations viewer.

2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
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: 0
diff changeset
2
34
d20f7218d53c Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
3 # Copyright (c) 2012 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
4 #
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
5
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
6 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
7 Module implementing the Pyramid project plugin.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
8 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
9
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
10 import os
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
11 import glob
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
12 import fnmatch
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
13
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
14 from PyQt4.QtCore import QCoreApplication, QObject, QTranslator
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
15
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
16 from E5Gui.E5Application import e5App
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
17
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
18 import Preferences
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
19
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
20 from Globals import isWindowsPlatform, isMacPlatform
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
21
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
22 from ProjectPyramid.Project import Project
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
23
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
24 # Start-of-Header
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
25 name = "Pyramid Project Plugin"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
26 author = "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: 0
diff changeset
27 autoactivate = True
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
28 deactivateable = True
48
c313efdb01de Added a menu entry to call a translations editor from the translations viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 44
diff changeset
29 version = "1.3.0"
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
30 className = "ProjectPyramidPlugin"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
31 packageName = "ProjectPyramid"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
32 shortDescription = "Project support for Pyramid projects."
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
33 longDescription = """This plugin implements project support for Pyramid projects."""
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
34 needsRestart = False
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
35 pyqtApi = 2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
36 # End-of-Header
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
37
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
38 error = ""
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
39
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
40 pyramidPluginObject = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
41
19
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
42
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
43 def createPyramidPage(configDlg):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
44 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
45 Module function to create the Pyramid configuration page.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
46
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
47 @return reference to the configuration page
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
48 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
49 global pyramidPluginObject
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
50 from ProjectPyramid.ConfigurationPage.PyramidPage import PyramidPage
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
51 page = PyramidPage(pyramidPluginObject)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
52 return page
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
53
19
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
54
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
55 def getConfigData():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
56 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
57 Module function returning data as required by the configuration dialog.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
58
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
59 @return dictionary containing the relevant data
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
60 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
61 if e5App().getObject("UserInterface").versionIsNewer('5.0.99', '20120101'):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
62 return {
19
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
63 "pyramidPage": \
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
64 [QCoreApplication.translate("ProjectPyramidPlugin", "Pyramid"),
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
65 os.path.join("ProjectPyramid", "icons",
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
66 "pyramid.png"),
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
67 createPyramidPage, None, None],
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
68 }
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
69 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
70 return {}
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
71
19
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
72
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
73 def apiFiles(language):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
74 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
75 Module function to return the API files made available by this plugin.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
76
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
77 @return list of API filenames (list of string)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
78 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
79 if language in ["Python3", "Python2"]:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
80 apisDir = \
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
81 os.path.join(os.path.dirname(__file__), "ProjectPyramid", "APIs")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
82 apis = glob.glob(os.path.join(apisDir, '*.api'))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
83 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
84 apis = []
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
85 return apis
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
86
19
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
87
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
88 def prepareUninstall():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
89 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
90 Module function to prepare for an uninstallation.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
91 """
25
2dd3d1cf573a Fixed a bug related to uninstalling the plug-in via the external plug-in uninstaller.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 22
diff changeset
92 Preferences.removeProjectBrowserFlags(ProjectPyramidPlugin.PreferencesKey)
2dd3d1cf573a Fixed a bug related to uninstalling the plug-in via the external plug-in uninstaller.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 22
diff changeset
93 Preferences.Prefs.settings.remove(ProjectPyramidPlugin.PreferencesKey)
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
94
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
95
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
96 class ProjectPyramidPlugin(QObject):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
97 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
98 Class implementing the Pyramid project plugin.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
99 """
25
2dd3d1cf573a Fixed a bug related to uninstalling the plug-in via the external plug-in uninstaller.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 22
diff changeset
100 PreferencesKey = "Pyramid"
2dd3d1cf573a Fixed a bug related to uninstalling the plug-in via the external plug-in uninstaller.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 22
diff changeset
101
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
102 lexerAssociations = {
19
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
103 "*.mako": "Pygments|HTML+Mako",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
104 "*.pt": "Pygments|HTML+Genshi",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
105 "*.txt": "Pygments|Genshi",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
106 "*.html": "Pygments|HTML+Genshi",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
107 "*.htm": "Pygments|HTML+Genshi",
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
108 }
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
109
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
110 def __init__(self, ui):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
111 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
112 Constructor
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
113
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
114 @param ui reference to the user interface object (UI.UserInterface)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
115 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
116 QObject.__init__(self, ui)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
117 self.__ui = ui
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
118 self.__initialize()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
119
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
120 self.__defaults = {
19
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
121 "VirtualEnvironmentPy2": "",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
122 "VirtualEnvironmentPy3": "",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
123 "Python2ConsoleType": "python",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
124 "Python3ConsoleType": "python",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
125 "PyramidDocUrl": "http://docs.pylonsproject.org/en/latest/docs/pyramid.html",
48
c313efdb01de Added a menu entry to call a translations editor from the translations viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 44
diff changeset
126 "TranslationsEditor": "",
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
127 }
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
128 if isWindowsPlatform():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
129 self.__defaults["ConsoleCommand"] = "cmd.exe /c"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
130 elif isMacPlatform():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
131 self.__defaults["ConsoleCommand"] = "xterm -e"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
132 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
133 self.__defaults["ConsoleCommand"] = "konsole -e"
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
134
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
135 self.__translator = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
136 self.__loadTranslator()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
137
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
138 def __initialize(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
139 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
140 Private slot to (re)initialize the plugin.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
141 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
142 self.__object = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
143
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
144 self.__mainAct = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
145 self.__mainMenu = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
146
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
147 self.__e5project = e5App().getObject("Project")
44
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
148
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
149 self.__supportedVariants = []
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
150
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
151 def __checkVersions(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
152 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
153 Private function to check that the eric5 version is ok.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
154
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
155 @return flag indicating version is ok (boolean)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
156 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
157 global error
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
158
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
159 if self.__ui.versionIsNewer('5.0.99', '20120101'):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
160 error = ""
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
161 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
162 error = self.trUtf8("eric5 version is too old, {0}, {1} or newer needed.")\
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
163 .format("5.1.0", "20120101")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
164 return False
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
165
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
166 return True
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
167
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
168 def activate(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
169 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
170 Public method to activate this plugin.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
171
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
172 @return tuple of None and activation status (boolean)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
173 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
174 if not self.__checkVersions():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
175 return None, False
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
176
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
177 global pyramidPluginObject
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
178 pyramidPluginObject = self
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
179
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
180 self.__object = Project(self, self.__ui)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
181 self.__object.initActions()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
182 e5App().registerPluginObject("ProjectPyramid", self.__object)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
183
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
184 self.__mainMenu = self.__object.initMenu()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
185
44
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
186 self.__supportedVariants = self.__object.supportedPythonVariants()
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
187
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
188 if self.__supportedVariants:
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
189 try:
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
190 self.__e5project.registerProjectType("Pyramid", self.trUtf8("Pyramid"),
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
191 self.fileTypesCallback,
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
192 lexerAssociationCallback=self.lexerAssociationCallback,
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
193 binaryTranslationsCallback=self.binaryTranslationsCallback,
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
194 progLanguages=self.__supportedVariants[:])
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
195 except TypeError:
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
196 # for backward compatibility
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
197 self.__e5project.registerProjectType("Pyramid", self.trUtf8("Pyramid"),
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
198 self.fileTypesCallback,
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
199 lexerAssociationCallback=self.lexerAssociationCallback,
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
200 binaryTranslationsCallback=self.binaryTranslationsCallback)
37
1b089e0fba1e Modified the code to do lazy import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 35
diff changeset
201
1b089e0fba1e Modified the code to do lazy import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 35
diff changeset
202 from Project.ProjectBrowser import SourcesBrowserFlag, FormsBrowserFlag, \
1b089e0fba1e Modified the code to do lazy import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 35
diff changeset
203 TranslationsBrowserFlag, OthersBrowserFlag
19
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
204 Preferences.setProjectBrowserFlagsDefault("Pyramid",
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
205 SourcesBrowserFlag | \
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
206 FormsBrowserFlag | \
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
207 TranslationsBrowserFlag | \
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
208 OthersBrowserFlag,
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
209 )
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
210
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
211 if self.__e5project.isOpen():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
212 self.__projectOpened()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
213 self.__object.projectOpenedHooks()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
214
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
215 e5App().getObject("Project").projectOpened.connect(self.__projectOpened)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
216 e5App().getObject("Project").projectClosed.connect(self.__projectClosed)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
217 e5App().getObject("Project").newProject.connect(self.__projectOpened)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
218
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
219 e5App().getObject("Project").projectOpenedHooks.connect(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
220 self.__object.projectOpenedHooks)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
221 e5App().getObject("Project").projectClosedHooks.connect(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
222 self.__object.projectClosedHooks)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
223 e5App().getObject("Project").newProjectHooks.connect(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
224 self.__object.projectOpenedHooks)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
225
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
226 return None, True
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
227
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
228 def deactivate(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
229 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
230 Public method to deactivate this plugin.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
231 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
232 e5App().unregisterPluginObject("ProjectPyramid")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
233
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
234 e5App().getObject("Project").projectOpened.disconnect(self.__projectOpened)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
235 e5App().getObject("Project").projectClosed.disconnect(self.__projectClosed)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
236 e5App().getObject("Project").newProject.disconnect(self.__projectOpened)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
237
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
238 e5App().getObject("Project").projectOpenedHooks.disconnect(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
239 self.__object.projectOpenedHooks)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
240 e5App().getObject("Project").projectClosedHooks.disconnect(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
241 self.__object.projectClosedHooks)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
242 e5App().getObject("Project").newProjectHooks.disconnect(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
243 self.__object.projectOpenedHooks)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
244
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
245 self.__e5project.unregisterProjectType("Pyramid")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
246
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
247 self.__object.projectClosedHooks()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
248 self.__projectClosed()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
249
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
250 self.__initialize()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
251
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
252 def __loadTranslator(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
253 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
254 Private method to load the translation file.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
255 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
256 if self.__ui is not None:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
257 loc = self.__ui.getLocale()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
258 if loc and loc != "C":
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
259 locale_dir = \
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
260 os.path.join(os.path.dirname(__file__), "ProjectPyramid", "i18n")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
261 translation = "pyramid_%s" % loc
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
262 translator = QTranslator(None)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
263 loaded = translator.load(translation, locale_dir)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
264 if loaded:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
265 self.__translator = translator
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
266 e5App().installTranslator(self.__translator)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
267 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
268 print("Warning: translation file '{0}' could not be loaded.".format(
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
269 translation))
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
270 print("Using default.")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
271
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
272 def __projectOpened(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
273 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
274 Private slot to handle the projectOpened signal.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
275 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
276 if self.__e5project.getProjectType() == "Pyramid":
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
277 projectAct = self.__ui.getMenuBarAction("project")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
278 actions = self.__ui.menuBar().actions()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
279 insertAct = actions[actions.index(projectAct) + 1]
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
280 self.__mainAct = self.__ui.menuBar().insertMenu(insertAct, self.__mainMenu)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
281
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
282 def __projectClosed(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
283 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
284 Private slot to handle the projectClosed signal.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
285 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
286 if self.__mainAct is not None:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
287 self.__ui.menuBar().removeAction(self.__mainAct)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
288 self.__mainAct = None
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
289 self.__object.projectClosed()
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
290
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
291 def fileTypesCallback(self):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
292 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
293 Public method get the filetype associations of the Pyramid project type.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
294
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
295 @return dictionary with file type associations
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
296 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
297 if self.__e5project.getProjectType() == "Pyramid":
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
298 fileTypes = {
19
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
299 "*.mako": "FORMS",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
300 "*.mak": "FORMS",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
301 "*.pt": "FORMS",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
302 "*.html": "FORMS",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
303 "*.htm": "FORMS",
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
304 "*.js": "SOURCES",
19
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
305 "*.pot": "TRANSLATIONS",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
306 "*.po": "TRANSLATIONS",
f4adfe6e51b0 Corrected PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
307 "*.mo": "TRANSLATIONS",
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
308 }
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
309 else:
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
310 fileTypes = {}
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
311 return fileTypes
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
312
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
313 def lexerAssociationCallback(self, filename):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
314 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
315 Public method to get the lexer association of the Pyramid project type for
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
316 a file.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
317
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
318 @param filename name of the file (string)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
319 @return name of the lexer (string) (Pygments lexers are prefixed with 'Pygments|')
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
320 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
321 for pattern, language in self.lexerAssociations.items():
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
322 if fnmatch.fnmatch(filename, pattern):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
323 return language
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
324
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
325 return ""
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
326
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
327 def binaryTranslationsCallback(self, filename):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
328 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
329 Public method to determine the filename of a compiled translation file
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
330 given the translation source file.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
331
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
332 @param filename name of the translation source file (string)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
333 @return name of the binary translation file (string)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
334 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
335 if filename.endswith(".po"):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
336 filename = filename.replace(".po", ".mo")
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
337 return filename
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
338
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
339 def getPreferences(self, key):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
340 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
341 Public method to retrieve the various settings.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
342
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
343 @param key the key of the value to get
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
344 @param prefClass preferences class used as the storage area
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
345 @return the requested setting
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
346 """
25
2dd3d1cf573a Fixed a bug related to uninstalling the plug-in via the external plug-in uninstaller.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 22
diff changeset
347 return Preferences.Prefs.settings.value(self.PreferencesKey + "/" + key,
12
a8d87f7de3e1 Removed the unused Server Port setting.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
348 self.__defaults[key])
2
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
349
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
350 def setPreferences(self, key, value):
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
351 """
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
352 Public method to store the various settings.
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
353
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
354 @param key the key of the setting to be set (string)
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
355 @param value the value to be set
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
356 @param prefClass preferences class used as the storage area
e691c51ab655 Implemented the required command actions for supporting development of Pyramid projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
357 """
32
107e51521b1e Fixed an issue introduced by the last change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
358 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value)
44
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
359
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
360 if key in ["VirtualEnvironmentPy2", "VirtualEnvironmentPy3"]:
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
361 self.__reregisterProjectType()
48
c313efdb01de Added a menu entry to call a translations editor from the translations viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 44
diff changeset
362 elif key == "TranslationsEditor":
c313efdb01de Added a menu entry to call a translations editor from the translations viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 44
diff changeset
363 if self.__object:
c313efdb01de Added a menu entry to call a translations editor from the translations viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 44
diff changeset
364 self.__object.registerOpenHook()
44
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
365
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
366 def __reregisterProjectType(self):
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
367 """
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
368 Private method to re-register the project type.
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
369 """
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
370 supportedVariants = self.__object.supportedPythonVariants()
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
371 if supportedVariants != self.__supportedVariants:
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
372 # step 1: unregister
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
373 self.__e5project.unregisterProjectType("Pyramid")
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
374
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
375 # step 2: register again with new language settings
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
376 self.__supportedVariants = supportedVariants
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
377 if self.__supportedVariants:
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
378 try:
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
379 self.__e5project.registerProjectType("Pyramid",
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
380 self.trUtf8("Pyramid"), self.fileTypesCallback,
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
381 lexerAssociationCallback=self.lexerAssociationCallback,
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
382 binaryTranslationsCallback=self.binaryTranslationsCallback,
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
383 progLanguages=self.__supportedVariants[:])
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
384 except TypeError:
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
385 # for backward compatibility
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
386 self.__e5project.registerProjectType("Pyramid",
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
387 self.trUtf8("Pyramid"), self.fileTypesCallback,
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
388 lexerAssociationCallback=self.lexerAssociationCallback,
989c961c33ab Extended the Python variant detection to only offer the Pyramid project type, if it is found for the respective Python.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
389 binaryTranslationsCallback=self.binaryTranslationsCallback)

eric ide

mercurial