26 # Start-of-Header |
24 # Start-of-Header |
27 name = "Pyramid Project Plugin" |
25 name = "Pyramid Project Plugin" |
28 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
29 autoactivate = True |
27 autoactivate = True |
30 deactivateable = True |
28 deactivateable = True |
31 version = "2.5.0" |
29 version = "3.0.0" |
32 className = "ProjectPyramidPlugin" |
30 className = "ProjectPyramidPlugin" |
33 packageName = "ProjectPyramid" |
31 packageName = "ProjectPyramid" |
34 shortDescription = "Project support for Pyramid projects." |
32 shortDescription = "Project support for Pyramid projects." |
35 longDescription = \ |
33 longDescription = ( |
36 """This plugin implements project support for Pyramid projects.""" |
34 """This plugin implements project support for Pyramid projects.""" |
|
35 ) |
37 needsRestart = False |
36 needsRestart = False |
38 pyqtApi = 2 |
37 pyqtApi = 2 |
39 python2Compatible = True |
|
40 # End-of-Header |
38 # End-of-Header |
41 |
39 |
42 error = "" |
40 error = "" |
43 |
41 |
44 pyramidPluginObject = None |
42 pyramidPluginObject = None |
51 @param configDlg reference to the configuration dialog |
49 @param configDlg reference to the configuration dialog |
52 @return reference to the configuration page |
50 @return reference to the configuration page |
53 """ |
51 """ |
54 global pyramidPluginObject |
52 global pyramidPluginObject |
55 from ProjectPyramid.ConfigurationPage.PyramidPage import PyramidPage |
53 from ProjectPyramid.ConfigurationPage.PyramidPage import PyramidPage |
56 page = PyramidPage(pyramidPluginObject) |
54 return PyramidPage(pyramidPluginObject) |
57 return page |
|
58 |
55 |
59 |
56 |
60 def getConfigData(): |
57 def getConfigData(): |
61 """ |
58 """ |
62 Module function returning data as required by the configuration dialog. |
59 Module function returning data as required by the configuration dialog. |
89 Module function to return the API files made available by this plugin. |
86 Module function to return the API files made available by this plugin. |
90 |
87 |
91 @param language language to get APIs for (string) |
88 @param language language to get APIs for (string) |
92 @return list of API filenames (list of string) |
89 @return list of API filenames (list of string) |
93 """ |
90 """ |
94 if language in ["Python3", "Python2"]: |
91 if language == "Python3": |
95 apisDir = \ |
92 apisDir = os.path.join(os.path.dirname(__file__), |
96 os.path.join(os.path.dirname(__file__), "ProjectPyramid", "APIs") |
93 "ProjectPyramid", "APIs") |
97 apis = glob.glob(os.path.join(apisDir, '*.api')) |
94 return glob.glob(os.path.join(apisDir, '*.api')) |
98 else: |
95 else: |
99 apis = [] |
96 return [] |
100 return apis |
|
101 |
97 |
102 |
98 |
103 def prepareUninstall(): |
99 def prepareUninstall(): |
104 """ |
100 """ |
105 Module function to prepare for an uninstallation. |
101 Module function to prepare for an uninstallation. |
131 QObject.__init__(self, ui) |
127 QObject.__init__(self, ui) |
132 self.__ui = ui |
128 self.__ui = ui |
133 self.__initialize() |
129 self.__initialize() |
134 |
130 |
135 self.__defaults = { |
131 self.__defaults = { |
136 "VirtualEnvironmentNamePy2": "", |
|
137 "VirtualEnvironmentNamePy3": "", |
132 "VirtualEnvironmentNamePy3": "", |
138 |
133 |
139 # these are obsolete and kept for use with eric <18.07 |
|
140 "VirtualEnvironmentPy2": "", |
|
141 "VirtualEnvironmentPy3": "", |
|
142 |
|
143 "Python2ConsoleType": "python", |
|
144 "Python3ConsoleType": "python", |
134 "Python3ConsoleType": "python", |
145 |
135 |
146 "PyramidDocUrl": "http://docs.pylonsproject.org/projects/" |
136 "PyramidDocUrl": "http://docs.pylonsproject.org/projects/" |
147 "pyramid/en/latest/index.html", |
137 "pyramid/en/latest/index.html", |
148 |
138 |
217 "Pyramid", self.tr("Pyramid"), |
207 "Pyramid", self.tr("Pyramid"), |
218 self.fileTypesCallback, |
208 self.fileTypesCallback, |
219 lexerAssociationCallback=self.lexerAssociationCallback, |
209 lexerAssociationCallback=self.lexerAssociationCallback, |
220 binaryTranslationsCallback=self.binaryTranslationsCallback) |
210 binaryTranslationsCallback=self.binaryTranslationsCallback) |
221 |
211 |
222 from Project.ProjectBrowser import SourcesBrowserFlag, \ |
212 from Project.ProjectBrowser import ( |
223 FormsBrowserFlag, TranslationsBrowserFlag, OthersBrowserFlag |
213 SourcesBrowserFlag, FormsBrowserFlag, TranslationsBrowserFlag, |
|
214 OthersBrowserFlag |
|
215 ) |
224 Preferences.setProjectBrowserFlagsDefault( |
216 Preferences.setProjectBrowserFlagsDefault( |
225 "Pyramid", |
217 "Pyramid", |
226 SourcesBrowserFlag | FormsBrowserFlag | |
218 SourcesBrowserFlag | FormsBrowserFlag | |
227 TranslationsBrowserFlag | OthersBrowserFlag, |
219 TranslationsBrowserFlag | OthersBrowserFlag, |
228 ) |
220 ) |
347 "*.pot": "TRANSLATIONS", |
339 "*.pot": "TRANSLATIONS", |
348 "*.po": "TRANSLATIONS", |
340 "*.po": "TRANSLATIONS", |
349 "*.mo": "TRANSLATIONS", |
341 "*.mo": "TRANSLATIONS", |
350 } |
342 } |
351 else: |
343 else: |
352 fileTypes = {} |
344 return {} |
353 return fileTypes |
|
354 |
345 |
355 def lexerAssociationCallback(self, filename): |
346 def lexerAssociationCallback(self, filename): |
356 """ |
347 """ |
357 Public method to get the lexer association of the Pyramid project type |
348 Public method to get the lexer association of the Pyramid project type |
358 for a file. |
349 for a file. |
374 |
365 |
375 @param filename name of the translation source file (string) |
366 @param filename name of the translation source file (string) |
376 @return name of the binary translation file (string) |
367 @return name of the binary translation file (string) |
377 """ |
368 """ |
378 if filename.endswith(".po"): |
369 if filename.endswith(".po"): |
379 filename = filename.replace(".po", ".mo") |
370 return filename.replace(".po", ".mo") |
|
371 |
380 return filename |
372 return filename |
381 |
373 |
382 def getDefaultPreference(self, key): |
374 def getDefaultPreference(self, key): |
383 """ |
375 """ |
384 Public method to get the default value for a setting. |
376 Public method to get the default value for a setting. |
410 @param value the value to be set |
402 @param value the value to be set |
411 """ |
403 """ |
412 Preferences.Prefs.settings.setValue( |
404 Preferences.Prefs.settings.setValue( |
413 self.PreferencesKey + "/" + key, value) |
405 self.PreferencesKey + "/" + key, value) |
414 |
406 |
415 if key in ["VirtualEnvironmentPy2", "VirtualEnvironmentPy3", |
407 if key in ["VirtualEnvironmentNamePy3"]: |
416 "VirtualEnvironmentNamePy2", "VirtualEnvironmentNamePy3"]: |
|
417 self.__reregisterProjectType() |
408 self.__reregisterProjectType() |
418 elif key == "TranslationsEditor": |
409 elif key == "TranslationsEditor": |
419 if self.__object: |
410 if self.__object: |
420 self.__object.registerOpenHook() |
411 self.__object.registerOpenHook() |
421 |
412 |