Project/Project.py

changeset 500
c3abc7895a01
parent 486
e4711a55e482
child 501
5c615a85241a
equal deleted inserted replaced
499:622ab17a68d5 500:c3abc7895a01
101 the project 101 the project
102 @signal prepareRepopulateItem(string) emitted before an item of the model is 102 @signal prepareRepopulateItem(string) emitted before an item of the model is
103 repopulated 103 repopulated
104 @signal completeRepopulateItem(string) emitted after an item of the model was 104 @signal completeRepopulateItem(string) emitted after an item of the model was
105 repopulated 105 repopulated
106 @signal vcsStatusMonitorStatus(QString, QString) emitted to signal the status of the 106 @signal vcsStatusMonitorStatus(string, string) emitted to signal the status of the
107 monitoring thread (ok, nok, op, off) and a status message 107 monitoring thread (ok, nok, op, off) and a status message
108 @signal reinitVCS() emitted after the VCS has been reinitialized 108 @signal reinitVCS() emitted after the VCS has been reinitialized
109 @signal showMenu(string, QMenu) emitted when a menu is about to be shown. The name 109 @signal showMenu(string, QMenu) emitted when a menu is about to be shown. The name
110 of the menu and a reference to the menu are given. 110 of the menu and a reference to the menu are given.
111 @signal lexerAssociationsChanged() emitted after the lexer associations have been 111 @signal lexerAssociationsChanged() emitted after the lexer associations have been
112 changed 112 changed
113 """ 113 """
114 dirty = pyqtSignal(int)
115 projectLanguageAdded = pyqtSignal(str)
116 projectLanguageAddedByCode = pyqtSignal(str)
117 projectFormAdded = pyqtSignal(str)
118 projectSourceAdded = pyqtSignal(str)
119 projectInterfaceAdded = pyqtSignal(str)
120 projectResourceAdded = pyqtSignal(str)
121 projectOthersAdded = pyqtSignal(str)
122 projectAboutToBeCreated = pyqtSignal()
123 newProjectHooks = pyqtSignal()
124 newProject = pyqtSignal()
114 sourceFile = pyqtSignal(str) 125 sourceFile = pyqtSignal(str)
126 projectOpenedHooks = pyqtSignal()
115 projectOpened = pyqtSignal() 127 projectOpened = pyqtSignal()
116 newProject = pyqtSignal() 128 projectClosedHooks = pyqtSignal()
117 projectClosed = pyqtSignal() 129 projectClosed = pyqtSignal()
130 projectFileRenamed = pyqtSignal(str, str)
131 projectPropertiesChanged = pyqtSignal()
132 directoryRemoved = pyqtSignal(str)
133 prepareRepopulateItem = pyqtSignal(str)
134 completeRepopulateItem = pyqtSignal(str)
135 vcsStatusMonitorStatus = pyqtSignal(str, str)
136 reinitVCS = pyqtSignal()
137 showMenu = pyqtSignal(str, QMenu)
138 lexerAssociationsChanged = pyqtSignal()
118 139
119 keynames = [ 140 keynames = [
120 "PROGLANGUAGE", "MIXEDLANGUAGE", "PROJECTTYPE", 141 "PROGLANGUAGE", "MIXEDLANGUAGE", "PROJECTTYPE",
121 "SPELLLANGUAGE", "SPELLWORDS", "SPELLEXCLUDES", 142 "SPELLLANGUAGE", "SPELLWORDS", "SPELLEXCLUDES",
122 "DESCRIPTION", "VERSION", "HASH", 143 "DESCRIPTION", "VERSION", "HASH",
502 523
503 @param b dirty state (boolean) 524 @param b dirty state (boolean)
504 """ 525 """
505 self.dirty = b 526 self.dirty = b
506 self.saveAct.setEnabled(b) 527 self.saveAct.setEnabled(b)
507 self.emit(SIGNAL("dirty"), bool(b)) 528 self.dirty.emit(bool(b))
508 529
509 def isDirty(self): 530 def isDirty(self):
510 """ 531 """
511 Public method to return the dirty state. 532 Public method to return the dirty state.
512 533
1513 lang = dlg.getSelectedLanguage() 1534 lang = dlg.getSelectedLanguage()
1514 if self.pdata["PROJECTTYPE"][0] in \ 1535 if self.pdata["PROJECTTYPE"][0] in \
1515 ["Qt4", "Qt4C", "E4Plugin", "PySide", "PySideC"]: 1536 ["Qt4", "Qt4C", "E4Plugin", "PySide", "PySideC"]:
1516 langFile = self.pdata["TRANSLATIONPATTERN"][0].replace("%language%", lang) 1537 langFile = self.pdata["TRANSLATIONPATTERN"][0].replace("%language%", lang)
1517 self.appendFile(langFile) 1538 self.appendFile(langFile)
1518 self.emit(SIGNAL("projectLanguageAddedByCode"), lang) 1539 self.projectLanguageAddedByCode.emit(lang)
1519 1540
1520 def __binaryTranslationFile(self, langFile): 1541 def __binaryTranslationFile(self, langFile):
1521 """ 1542 """
1522 Private method to calculate the filename of the binary translations file 1543 Private method to calculate the filename of the binary translations file
1523 given the name of the raw translations file. 1544 given the name of the raw translations file.
1655 1676
1656 if filetype in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES"]: 1677 if filetype in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES"]:
1657 if filetype == "SOURCES": 1678 if filetype == "SOURCES":
1658 if newfn not in self.pdata["SOURCES"]: 1679 if newfn not in self.pdata["SOURCES"]:
1659 self.pdata["SOURCES"].append(newfn) 1680 self.pdata["SOURCES"].append(newfn)
1660 self.emit(SIGNAL('projectSourceAdded'), newfn) 1681 self.projectSourceAdded.emit(newfn)
1661 updateModel and self.__model.addNewItem("SOURCES", newfn) 1682 updateModel and self.__model.addNewItem("SOURCES", newfn)
1662 dirty = True 1683 dirty = True
1663 else: 1684 else:
1664 updateModel and self.repopulateItem(newfn) 1685 updateModel and self.repopulateItem(newfn)
1665 elif filetype == "FORMS": 1686 elif filetype == "FORMS":
1666 if newfn not in self.pdata["FORMS"]: 1687 if newfn not in self.pdata["FORMS"]:
1667 self.pdata["FORMS"].append(newfn) 1688 self.pdata["FORMS"].append(newfn)
1668 self.emit(SIGNAL('projectFormAdded'), newfn) 1689 self.projectFormAdded.emit(newfn)
1669 updateModel and self.__model.addNewItem("FORMS", newfn) 1690 updateModel and self.__model.addNewItem("FORMS", newfn)
1670 dirty = True 1691 dirty = True
1671 else: 1692 else:
1672 updateModel and self.repopulateItem(newfn) 1693 updateModel and self.repopulateItem(newfn)
1673 elif filetype == "INTERFACES": 1694 elif filetype == "INTERFACES":
1674 if newfn not in self.pdata["INTERFACES"]: 1695 if newfn not in self.pdata["INTERFACES"]:
1675 self.pdata["INTERFACES"].append(newfn) 1696 self.pdata["INTERFACES"].append(newfn)
1676 self.emit(SIGNAL('projectInterfaceAdded'), newfn) 1697 self.projectInterfaceAdded.emit(newfn)
1677 updateModel and self.__model.addNewItem("INTERFACES", newfn) 1698 updateModel and self.__model.addNewItem("INTERFACES", newfn)
1678 dirty = True 1699 dirty = True
1679 else: 1700 else:
1680 updateModel and self.repopulateItem(newfn) 1701 updateModel and self.repopulateItem(newfn)
1681 elif filetype == "RESOURCES": 1702 elif filetype == "RESOURCES":
1682 if newfn not in self.pdata["RESOURCES"]: 1703 if newfn not in self.pdata["RESOURCES"]:
1683 self.pdata["RESOURCES"].append(newfn) 1704 self.pdata["RESOURCES"].append(newfn)
1684 self.emit(SIGNAL('projectResourceAdded'), newfn) 1705 self.projectResourceAdded.emit(newfn)
1685 updateModel and self.__model.addNewItem("RESOURCES", newfn) 1706 updateModel and self.__model.addNewItem("RESOURCES", newfn)
1686 dirty = True 1707 dirty = True
1687 else: 1708 else:
1688 updateModel and self.repopulateItem(newfn) 1709 updateModel and self.repopulateItem(newfn)
1689 if newdir not in self.subdirs: 1710 if newdir not in self.subdirs:
1690 self.subdirs.append(newdir) 1711 self.subdirs.append(newdir)
1691 elif filetype == "TRANSLATIONS": 1712 elif filetype == "TRANSLATIONS":
1692 if newfn not in self.pdata["TRANSLATIONS"]: 1713 if newfn not in self.pdata["TRANSLATIONS"]:
1693 self.pdata["TRANSLATIONS"].append(newfn) 1714 self.pdata["TRANSLATIONS"].append(newfn)
1694 updateModel and self.__model.addNewItem("TRANSLATIONS", newfn) 1715 updateModel and self.__model.addNewItem("TRANSLATIONS", newfn)
1695 self.emit(SIGNAL('projectLanguageAdded'), newfn) 1716 self.projectLanguageAdded.emit(newfn)
1696 dirty = True 1717 dirty = True
1697 else: 1718 else:
1698 updateModel and self.repopulateItem(newfn) 1719 updateModel and self.repopulateItem(newfn)
1699 else: # filetype == "OTHERS" 1720 else: # filetype == "OTHERS"
1700 if newfn not in self.pdata["OTHERS"]: 1721 if newfn not in self.pdata["OTHERS"]:
2058 self.appendFile(newname, isSourceFile, False) 2079 self.appendFile(newname, isSourceFile, False)
2059 self.__model.renameItem(fn, newname) 2080 self.__model.renameItem(fn, newname)
2060 else: 2081 else:
2061 self.removeFile(oldname) 2082 self.removeFile(oldname)
2062 self.appendFile(newname, isSourceFile) 2083 self.appendFile(newname, isSourceFile)
2063 self.emit(SIGNAL('projectFileRenamed'), oldname, newname) 2084 self.projectFileRenamed.emit(oldname, newname)
2064 2085
2065 self.renameMainScript(fn, newname) 2086 self.renameMainScript(fn, newname)
2066 2087
2067 def getFiles(self, start): 2088 def getFiles(self, start):
2068 """ 2089 """
2121 self.setDirty(True) 2142 self.setDirty(True)
2122 typeString = typeStrings[0] 2143 typeString = typeStrings[0]
2123 del typeStrings[0] 2144 del typeStrings[0]
2124 self.__model.removeItem(olddn) 2145 self.__model.removeItem(olddn)
2125 self.__model.addNewItem(typeString, newdn, typeStrings) 2146 self.__model.addNewItem(typeString, newdn, typeStrings)
2126 self.emit(SIGNAL('directoryRemoved'), olddn) 2147 self.directoryRemoved.emit(olddn)
2127 2148
2128 def removeFile(self, fn, updateModel = True): 2149 def removeFile(self, fn, updateModel = True):
2129 """ 2150 """
2130 Public slot to remove a file from the project. 2151 Public slot to remove a file from the project.
2131 2152
2178 self.pdata[key].remove(entry) 2199 self.pdata[key].remove(entry)
2179 dirty = True 2200 dirty = True
2180 self.__model.removeItem(dn) 2201 self.__model.removeItem(dn)
2181 if dirty: 2202 if dirty:
2182 self.setDirty(True) 2203 self.setDirty(True)
2183 self.emit(SIGNAL('directoryRemoved'), dn) 2204 self.directoryRemoved.emit(dn)
2184 2205
2185 def deleteFile(self, fn): 2206 def deleteFile(self, fn):
2186 """ 2207 """
2187 Public slot to delete a file from the project directory. 2208 Public slot to delete a file from the project directory.
2188 2209
2285 self.menuDiagramAct.setEnabled(True) 2306 self.menuDiagramAct.setEnabled(True)
2286 self.menuApidocAct.setEnabled(True) 2307 self.menuApidocAct.setEnabled(True)
2287 self.menuPackagersAct.setEnabled(True) 2308 self.menuPackagersAct.setEnabled(True)
2288 self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin") 2309 self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin")
2289 2310
2290 self.emit(SIGNAL("projectAboutToBeCreated")) 2311 self.projectAboutToBeCreated.emit()
2291 2312
2292 hash = str(QCryptographicHash.hash( 2313 hash = str(QCryptographicHash.hash(
2293 QByteArray(self.ppath), QCryptographicHash.Sha1).toHex(), 2314 QByteArray(self.ppath), QCryptographicHash.Sha1).toHex(),
2294 encoding = "utf-8") 2315 encoding = "utf-8")
2295 self.pdata["HASH"] = [hash] 2316 self.pdata["HASH"] = [hash]
2474 # create the project in the VCS 2495 # create the project in the VCS
2475 self.vcs.vcsSetDataFromDict(vcsDataDict) 2496 self.vcs.vcsSetDataFromDict(vcsDataDict)
2476 self.saveProject() 2497 self.saveProject()
2477 self.vcs.vcsConvertProject(vcsDataDict, self) 2498 self.vcs.vcsConvertProject(vcsDataDict, self)
2478 else: 2499 else:
2479 self.emit(SIGNAL('newProjectHooks')) 2500 self.newProjectHooks.emit()
2480 self.newProject.emit() 2501 self.newProject.emit()
2481 2502
2482 else: 2503 else:
2483 self.emit(SIGNAL('newProjectHooks')) 2504 self.newProjectHooks.emit()
2484 self.newProject.emit() 2505 self.newProject.emit()
2485 2506
2486 2507
2487 def newProjectAddFiles(self, mainscript): 2508 def newProjectAddFiles(self, mainscript):
2488 """ 2509 """
2543 self.getRelativePath(self.pdata["TRANSLATIONPATTERN"][0]) 2564 self.getRelativePath(self.pdata["TRANSLATIONPATTERN"][0])
2544 pattern = self.pdata["TRANSLATIONPATTERN"][0].replace("%language%", "*") 2565 pattern = self.pdata["TRANSLATIONPATTERN"][0].replace("%language%", "*")
2545 for ts in tslist: 2566 for ts in tslist:
2546 if fnmatch.fnmatch(ts, pattern): 2567 if fnmatch.fnmatch(ts, pattern):
2547 self.pdata["TRANSLATIONS"].append(ts) 2568 self.pdata["TRANSLATIONS"].append(ts)
2548 self.emit(SIGNAL('projectLanguageAdded'), ts) 2569 self.projectLanguageAdded.emit(ts)
2549 if len(self.pdata["MAINSCRIPT"]) == 0 or \ 2570 if len(self.pdata["MAINSCRIPT"]) == 0 or \
2550 len(self.pdata["MAINSCRIPT"][0]) == 0: 2571 len(self.pdata["MAINSCRIPT"][0]) == 0:
2551 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]: 2572 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]:
2552 self.pdata["MAINSCRIPT"] = ['{0}.py'.format(mainscriptname)] 2573 self.pdata["MAINSCRIPT"] = ['{0}.py'.format(mainscriptname)]
2553 elif self.pdata["PROGLANGUAGE"][0] == "Ruby": 2574 elif self.pdata["PROGLANGUAGE"][0] == "Ruby":
2559 os.path.basename(self.pdata["TRANSLATIONPATTERN"][0])) 2580 os.path.basename(self.pdata["TRANSLATIONPATTERN"][0]))
2560 pattern = self.__binaryTranslationFile(pattern) 2581 pattern = self.__binaryTranslationFile(pattern)
2561 qmlist = Utilities.direntries(tpd, True, pattern) 2582 qmlist = Utilities.direntries(tpd, True, pattern)
2562 for qm in qmlist: 2583 for qm in qmlist:
2563 self.pdata["TRANSLATIONS"].append(qm) 2584 self.pdata["TRANSLATIONS"].append(qm)
2564 self.emit(SIGNAL('projectLanguageAdded'), qm) 2585 self.projectLanguageAdded.emit(qm)
2565 self.setDirty(True) 2586 self.setDirty(True)
2566 QApplication.restoreOverrideCursor() 2587 QApplication.restoreOverrideCursor()
2567 2588
2568 def __showProperties(self): 2589 def __showProperties(self):
2569 """ 2590 """
2604 self.subdirs.append(tp) 2625 self.subdirs.append(tp)
2605 2626
2606 self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin") 2627 self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin")
2607 2628
2608 self.__model.projectPropertiesChanged() 2629 self.__model.projectPropertiesChanged()
2609 self.emit(SIGNAL('projectPropertiesChanged')) 2630 self.projectPropertiesChanged.emit()
2610 2631
2611 def __showUserProperties(self): 2632 def __showUserProperties(self):
2612 """ 2633 """
2613 Private slot to display the user specific properties dialog. 2634 Private slot to display the user specific properties dialog.
2614 """ 2635 """
2627 (vcsSystemOverride is not None and \ 2648 (vcsSystemOverride is not None and \
2628 len(self.pudata["VCSOVERRIDE"]) == 0): 2649 len(self.pudata["VCSOVERRIDE"]) == 0):
2629 # stop the VCS monitor thread and shutdown VCS 2650 # stop the VCS monitor thread and shutdown VCS
2630 if self.vcs is not None: 2651 if self.vcs is not None:
2631 self.vcs.stopStatusMonitor() 2652 self.vcs.stopStatusMonitor()
2632 self.disconnect(self.vcs, 2653 self.vcs.vcsStatusMonitorData.disconnect(self.__model.changeVCSStates)
2633 SIGNAL("vcsStatusMonitorData(QStringList)"), 2654 self.vcs.vcsStatusMonitorStatus.disconnect(self.__statusMonitorStatus)
2634 self.__model.changeVCSStates)
2635 self.disconnect(self.vcs,
2636 SIGNAL("vcsStatusMonitorStatus(QString, QString)"),
2637 self.__statusMonitorStatus)
2638 self.vcs.vcsShutdown() 2655 self.vcs.vcsShutdown()
2639 self.vcs = None 2656 self.vcs = None
2640 e5App().getObject("PluginManager").deactivateVcsPlugins() 2657 e5App().getObject("PluginManager").deactivateVcsPlugins()
2641 # reinit VCS 2658 # reinit VCS
2642 self.vcs = self.initVCS() 2659 self.vcs = self.initVCS()
2643 # start the VCS monitor thread 2660 # start the VCS monitor thread
2644 if self.vcs is not None: 2661 if self.vcs is not None:
2645 self.vcs.startStatusMonitor(self) 2662 self.vcs.startStatusMonitor(self)
2646 self.connect(self.vcs, 2663 self.vcs.vcsStatusMonitorData.connect(self.__model.changeVCSStates)
2647 SIGNAL("vcsStatusMonitorData(QStringList)"), 2664 self.vcs.vcsStatusMonitorStatus.connect(self.__statusMonitorStatus)
2648 self.__model.changeVCSStates) 2665 self.reinitVCS.emit()
2649 self.connect(self.vcs,
2650 SIGNAL("vcsStatusMonitorStatus(QString, QString)"),
2651 self.__statusMonitorStatus)
2652 self.emit(SIGNAL("reinitVCS"))
2653 2666
2654 if self.pudata["VCSSTATUSMONITORINTERVAL"]: 2667 if self.pudata["VCSSTATUSMONITORINTERVAL"]:
2655 self.setStatusMonitorInterval(\ 2668 self.setStatusMonitorInterval(\
2656 self.pudata["VCSSTATUSMONITORINTERVAL"][0]) 2669 self.pudata["VCSSTATUSMONITORINTERVAL"][0])
2657 else: 2670 else:
2673 """ 2686 """
2674 dlg = LexerAssociationDialog(self) 2687 dlg = LexerAssociationDialog(self)
2675 if dlg.exec_() == QDialog.Accepted: 2688 if dlg.exec_() == QDialog.Accepted:
2676 dlg.transferData() 2689 dlg.transferData()
2677 self.setDirty(True) 2690 self.setDirty(True)
2678 self.emit(SIGNAL("lexerAssociationsChanged")) 2691 self.lexerAssociationsChanged.emit()
2679 2692
2680 def getEditorLexerAssoc(self, filename): 2693 def getEditorLexerAssoc(self, filename):
2681 """ 2694 """
2682 Public method to retrieve a lexer association. 2695 Public method to retrieve a lexer association.
2683 2696
2801 self.menuApidocAct.setEnabled(True) 2814 self.menuApidocAct.setEnabled(True)
2802 self.menuPackagersAct.setEnabled(True) 2815 self.menuPackagersAct.setEnabled(True)
2803 self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin") 2816 self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin")
2804 2817
2805 self.__model.projectOpened() 2818 self.__model.projectOpened()
2806 self.emit(SIGNAL('projectOpenedHooks')) 2819 self.projectOpenedHooks.emit()
2807 self.projectOpened.emit() 2820 self.projectOpened.emit()
2808 2821
2809 QApplication.restoreOverrideCursor() 2822 QApplication.restoreOverrideCursor()
2810 2823
2811 if Preferences.getProject("SearchNewFiles"): 2824 if Preferences.getProject("SearchNewFiles"):
2832 self.__readDebugProperties(True) 2845 self.__readDebugProperties(True)
2833 2846
2834 # start the VCS monitor thread 2847 # start the VCS monitor thread
2835 if self.vcs is not None: 2848 if self.vcs is not None:
2836 self.vcs.startStatusMonitor(self) 2849 self.vcs.startStatusMonitor(self)
2837 self.connect(self.vcs, 2850 self.vcs.vcsStatusMonitorData.connect(
2838 SIGNAL("vcsStatusMonitorData(QStringList)"), 2851 self.__model.changeVCSStates)
2839 self.__model.changeVCSStates) 2852 self.vcs.vcsStatusMonitorStatus.connect(
2840 self.connect(self.vcs, 2853 self.__statusMonitorStatus)
2841 SIGNAL("vcsStatusMonitorStatus(QString, QString)"),
2842 self.__statusMonitorStatus)
2843 else: 2854 else:
2844 QApplication.restoreOverrideCursor() 2855 QApplication.restoreOverrideCursor()
2845 2856
2846 def reopenProject(self): 2857 def reopenProject(self):
2847 """ 2858 """
2913 # now save the tasks 2924 # now save the tasks
2914 self.__writeTasks() 2925 self.__writeTasks()
2915 2926
2916 self.sessActGrp.setEnabled(ok) 2927 self.sessActGrp.setEnabled(ok)
2917 self.menuSessionAct.setEnabled(ok) 2928 self.menuSessionAct.setEnabled(ok)
2918 self.emit(SIGNAL('projectClosedHooks')) 2929 self.projectClosedHooks.emit()
2919 self.projectClosed.emit() 2930 self.projectClosed.emit()
2920 self.emit(SIGNAL('projectOpenedHooks')) 2931 self.projectOpenedHooks.emit()
2921 self.projectOpened.emit() 2932 self.projectOpened.emit()
2922 return True 2933 return True
2923 else: 2934 else:
2924 return False 2935 return False
2925 2936
3001 return False 3012 return False
3002 3013
3003 # stop the VCS monitor thread 3014 # stop the VCS monitor thread
3004 if self.vcs is not None: 3015 if self.vcs is not None:
3005 self.vcs.stopStatusMonitor() 3016 self.vcs.stopStatusMonitor()
3006 self.disconnect(self.vcs, 3017 self.vcs.vcsStatusMonitorData.disconnect(self.__model.changeVCSStates)
3007 SIGNAL("vcsStatusMonitorData(QStringList)"), 3018 self.vcs.vcsStatusMonitorStatus.disconnect(self.__statusMonitorStatus)
3008 self.__model.changeVCSStates)
3009 self.disconnect(self.vcs,
3010 SIGNAL("vcsStatusMonitorStatus(QString, QString)"),
3011 self.__statusMonitorStatus)
3012 3019
3013 # now save the tasks 3020 # now save the tasks
3014 if not noSave: 3021 if not noSave:
3015 self.__writeTasks() 3022 self.__writeTasks()
3016 self.ui.taskViewer.clearProjectTasks() 3023 self.ui.taskViewer.clearProjectTasks()
3044 self.menuApidocAct.setEnabled(False) 3051 self.menuApidocAct.setEnabled(False)
3045 self.menuPackagersAct.setEnabled(False) 3052 self.menuPackagersAct.setEnabled(False)
3046 self.pluginGrp.setEnabled(False) 3053 self.pluginGrp.setEnabled(False)
3047 3054
3048 self.__model.projectClosed() 3055 self.__model.projectClosed()
3049 self.emit(SIGNAL('projectClosedHooks')) 3056 self.projectClosedHooks.emit()
3050 self.projectClosed.emit() 3057 self.projectClosed.emit()
3051 3058
3052 return True 3059 return True
3053 3060
3054 def saveAllScripts(self, reportSyntaxErrors = False): 3061 def saveAllScripts(self, reportSyntaxErrors = False):
3734 self.vcsMenu = QMenu(self.trUtf8('&Version Control'), menu) 3741 self.vcsMenu = QMenu(self.trUtf8('&Version Control'), menu)
3735 self.vcsMenu.setTearOffEnabled(True) 3742 self.vcsMenu.setTearOffEnabled(True)
3736 self.vcsProjectHelper.initMenu(self.vcsMenu) 3743 self.vcsProjectHelper.initMenu(self.vcsMenu)
3737 self.checksMenu = QMenu(self.trUtf8('Chec&k'), menu) 3744 self.checksMenu = QMenu(self.trUtf8('Chec&k'), menu)
3738 self.checksMenu.setTearOffEnabled(True) 3745 self.checksMenu.setTearOffEnabled(True)
3739 self.showMenu = QMenu(self.trUtf8('Sho&w'), menu) 3746 self.menuShow = QMenu(self.trUtf8('Sho&w'), menu)
3740 self.graphicsMenu = QMenu(self.trUtf8('&Diagrams'), menu) 3747 self.graphicsMenu = QMenu(self.trUtf8('&Diagrams'), menu)
3741 self.sessionMenu = QMenu(self.trUtf8('Session'), menu) 3748 self.sessionMenu = QMenu(self.trUtf8('Session'), menu)
3742 self.apidocMenu = QMenu(self.trUtf8('Source &Documentation'), menu) 3749 self.apidocMenu = QMenu(self.trUtf8('Source &Documentation'), menu)
3743 self.apidocMenu.setTearOffEnabled(True) 3750 self.apidocMenu.setTearOffEnabled(True)
3744 self.debuggerMenu = QMenu(self.trUtf8('Debugger'), menu) 3751 self.debuggerMenu = QMenu(self.trUtf8('Debugger'), menu)
3748 self.__menus = { 3755 self.__menus = {
3749 "Main" : menu, 3756 "Main" : menu,
3750 "Recent" : self.recentMenu, 3757 "Recent" : self.recentMenu,
3751 "VCS" : self.vcsMenu, 3758 "VCS" : self.vcsMenu,
3752 "Checks" : self.checksMenu, 3759 "Checks" : self.checksMenu,
3753 "Show" : self.showMenu, 3760 "Show" : self.menuShow,
3754 "Graphics" : self.graphicsMenu, 3761 "Graphics" : self.graphicsMenu,
3755 "Session" : self.sessionMenu, 3762 "Session" : self.sessionMenu,
3756 "Apidoc" : self.apidocMenu, 3763 "Apidoc" : self.apidocMenu,
3757 "Debugger" : self.debuggerMenu, 3764 "Debugger" : self.debuggerMenu,
3758 "Packagers" : self.packagersMenu, 3765 "Packagers" : self.packagersMenu,
3759 } 3766 }
3760 3767
3761 # connect the aboutToShow signals 3768 # connect the aboutToShow signals
3762 self.recentMenu.aboutToShow.connect(self.__showContextMenuRecent) 3769 self.recentMenu.aboutToShow.connect(self.__showContextMenuRecent)
3763 self.connect(self.recentMenu, SIGNAL('triggered(QAction *)'), 3770 self.recentMenu.triggered.connect(self.__openRecent)
3764 self.__openRecent)
3765 self.vcsMenu.aboutToShow.connect(self.__showContextMenuVCS) 3771 self.vcsMenu.aboutToShow.connect(self.__showContextMenuVCS)
3766 self.checksMenu.aboutToShow.connect(self.__showContextMenuChecks) 3772 self.checksMenu.aboutToShow.connect(self.__showContextMenuChecks)
3767 self.showMenu.aboutToShow.connect(self.__showContextMenuShow) 3773 self.menuShow.aboutToShow.connect(self.__showContextMenuShow)
3768 self.graphicsMenu.aboutToShow.connect(self.__showContextMenuGraphics) 3774 self.graphicsMenu.aboutToShow.connect(self.__showContextMenuGraphics)
3769 self.apidocMenu.aboutToShow.connect(self.__showContextMenuApiDoc) 3775 self.apidocMenu.aboutToShow.connect(self.__showContextMenuApiDoc)
3770 self.packagersMenu.aboutToShow.connect(self.__showContextMenuPackagers) 3776 self.packagersMenu.aboutToShow.connect(self.__showContextMenuPackagers)
3771 menu.aboutToShow.connect(self.__showMenu) 3777 menu.aboutToShow.connect(self.__showMenu)
3772 3778
3773 # build the show menu 3779 # build the show menu
3774 self.showMenu.setTearOffEnabled(True) 3780 self.menuShow.setTearOffEnabled(True)
3775 self.showMenu.addAction(self.codeMetricsAct) 3781 self.menuShow.addAction(self.codeMetricsAct)
3776 self.showMenu.addAction(self.codeCoverageAct) 3782 self.menuShow.addAction(self.codeCoverageAct)
3777 self.showMenu.addAction(self.codeProfileAct) 3783 self.menuShow.addAction(self.codeProfileAct)
3778 3784
3779 # build the diagrams menu 3785 # build the diagrams menu
3780 self.graphicsMenu.setTearOffEnabled(True) 3786 self.graphicsMenu.setTearOffEnabled(True)
3781 self.graphicsMenu.addAction(self.applicationDiagramAct) 3787 self.graphicsMenu.addAction(self.applicationDiagramAct)
3782 3788
3811 menu.addSeparator() 3817 menu.addSeparator()
3812 self.menuCheckAct = menu.addMenu(self.checksMenu) 3818 self.menuCheckAct = menu.addMenu(self.checksMenu)
3813 menu.addSeparator() 3819 menu.addSeparator()
3814 menu.addMenu(self.vcsMenu) 3820 menu.addMenu(self.vcsMenu)
3815 menu.addSeparator() 3821 menu.addSeparator()
3816 self.menuShowAct = menu.addMenu(self.showMenu) 3822 self.menuShowAct = menu.addMenu(self.menuShow)
3817 menu.addSeparator() 3823 menu.addSeparator()
3818 self.menuApidocAct = menu.addMenu(self.apidocMenu) 3824 self.menuApidocAct = menu.addMenu(self.apidocMenu)
3819 menu.addSeparator() 3825 menu.addSeparator()
3820 self.menuPackagersAct = menu.addMenu(self.packagersMenu) 3826 self.menuPackagersAct = menu.addMenu(self.packagersMenu)
3821 menu.addSeparator() 3827 menu.addSeparator()
3866 """ 3872 """
3867 Private method to set up the project menu. 3873 Private method to set up the project menu.
3868 """ 3874 """
3869 self.menuRecentAct.setEnabled(len(self.recent) > 0) 3875 self.menuRecentAct.setEnabled(len(self.recent) > 0)
3870 3876
3871 self.emit(SIGNAL("showMenu"), "Main", self.__menus["Main"]) 3877 self.showMenu.emit("Main", self.__menus["Main"])
3872 3878
3873 def __syncRecent(self): 3879 def __syncRecent(self):
3874 """ 3880 """
3875 Private method to synchronize the list of recently opened projects 3881 Private method to synchronize the list of recently opened projects
3876 with the central store. 3882 with the central store.
4041 Public slot to be called, if something was added to the OTHERS project data area. 4047 Public slot to be called, if something was added to the OTHERS project data area.
4042 4048
4043 @param fn filename or directory name added (string) 4049 @param fn filename or directory name added (string)
4044 @param updateModel flag indicating an update of the model is requested (boolean) 4050 @param updateModel flag indicating an update of the model is requested (boolean)
4045 """ 4051 """
4046 self.emit(SIGNAL('projectOthersAdded'), fn) 4052 self.projectOthersAdded.emit(fn)
4047 updateModel and self.__model.addNewItem("OTHERS", fn) 4053 updateModel and self.__model.addNewItem("OTHERS", fn)
4048 4054
4049 def getActions(self): 4055 def getActions(self):
4050 """ 4056 """
4051 Public method to get a list of all actions. 4057 Public method to get a list of all actions.
4094 """ 4100 """
4095 if not self.isOpen(): 4101 if not self.isOpen():
4096 return 4102 return
4097 4103
4098 name = self.getRelativePath(fullname) 4104 name = self.getRelativePath(fullname)
4099 self.emit(SIGNAL("prepareRepopulateItem"), name) 4105 self.prepareRepopulateItem.emit(name)
4100 self.__model.repopulateItem(name) 4106 self.__model.repopulateItem(name)
4101 self.emit(SIGNAL("completeRepopulateItem"), name) 4107 self.completeRepopulateItem.emit(name)
4102 4108
4103 ############################################################## 4109 ##############################################################
4104 ## Below is the VCS interface 4110 ## Below is the VCS interface
4105 ############################################################## 4111 ##############################################################
4106 4112
4192 """ 4198 """
4193 Private slot called before the vcs menu is shown. 4199 Private slot called before the vcs menu is shown.
4194 """ 4200 """
4195 self.vcsProjectHelper.showMenu() 4201 self.vcsProjectHelper.showMenu()
4196 if self.vcsBasicHelper: 4202 if self.vcsBasicHelper:
4197 self.emit(SIGNAL("showMenu"), "VCS", self.vcsMenu) 4203 self.showMenu.emit("VCS", self.vcsMenu)
4198 4204
4199 ######################################################################### 4205 #########################################################################
4200 ## Below is the interface to the checker tools 4206 ## Below is the interface to the checker tools
4201 ######################################################################### 4207 #########################################################################
4202 4208
4203 def __showContextMenuChecks(self): 4209 def __showContextMenuChecks(self):
4204 """ 4210 """
4205 Private slot called before the checks menu is shown. 4211 Private slot called before the checks menu is shown.
4206 """ 4212 """
4207 self.emit(SIGNAL("showMenu"), "Checks", self.checksMenu) 4213 self.showMenu.emit("Checks", self.checksMenu)
4208 4214
4209 ######################################################################### 4215 #########################################################################
4210 ## Below is the interface to the packagers tools 4216 ## Below is the interface to the packagers tools
4211 ######################################################################### 4217 #########################################################################
4212 4218
4213 def __showContextMenuPackagers(self): 4219 def __showContextMenuPackagers(self):
4214 """ 4220 """
4215 Private slot called before the packagers menu is shown. 4221 Private slot called before the packagers menu is shown.
4216 """ 4222 """
4217 self.emit(SIGNAL("showMenu"), "Packagers", self.packagersMenu) 4223 self.showMenu.emit("Packagers", self.packagersMenu)
4218 4224
4219 ######################################################################### 4225 #########################################################################
4220 ## Below is the interface to the apidoc tools 4226 ## Below is the interface to the apidoc tools
4221 ######################################################################### 4227 #########################################################################
4222 4228
4223 def __showContextMenuApiDoc(self): 4229 def __showContextMenuApiDoc(self):
4224 """ 4230 """
4225 Private slot called before the apidoc menu is shown. 4231 Private slot called before the apidoc menu is shown.
4226 """ 4232 """
4227 self.emit(SIGNAL("showMenu"), "Apidoc", self.apidocMenu) 4233 self.showMenu.emit("Apidoc", self.apidocMenu)
4228 4234
4229 ######################################################################### 4235 #########################################################################
4230 ## Below is the interface to the show tools 4236 ## Below is the interface to the show tools
4231 ######################################################################### 4237 #########################################################################
4232 4238
4348 os.path.isfile("{0}.coverage".format(tbasename)))) 4354 os.path.isfile("{0}.coverage".format(tbasename))))
4349 else: 4355 else:
4350 self.codeProfileAct.setEnabled(False) 4356 self.codeProfileAct.setEnabled(False)
4351 self.codeCoverageAct.setEnabled(False) 4357 self.codeCoverageAct.setEnabled(False)
4352 4358
4353 self.emit(SIGNAL("showMenu"), "Show", self.showMenu) 4359 self.showMenu.emit("Show", self.menuShow)
4354 4360
4355 ######################################################################### 4361 #########################################################################
4356 ## Below is the interface to the diagrams 4362 ## Below is the interface to the diagrams
4357 ######################################################################### 4363 #########################################################################
4358 4364
4359 def __showContextMenuGraphics(self): 4365 def __showContextMenuGraphics(self):
4360 """ 4366 """
4361 Private slot called before the graphics menu is shown. 4367 Private slot called before the graphics menu is shown.
4362 """ 4368 """
4363 self.emit(SIGNAL("showMenu"), "Graphics", self.graphicsMenu) 4369 self.showMenu.emit("Graphics", self.graphicsMenu)
4364 4370
4365 def handleApplicationDiagram(self): 4371 def handleApplicationDiagram(self):
4366 """ 4372 """
4367 Private method to handle the application diagram context menu action. 4373 Private method to handle the application diagram context menu action.
4368 """ 4374 """
4389 It simply reemits the received status. 4395 It simply reemits the received status.
4390 4396
4391 @param status status of the monitoring thread (string, ok, nok or off) 4397 @param status status of the monitoring thread (string, ok, nok or off)
4392 @param statusMsg explanotory text for the signaled status (string) 4398 @param statusMsg explanotory text for the signaled status (string)
4393 """ 4399 """
4394 self.emit(SIGNAL("vcsStatusMonitorStatus(QString, QString)"), status, statusMsg) 4400 self.vcsStatusMonitorStatus.emit(status, statusMsg)
4395 4401
4396 def setStatusMonitorInterval(self, interval): 4402 def setStatusMonitorInterval(self, interval):
4397 """ 4403 """
4398 Public method to se the interval of the VCS status monitor thread. 4404 Public method to se the interval of the VCS status monitor thread.
4399 4405

eric ide

mercurial