Project/Project.py

changeset 5100
2c193da9b94f
parent 5099
175b36822cc9
child 5101
6f34ec319318
equal deleted inserted replaced
5099:175b36822cc9 5100:2c193da9b94f
419 "TRANSLATIONSBINPATH": "", 419 "TRANSLATIONSBINPATH": "",
420 "MAINSCRIPT": "", 420 "MAINSCRIPT": "",
421 "VCS": "None", 421 "VCS": "None",
422 "VCSOPTIONS": {}, 422 "VCSOPTIONS": {},
423 "VCSOTHERDATA": {}, 423 "VCSOTHERDATA": {},
424 # TODO: change these to use lists only where neccessary 424 "AUTHOR": '',
425 "AUTHOR": [''], 425 "EMAIL": '',
426 "EMAIL": [''], 426 "HASH": '',
427 "HASH": [''], 427 "PROGLANGUAGE": "Python3",
428 "PROGLANGUAGE": ["Python3"], 428 "MIXEDLANGUAGE": False,
429 "MIXEDLANGUAGE": [False], 429 "PROJECTTYPE": "PyQt5",
430 "PROJECTTYPE": ["PyQt5"],
431 "SPELLLANGUAGE": 430 "SPELLLANGUAGE":
432 [Preferences.getEditor("SpellCheckingDefaultLanguage")], 431 Preferences.getEditor("SpellCheckingDefaultLanguage"),
433 "SPELLWORDS": '', 432 "SPELLWORDS": '',
434 "SPELLEXCLUDES": '', 433 "SPELLEXCLUDES": '',
435 "FILETYPES": {}, 434 "FILETYPES": {},
436 "LEXERASSOCS": {}, 435 "LEXERASSOCS": {},
437 "PROJECTTYPESPECIFICDATA": {}, 436 "PROJECTTYPESPECIFICDATA": {},
508 """ 507 """
509 Public method to initialize the filetype associations with default 508 Public method to initialize the filetype associations with default
510 values. 509 values.
511 """ 510 """
512 self.pdata["FILETYPES"] = {} 511 self.pdata["FILETYPES"] = {}
513 if self.pdata["MIXEDLANGUAGE"][0]: 512 if self.pdata["MIXEDLANGUAGE"]:
514 sourceKey = "Mixed" 513 sourceKey = "Mixed"
515 else: 514 else:
516 sourceKey = self.pdata["PROGLANGUAGE"][0] 515 sourceKey = self.pdata["PROGLANGUAGE"]
517 for ext in self.__sourceExtensions(sourceKey): 516 for ext in self.__sourceExtensions(sourceKey):
518 self.pdata["FILETYPES"]["*{0}".format(ext)] = "SOURCES" 517 self.pdata["FILETYPES"]["*{0}".format(ext)] = "SOURCES"
519 self.pdata["FILETYPES"]["*.idl"] = "INTERFACES" 518 self.pdata["FILETYPES"]["*.idl"] = "INTERFACES"
520 if self.pdata["PROJECTTYPE"][0] in ["Qt4", "PyQt5", 519 if self.pdata["PROJECTTYPE"] in ["Qt4", "PyQt5",
521 "E6Plugin", "PySide"]: 520 "E6Plugin", "PySide"]:
522 self.pdata["FILETYPES"]["*.ui"] = "FORMS" 521 self.pdata["FILETYPES"]["*.ui"] = "FORMS"
523 if self.pdata["PROJECTTYPE"][0] in ["Qt4", "Qt4C", 522 if self.pdata["PROJECTTYPE"] in ["Qt4", "Qt4C",
524 "E6Plugin", 523 "E6Plugin",
525 "PyQt5", "PyQt5C", 524 "PyQt5", "PyQt5C",
526 "PySide", "PySideC"]: 525 "PySide", "PySideC"]:
527 self.pdata["FILETYPES"]["*.qrc"] = "RESOURCES" 526 self.pdata["FILETYPES"]["*.qrc"] = "RESOURCES"
528 if self.pdata["PROJECTTYPE"][0] in ["Qt4", "Qt4C", 527 if self.pdata["PROJECTTYPE"] in ["Qt4", "Qt4C",
529 "E6Plugin", 528 "E6Plugin",
530 "PyQt5", "PyQt5C", 529 "PyQt5", "PyQt5C",
531 "PySide", "PySideC"]: 530 "PySide", "PySideC"]:
532 self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS" 531 self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS"
533 self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS" 532 self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS"
534 try: 533 try:
535 if self.__fileTypeCallbacks[ 534 if self.__fileTypeCallbacks[
536 self.pdata["PROJECTTYPE"][0]] is not None: 535 self.pdata["PROJECTTYPE"]] is not None:
537 ftypes = \ 536 ftypes = \
538 self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"][0]]() 537 self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"]]()
539 self.pdata["FILETYPES"].update(ftypes) 538 self.pdata["FILETYPES"].update(ftypes)
540 except KeyError: 539 except KeyError:
541 pass 540 pass
542 self.setDirty(True) 541 self.setDirty(True)
543 542
544 def updateFileTypes(self): 543 def updateFileTypes(self):
545 """ 544 """
546 Public method to update the filetype associations with new default 545 Public method to update the filetype associations with new default
547 values. 546 values.
548 """ 547 """
549 if self.pdata["PROJECTTYPE"][0] in ["Qt4", "Qt4C", 548 if self.pdata["PROJECTTYPE"] in ["Qt4", "Qt4C",
550 "E6Plugin", 549 "E6Plugin",
551 "PyQt5", "PyQt5C", 550 "PyQt5", "PyQt5C",
552 "PySide", "PySideC"]: 551 "PySide", "PySideC"]:
553 if "*.ts" not in self.pdata["FILETYPES"]: 552 if "*.ts" not in self.pdata["FILETYPES"]:
554 self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS" 553 self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS"
555 if "*.qm" not in self.pdata["FILETYPES"]: 554 if "*.qm" not in self.pdata["FILETYPES"]:
556 self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS" 555 self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS"
557 try: 556 try:
558 if self.__fileTypeCallbacks[ 557 if self.__fileTypeCallbacks[
559 self.pdata["PROJECTTYPE"][0]] is not None: 558 self.pdata["PROJECTTYPE"]] is not None:
560 ftypes = \ 559 ftypes = \
561 self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"][0]]() 560 self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"]]()
562 for pattern, ftype in list(ftypes.items()): 561 for pattern, ftype in list(ftypes.items()):
563 if pattern not in self.pdata["FILETYPES"]: 562 if pattern not in self.pdata["FILETYPES"]:
564 self.pdata["FILETYPES"][pattern] = ftype 563 self.pdata["FILETYPES"][pattern] = ftype
565 self.setDirty(True) 564 self.setDirty(True)
566 except KeyError: 565 except KeyError:
747 dn = os.path.dirname(fn) 746 dn = os.path.dirname(fn)
748 if dn not in self.otherssubdirs: 747 if dn not in self.otherssubdirs:
749 self.otherssubdirs.append(dn) 748 self.otherssubdirs.append(dn)
750 749
751 # create hash value, if it doesn't have one 750 # create hash value, if it doesn't have one
752 if reader.version.startswith("5.") and not self.pdata["HASH"][0]: 751 if reader.version.startswith("5.") and not self.pdata["HASH"]:
753 hash = str(QCryptographicHash.hash( 752 hash = str(QCryptographicHash.hash(
754 QByteArray(self.ppath.encode("utf-8")), 753 QByteArray(self.ppath.encode("utf-8")),
755 QCryptographicHash.Sha1).toHex(), 754 QCryptographicHash.Sha1).toHex(),
756 encoding="utf-8") 755 encoding="utf-8")
757 self.pdata["HASH"] = [hash] 756 self.pdata["HASH"] = hash
758 self.setDirty(True) 757 self.setDirty(True)
759 758
760 return res 759 return res
761 760
762 def __writeProject(self, fn=None): 761 def __writeProject(self, fn=None):
774 self.pdata["VCSOPTIONS"] = \ 773 self.pdata["VCSOPTIONS"] = \
775 copy.deepcopy(self.vcs.vcsGetOptions()) 774 copy.deepcopy(self.vcs.vcsGetOptions())
776 self.pdata["VCSOTHERDATA"] = \ 775 self.pdata["VCSOTHERDATA"] = \
777 copy.deepcopy(self.vcs.vcsGetOtherData()) 776 copy.deepcopy(self.vcs.vcsGetOtherData())
778 777
779 if not self.pdata["HASH"][0]: 778 if not self.pdata["HASH"]:
780 hash = str(QCryptographicHash.hash( 779 hash = str(QCryptographicHash.hash(
781 QByteArray(self.ppath.encode("utf-8")), 780 QByteArray(self.ppath.encode("utf-8")),
782 QCryptographicHash.Sha1).toHex(), 781 QCryptographicHash.Sha1).toHex(),
783 encoding="utf-8") 782 encoding="utf-8")
784 self.pdata["HASH"] = [hash] 783 self.pdata["HASH"] = hash
785 784
786 if fn is None: 785 if fn is None:
787 fn = self.pfile 786 fn = self.pfile
788 787
789 f = QFile(fn) 788 f = QFile(fn)
1264 1263
1265 from .AddLanguageDialog import AddLanguageDialog 1264 from .AddLanguageDialog import AddLanguageDialog
1266 dlg = AddLanguageDialog(self.parent()) 1265 dlg = AddLanguageDialog(self.parent())
1267 if dlg.exec_() == QDialog.Accepted: 1266 if dlg.exec_() == QDialog.Accepted:
1268 lang = dlg.getSelectedLanguage() 1267 lang = dlg.getSelectedLanguage()
1269 if self.pdata["PROJECTTYPE"][0] in \ 1268 if self.pdata["PROJECTTYPE"] in \
1270 ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E6Plugin", 1269 ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E6Plugin",
1271 "PySide", "PySideC"]: 1270 "PySide", "PySideC"]:
1272 langFile = self.pdata["TRANSLATIONPATTERN"]\ 1271 langFile = self.pdata["TRANSLATIONPATTERN"]\
1273 .replace("%language%", lang) 1272 .replace("%language%", lang)
1274 self.appendFile(langFile) 1273 self.appendFile(langFile)
1283 @return name of the binary translations file (string) 1282 @return name of the binary translations file (string)
1284 """ 1283 """
1285 qmFile = "" 1284 qmFile = ""
1286 try: 1285 try:
1287 if self.__binaryTranslationsCallbacks[ 1286 if self.__binaryTranslationsCallbacks[
1288 self.pdata["PROJECTTYPE"][0]] is not None: 1287 self.pdata["PROJECTTYPE"]] is not None:
1289 qmFile = self.__binaryTranslationsCallbacks[ 1288 qmFile = self.__binaryTranslationsCallbacks[
1290 self.pdata["PROJECTTYPE"][0]](langFile) 1289 self.pdata["PROJECTTYPE"]](langFile)
1291 except KeyError: 1290 except KeyError:
1292 qmFile = langFile.replace('.ts', '.qm') 1291 qmFile = langFile.replace('.ts', '.qm')
1293 if qmFile == langFile: 1292 if qmFile == langFile:
1294 qmFile = "" 1293 qmFile = ""
1295 return qmFile 1294 return qmFile
2130 self.menuShowAct.setEnabled(True) 2129 self.menuShowAct.setEnabled(True)
2131 self.menuDiagramAct.setEnabled(True) 2130 self.menuDiagramAct.setEnabled(True)
2132 self.menuApidocAct.setEnabled(True) 2131 self.menuApidocAct.setEnabled(True)
2133 self.menuPackagersAct.setEnabled(True) 2132 self.menuPackagersAct.setEnabled(True)
2134 self.pluginGrp.setEnabled( 2133 self.pluginGrp.setEnabled(
2135 self.pdata["PROJECTTYPE"][0] in ["E6Plugin"]) 2134 self.pdata["PROJECTTYPE"] in ["E6Plugin"])
2136 self.addLanguageAct.setEnabled( 2135 self.addLanguageAct.setEnabled(
2137 bool(self.pdata["TRANSLATIONPATTERN"])) 2136 bool(self.pdata["TRANSLATIONPATTERN"]))
2138 2137
2139 self.projectAboutToBeCreated.emit() 2138 self.projectAboutToBeCreated.emit()
2140 2139
2141 hash = str(QCryptographicHash.hash( 2140 hash = str(QCryptographicHash.hash(
2142 QByteArray(self.ppath.encode("utf-8")), 2141 QByteArray(self.ppath.encode("utf-8")),
2143 QCryptographicHash.Sha1).toHex(), 2142 QCryptographicHash.Sha1).toHex(),
2144 encoding="utf-8") 2143 encoding="utf-8")
2145 self.pdata["HASH"] = [hash] 2144 self.pdata["HASH"] = hash
2146 2145
2147 # create the project directory if it doesn't exist already 2146 # create the project directory if it doesn't exist already
2148 if not os.path.isdir(self.ppath): 2147 if not os.path.isdir(self.ppath):
2149 try: 2148 try:
2150 os.makedirs(self.ppath) 2149 os.makedirs(self.ppath)
2158 .format(self.ppath)) 2157 .format(self.ppath))
2159 self.vcs = self.initVCS() 2158 self.vcs = self.initVCS()
2160 return 2159 return
2161 # create an empty __init__.py file to make it a Python package 2160 # create an empty __init__.py file to make it a Python package
2162 # (only for Python and Python3) 2161 # (only for Python and Python3)
2163 if self.pdata["PROGLANGUAGE"][0] in \ 2162 if self.pdata["PROGLANGUAGE"] in \
2164 ["Python", "Python2", "Python3"]: 2163 ["Python", "Python2", "Python3"]:
2165 fn = os.path.join(self.ppath, "__init__.py") 2164 fn = os.path.join(self.ppath, "__init__.py")
2166 f = open(fn, "w", encoding="utf-8") 2165 f = open(fn, "w", encoding="utf-8")
2167 f.close() 2166 f.close()
2168 self.appendFile(fn, True) 2167 self.appendFile(fn, True)
2231 yesDefault=True) 2230 yesDefault=True)
2232 if res: 2231 if res:
2233 self.newProjectAddFiles(ms) 2232 self.newProjectAddFiles(ms)
2234 # create an empty __init__.py file to make it a Python package 2233 # create an empty __init__.py file to make it a Python package
2235 # if none exists (only for Python and Python3) 2234 # if none exists (only for Python and Python3)
2236 if self.pdata["PROGLANGUAGE"][0] in \ 2235 if self.pdata["PROGLANGUAGE"] in \
2237 ["Python", "Python2", "Python3"]: 2236 ["Python", "Python2", "Python3"]:
2238 fn = os.path.join(self.ppath, "__init__.py") 2237 fn = os.path.join(self.ppath, "__init__.py")
2239 if not os.path.exists(fn): 2238 if not os.path.exists(fn):
2240 f = open(fn, "w", encoding="utf-8") 2239 f = open(fn, "w", encoding="utf-8")
2241 f.close() 2240 f.close()
2450 qmlist = Utilities.direntries(tpd, True, pattern) 2449 qmlist = Utilities.direntries(tpd, True, pattern)
2451 for qm in qmlist: 2450 for qm in qmlist:
2452 self.pdata["TRANSLATIONS"].append(qm) 2451 self.pdata["TRANSLATIONS"].append(qm)
2453 self.projectLanguageAdded.emit(qm) 2452 self.projectLanguageAdded.emit(qm)
2454 if not self.pdata["MAINSCRIPT"]: 2453 if not self.pdata["MAINSCRIPT"]:
2455 if self.pdata["PROGLANGUAGE"][0] in \ 2454 if self.pdata["PROGLANGUAGE"] in \
2456 ["Python", "Python2", "Python3"]: 2455 ["Python", "Python2", "Python3"]:
2457 self.pdata["MAINSCRIPT"] = '{0}.py'.format(mainscriptname) 2456 self.pdata["MAINSCRIPT"] = '{0}.py'.format(mainscriptname)
2458 elif self.pdata["PROGLANGUAGE"][0] == "Ruby": 2457 elif self.pdata["PROGLANGUAGE"] == "Ruby":
2459 self.pdata["MAINSCRIPT"] = '{0}.rb'.format(mainscriptname) 2458 self.pdata["MAINSCRIPT"] = '{0}.rb'.format(mainscriptname)
2460 self.setDirty(True) 2459 self.setDirty(True)
2461 QApplication.restoreOverrideCursor() 2460 QApplication.restoreOverrideCursor()
2462 2461
2463 def __showProperties(self): 2462 def __showProperties(self):
2465 Private slot to display the properties dialog. 2464 Private slot to display the properties dialog.
2466 """ 2465 """
2467 from .PropertiesDialog import PropertiesDialog 2466 from .PropertiesDialog import PropertiesDialog
2468 dlg = PropertiesDialog(self, False) 2467 dlg = PropertiesDialog(self, False)
2469 if dlg.exec_() == QDialog.Accepted: 2468 if dlg.exec_() == QDialog.Accepted:
2470 projectType = self.pdata["PROJECTTYPE"][0] 2469 projectType = self.pdata["PROJECTTYPE"]
2471 dlg.storeData() 2470 dlg.storeData()
2472 self.setDirty(True) 2471 self.setDirty(True)
2473 try: 2472 try:
2474 ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"]) 2473 ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"])
2475 if os.path.exists(ms): 2474 if os.path.exists(ms):
2476 self.appendFile(ms) 2475 self.appendFile(ms)
2477 except IndexError: 2476 except IndexError:
2478 pass 2477 pass
2479 2478
2480 if self.pdata["PROJECTTYPE"][0] != projectType: 2479 if self.pdata["PROJECTTYPE"] != projectType:
2481 # reinitialize filetype associations 2480 # reinitialize filetype associations
2482 self.initFileTypes() 2481 self.initFileTypes()
2483 2482
2484 if self.translationsRoot: 2483 if self.translationsRoot:
2485 tp = os.path.join(self.ppath, self.translationsRoot) 2484 tp = os.path.join(self.ppath, self.translationsRoot)
2499 os.makedirs(tp) 2498 os.makedirs(tp)
2500 if tp != self.ppath and tp not in self.subdirs: 2499 if tp != self.ppath and tp not in self.subdirs:
2501 self.subdirs.append(tp) 2500 self.subdirs.append(tp)
2502 2501
2503 self.pluginGrp.setEnabled( 2502 self.pluginGrp.setEnabled(
2504 self.pdata["PROJECTTYPE"][0] in ["E6Plugin"]) 2503 self.pdata["PROJECTTYPE"] in ["E6Plugin"])
2505 2504
2506 self.__model.projectPropertiesChanged() 2505 self.__model.projectPropertiesChanged()
2507 self.projectPropertiesChanged.emit() 2506 self.projectPropertiesChanged.emit()
2508 2507
2509 if self.pdata["PROJECTTYPE"][0] != projectType: 2508 if self.pdata["PROJECTTYPE"] != projectType:
2510 self.__reorganizeFiles() 2509 self.__reorganizeFiles()
2511 2510
2512 def __showUserProperties(self): 2511 def __showUserProperties(self):
2513 """ 2512 """
2514 Private slot to display the user specific properties dialog. 2513 Private slot to display the user specific properties dialog.
2587 for pattern, language in list(self.pdata["LEXERASSOCS"].items()): 2586 for pattern, language in list(self.pdata["LEXERASSOCS"].items()):
2588 if fnmatch.fnmatch(filename, pattern): 2587 if fnmatch.fnmatch(filename, pattern):
2589 return language 2588 return language
2590 2589
2591 # try project type specific defaults next 2590 # try project type specific defaults next
2592 projectType = self.pdata["PROJECTTYPE"][0] 2591 projectType = self.pdata["PROJECTTYPE"]
2593 try: 2592 try:
2594 if self.__lexerAssociationCallbacks[projectType] is not None: 2593 if self.__lexerAssociationCallbacks[projectType] is not None:
2595 return self.__lexerAssociationCallbacks[projectType](filename) 2594 return self.__lexerAssociationCallbacks[projectType](filename)
2596 except KeyError: 2595 except KeyError:
2597 pass 2596 pass
2716 self.menuShowAct.setEnabled(True) 2715 self.menuShowAct.setEnabled(True)
2717 self.menuDiagramAct.setEnabled(True) 2716 self.menuDiagramAct.setEnabled(True)
2718 self.menuApidocAct.setEnabled(True) 2717 self.menuApidocAct.setEnabled(True)
2719 self.menuPackagersAct.setEnabled(True) 2718 self.menuPackagersAct.setEnabled(True)
2720 self.pluginGrp.setEnabled( 2719 self.pluginGrp.setEnabled(
2721 self.pdata["PROJECTTYPE"][0] in [ 2720 self.pdata["PROJECTTYPE"] in ["E6Plugin"])
2722 "E6Plugin"])
2723 self.addLanguageAct.setEnabled( 2721 self.addLanguageAct.setEnabled(
2724 bool(self.pdata["TRANSLATIONPATTERN"])) 2722 bool(self.pdata["TRANSLATIONPATTERN"]))
2725 2723
2726 self.__model.projectOpened() 2724 self.__model.projectOpened()
2727 self.projectOpenedHooks.emit() 2725 self.projectOpenedHooks.emit()
3063 """ 3061 """
3064 Public method to get the type of the project. 3062 Public method to get the type of the project.
3065 3063
3066 @return UI type of the project (string) 3064 @return UI type of the project (string)
3067 """ 3065 """
3068 return self.pdata["PROJECTTYPE"][0] 3066 return self.pdata["PROJECTTYPE"]
3069 3067
3070 def getProjectLanguage(self): 3068 def getProjectLanguage(self):
3071 """ 3069 """
3072 Public method to get the project's programming language. 3070 Public method to get the project's programming language.
3073 3071
3074 @return programming language (string) 3072 @return programming language (string)
3075 """ 3073 """
3076 return self.pdata["PROGLANGUAGE"][0] 3074 return self.pdata["PROGLANGUAGE"]
3075
3076 def isMixedLanguageProject(self):
3077 """
3078 Public method to check, if this is a mixed language project.
3079
3080 @return flag indicating a mixed language project
3081 @rtype bool
3082 """
3083 return self.pdata("MIXEDLANGUAGE")
3077 3084
3078 def isPythonProject(self): 3085 def isPythonProject(self):
3079 """ 3086 """
3080 Public method to check, if this project is a Python2 or Python3 3087 Public method to check, if this project is a Python2 or Python3
3081 project. 3088 project.
3082 3089
3083 @return flag indicating a Python project (boolean) 3090 @return flag indicating a Python project (boolean)
3084 """ 3091 """
3085 return self.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", 3092 return self.pdata["PROGLANGUAGE"] in ["Python", "Python2",
3086 "Python3"] 3093 "Python3"]
3087 3094
3088 def isPy3Project(self): 3095 def isPy3Project(self):
3089 """ 3096 """
3090 Public method to check, if this project is a Python3 project. 3097 Public method to check, if this project is a Python3 project.
3091 3098
3092 @return flag indicating a Python3 project (boolean) 3099 @return flag indicating a Python3 project (boolean)
3093 """ 3100 """
3094 return self.pdata["PROGLANGUAGE"][0] == "Python3" 3101 return self.pdata["PROGLANGUAGE"] == "Python3"
3095 3102
3096 def isPy2Project(self): 3103 def isPy2Project(self):
3097 """ 3104 """
3098 Public method to check, if this project is a Python2 project. 3105 Public method to check, if this project is a Python2 project.
3099 3106
3100 @return flag indicating a Python2 project (boolean) 3107 @return flag indicating a Python2 project (boolean)
3101 """ 3108 """
3102 return self.pdata["PROGLANGUAGE"][0] in ["Python", "Python2"] 3109 return self.pdata["PROGLANGUAGE"] in ["Python", "Python2"]
3103 3110
3104 def isRubyProject(self): 3111 def isRubyProject(self):
3105 """ 3112 """
3106 Public method to check, if this project is a Ruby project. 3113 Public method to check, if this project is a Ruby project.
3107 3114
3108 @return flag indicating a Ruby project (boolean) 3115 @return flag indicating a Ruby project (boolean)
3109 """ 3116 """
3110 return self.pdata["PROGLANGUAGE"][0] == "Ruby" 3117 return self.pdata["PROGLANGUAGE"] == "Ruby"
3111 3118
3112 def isJavaScriptProject(self): 3119 def isJavaScriptProject(self):
3113 """ 3120 """
3114 Public method to check, if this project is a JavaScript project. 3121 Public method to check, if this project is a JavaScript project.
3115 3122
3116 @return flag indicating a JavaScript project (boolean) 3123 @return flag indicating a JavaScript project (boolean)
3117 """ 3124 """
3118 return self.pdata["PROGLANGUAGE"][0] == "JavaScript" 3125 return self.pdata["PROGLANGUAGE"] == "JavaScript"
3119 3126
3120 def getProjectSpellLanguage(self): 3127 def getProjectSpellLanguage(self):
3121 """ 3128 """
3122 Public method to get the project's programming language. 3129 Public method to get the project's programming language.
3123 3130
3124 @return programming language (string) 3131 @return programming language (string)
3125 """ 3132 """
3126 return self.pdata["SPELLLANGUAGE"][0] 3133 return self.pdata["SPELLLANGUAGE"]
3127 3134
3128 def getProjectDictionaries(self): 3135 def getProjectDictionaries(self):
3129 """ 3136 """
3130 Public method to get the names of the project specific dictionaries. 3137 Public method to get the names of the project specific dictionaries.
3131 3138
3147 Public method to get the default extension for the project's 3154 Public method to get the default extension for the project's
3148 programming language. 3155 programming language.
3149 3156
3150 @return default extension (including the dot) (string) 3157 @return default extension (including the dot) (string)
3151 """ 3158 """
3152 if self.pdata["PROGLANGUAGE"]: 3159 lang = self.pdata["PROGLANGUAGE"]
3153 lang = self.pdata["PROGLANGUAGE"][0] 3160 if lang == "":
3154 if lang == "": 3161 lang = "Python3"
3155 lang = "Python3" 3162 elif lang == "Python":
3156 elif lang == "Python": 3163 lang = "Python2"
3157 lang = "Python2" 3164 return self.__sourceExtensions(lang)[0]
3158 return self.__sourceExtensions(lang)[0]
3159 else:
3160 return ""
3161 3165
3162 def getProjectPath(self): 3166 def getProjectPath(self):
3163 """ 3167 """
3164 Public method to get the project path. 3168 Public method to get the project path.
3165 3169
3235 """ 3239 """
3236 Public method to get the project hash. 3240 Public method to get the project hash.
3237 3241
3238 @return project hash as a hex string (string) 3242 @return project hash as a hex string (string)
3239 """ 3243 """
3240 return self.pdata["HASH"][0] 3244 return self.pdata["HASH"]
3241 3245
3242 def getRelativePath(self, path): 3246 def getRelativePath(self, path):
3243 """ 3247 """
3244 Public method to convert a file path to a project relative 3248 Public method to convert a file path to a project relative
3245 file path. 3249 file path.

eric ide

mercurial