PluginProjectPyramid.py

changeset 74
11587ae1122f
parent 71
8a78fab32c18
child 80
b39b70d147a9
equal deleted inserted replaced
72:3b3e73b730f0 74:11587ae1122f
11 11
12 import os 12 import os
13 import glob 13 import glob
14 import fnmatch 14 import fnmatch
15 15
16 from PyQt4.QtCore import QCoreApplication, QObject, QTranslator 16 from PyQt5.QtCore import QCoreApplication, QObject, QTranslator
17 17
18 from E5Gui.E5Application import e5App 18 from E5Gui.E5Application import e5App
19 19
20 import Preferences 20 import Preferences
21 21
26 # Start-of-Header 26 # Start-of-Header
27 name = "Pyramid Project Plugin" 27 name = "Pyramid Project Plugin"
28 author = "Detlev Offenbach <detlev@die-offenbachs.de>" 28 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
29 autoactivate = True 29 autoactivate = True
30 deactivateable = True 30 deactivateable = True
31 version = "1.6.0" 31 version = "2.0.0"
32 className = "ProjectPyramidPlugin" 32 className = "ProjectPyramidPlugin"
33 packageName = "ProjectPyramid" 33 packageName = "ProjectPyramid"
34 shortDescription = "Project support for Pyramid projects." 34 shortDescription = "Project support for Pyramid projects."
35 longDescription = \ 35 longDescription = \
36 """This plugin implements project support for Pyramid projects.""" 36 """This plugin implements project support for Pyramid projects."""
154 154
155 self.__supportedVariants = [] 155 self.__supportedVariants = []
156 156
157 def __checkVersions(self): 157 def __checkVersions(self):
158 """ 158 """
159 Private function to check that the eric5 version is ok. 159 Private function to check that the eric6 version is ok.
160 160
161 @return flag indicating version is ok (boolean) 161 @return flag indicating version is ok (boolean)
162 """ 162 """
163 global error 163 global error
164 164
165 if self.__ui.versionIsNewer('5.0.99', '20120101'): 165 if self.__ui.versionIsNewer('5.99.99', '20140701'):
166 error = "" 166 error = ""
167 else: 167 else:
168 error = self.trUtf8( 168 error = self.tr(
169 "eric5 version is too old, {0}, {1} or newer needed.")\ 169 "eric6 version is too old, {0}, {1} or newer needed.")\
170 .format("5.1.0", "20120101") 170 .format("6.0.0", "20140701")
171 return False 171 return False
172 172
173 return True 173 return True
174 174
175 def activate(self): 175 def activate(self):
193 self.__supportedVariants = self.__object.supportedPythonVariants() 193 self.__supportedVariants = self.__object.supportedPythonVariants()
194 194
195 if self.__supportedVariants: 195 if self.__supportedVariants:
196 try: 196 try:
197 self.__e5project.registerProjectType( 197 self.__e5project.registerProjectType(
198 "Pyramid", self.trUtf8("Pyramid"), 198 "Pyramid", self.tr("Pyramid"),
199 self.fileTypesCallback, 199 self.fileTypesCallback,
200 lexerAssociationCallback=self.lexerAssociationCallback, 200 lexerAssociationCallback=self.lexerAssociationCallback,
201 binaryTranslationsCallback=self.binaryTranslationsCallback, 201 binaryTranslationsCallback=self.binaryTranslationsCallback,
202 progLanguages=self.__supportedVariants[:]) 202 progLanguages=self.__supportedVariants[:])
203 except TypeError: 203 except TypeError:
204 # for backward compatibility 204 # for backward compatibility
205 self.__e5project.registerProjectType( 205 self.__e5project.registerProjectType(
206 "Pyramid", self.trUtf8("Pyramid"), 206 "Pyramid", self.tr("Pyramid"),
207 self.fileTypesCallback, 207 self.fileTypesCallback,
208 lexerAssociationCallback=self.lexerAssociationCallback, 208 lexerAssociationCallback=self.lexerAssociationCallback,
209 binaryTranslationsCallback=self.binaryTranslationsCallback) 209 binaryTranslationsCallback=self.binaryTranslationsCallback)
210 210
211 from Project.ProjectBrowser import SourcesBrowserFlag, \ 211 from Project.ProjectBrowser import SourcesBrowserFlag, \
389 self.__e5project.unregisterProjectType("Pyramid") 389 self.__e5project.unregisterProjectType("Pyramid")
390 390
391 # step 2: register again with new language settings 391 # step 2: register again with new language settings
392 self.__supportedVariants = supportedVariants 392 self.__supportedVariants = supportedVariants
393 if self.__supportedVariants: 393 if self.__supportedVariants:
394 try: 394 self.__e5project.registerProjectType(
395 self.__e5project.registerProjectType( 395 "Pyramid",
396 "Pyramid", 396 self.tr("Pyramid"), self.fileTypesCallback,
397 self.trUtf8("Pyramid"), self.fileTypesCallback, 397 lexerAssociationCallback=self.lexerAssociationCallback,
398 lexerAssociationCallback=self.lexerAssociationCallback, 398 binaryTranslationsCallback=self.binaryTranslationsCallback,
399 binaryTranslationsCallback= 399 progLanguages=self.__supportedVariants[:])
400 self.binaryTranslationsCallback,
401 progLanguages=self.__supportedVariants[:])
402 except TypeError:
403 # for backward compatibility
404 self.__e5project.registerProjectType(
405 "Pyramid",
406 self.trUtf8("Pyramid"), self.fileTypesCallback,
407 lexerAssociationCallback=self.lexerAssociationCallback,
408 binaryTranslationsCallback=
409 self.binaryTranslationsCallback)
410 400
411 def getMenu(self, name): 401 def getMenu(self, name):
412 """ 402 """
413 Public method to get a reference to the requested menu. 403 Public method to get a reference to the requested menu.
414 404
425 """ 415 """
426 Public method to get the names of all menus. 416 Public method to get the names of all menus.
427 417
428 @return menu names (list of string) 418 @return menu names (list of string)
429 """ 419 """
430 if self.__object is not None: 420 if self.__object is not None:
431 return list(self.__menus.keys()) 421 return list(self.__menus.keys())
432 else: 422 else:
433 return [] 423 return []

eric ide

mercurial