19 import io |
19 import io |
20 |
20 |
21 from PyQt4.QtCore import * |
21 from PyQt4.QtCore import * |
22 from PyQt4.QtGui import * |
22 from PyQt4.QtGui import * |
23 |
23 |
24 from E4Gui.E4Application import e4App |
24 from E4Gui.E4Application import e5App |
25 |
25 |
26 from Globals import recentNameProject |
26 from Globals import recentNameProject |
27 |
27 |
28 from .ProjectBrowserModel import ProjectBrowserModel |
28 from .ProjectBrowserModel import ProjectBrowserModel |
29 |
29 |
2325 self.appendFile(fn, True) |
2325 self.appendFile(fn, True) |
2326 self.saveProject() |
2326 self.saveProject() |
2327 |
2327 |
2328 # check, if the existing project directory is already under |
2328 # check, if the existing project directory is already under |
2329 # VCS control |
2329 # VCS control |
2330 pluginManager = e4App().getObject("PluginManager") |
2330 pluginManager = e5App().getObject("PluginManager") |
2331 for indicator, vcsData in list(pluginManager.getVcsSystemIndicators().items()): |
2331 for indicator, vcsData in list(pluginManager.getVcsSystemIndicators().items()): |
2332 if os.path.exists(os.path.join(self.ppath, indicator)): |
2332 if os.path.exists(os.path.join(self.ppath, indicator)): |
2333 if len(vcsData) > 1: |
2333 if len(vcsData) > 1: |
2334 vcsList = [] |
2334 vcsList = [] |
2335 for vcsSystemStr, vcsSystemDisplay in vcsData: |
2335 for vcsSystemStr, vcsSystemDisplay in vcsData: |
2386 self.saveProject() |
2386 self.saveProject() |
2387 break |
2387 break |
2388 |
2388 |
2389 # put the project under VCS control |
2389 # put the project under VCS control |
2390 if self.vcs is None: |
2390 if self.vcs is None: |
2391 vcsSystemsDict = e4App().getObject("PluginManager")\ |
2391 vcsSystemsDict = e5App().getObject("PluginManager")\ |
2392 .getPluginDisplayStrings("version_control") |
2392 .getPluginDisplayStrings("version_control") |
2393 vcsSystemsDisplay = [self.trUtf8("None")] |
2393 vcsSystemsDisplay = [self.trUtf8("None")] |
2394 keys = sorted(vcsSystemsDict.keys()) |
2394 keys = sorted(vcsSystemsDict.keys()) |
2395 for key in keys: |
2395 for key in keys: |
2396 vcsSystemsDisplay.append(vcsSystemsDict[key]) |
2396 vcsSystemsDisplay.append(vcsSystemsDict[key]) |
2595 self.disconnect(self.vcs, |
2595 self.disconnect(self.vcs, |
2596 SIGNAL("vcsStatusMonitorStatus(QString, QString)"), |
2596 SIGNAL("vcsStatusMonitorStatus(QString, QString)"), |
2597 self.__statusMonitorStatus) |
2597 self.__statusMonitorStatus) |
2598 self.vcs.vcsShutdown() |
2598 self.vcs.vcsShutdown() |
2599 self.vcs = None |
2599 self.vcs = None |
2600 e4App().getObject("PluginManager").deactivateVcsPlugins() |
2600 e5App().getObject("PluginManager").deactivateVcsPlugins() |
2601 # reinit VCS |
2601 # reinit VCS |
2602 self.vcs = self.initVCS() |
2602 self.vcs = self.initVCS() |
2603 # start the VCS monitor thread |
2603 # start the VCS monitor thread |
2604 if self.vcs is not None: |
2604 if self.vcs is not None: |
2605 self.vcs.startStatusMonitor(self) |
2605 self.vcs.startStatusMonitor(self) |
2707 QApplication.processEvents() |
2707 QApplication.processEvents() |
2708 |
2708 |
2709 self.vcs = self.initVCS() |
2709 self.vcs = self.initVCS() |
2710 if self.vcs is None: |
2710 if self.vcs is None: |
2711 # check, if project is version controlled |
2711 # check, if project is version controlled |
2712 pluginManager = e4App().getObject("PluginManager") |
2712 pluginManager = e5App().getObject("PluginManager") |
2713 for indicator, vcsData in \ |
2713 for indicator, vcsData in \ |
2714 list(pluginManager.getVcsSystemIndicators().items()): |
2714 list(pluginManager.getVcsSystemIndicators().items()): |
2715 if os.path.exists(os.path.join(self.ppath, indicator)): |
2715 if os.path.exists(os.path.join(self.ppath, indicator)): |
2716 if len(vcsData) > 1: |
2716 if len(vcsData) > 1: |
2717 vcsList = [] |
2717 vcsList = [] |
2946 if Preferences.getProject("AutoSaveDbgProperties") and \ |
2946 if Preferences.getProject("AutoSaveDbgProperties") and \ |
2947 self.isDebugPropertiesLoaded(): |
2947 self.isDebugPropertiesLoaded(): |
2948 self.__writeDebugProperties(True) |
2948 self.__writeDebugProperties(True) |
2949 |
2949 |
2950 # now save all open modified files of the project |
2950 # now save all open modified files of the project |
2951 vm = e4App().getObject("ViewManager") |
2951 vm = e5App().getObject("ViewManager") |
2952 success = True |
2952 success = True |
2953 for fn in vm.getOpenFilenames(): |
2953 for fn in vm.getOpenFilenames(): |
2954 if self.isProjectFile(fn): |
2954 if self.isProjectFile(fn): |
2955 success &= vm.closeWindow(fn) |
2955 success &= vm.closeWindow(fn) |
2956 |
2956 |
2974 |
2974 |
2975 # now shutdown the vcs interface |
2975 # now shutdown the vcs interface |
2976 if self.vcs: |
2976 if self.vcs: |
2977 self.vcs.vcsShutdown() |
2977 self.vcs.vcsShutdown() |
2978 self.vcs = None |
2978 self.vcs = None |
2979 e4App().getObject("PluginManager").deactivateVcsPlugins() |
2979 e5App().getObject("PluginManager").deactivateVcsPlugins() |
2980 |
2980 |
2981 # now close all project related windows |
2981 # now close all project related windows |
2982 self.__closeAllWindows() |
2982 self.__closeAllWindows() |
2983 |
2983 |
2984 self.__initData() |
2984 self.__initData() |
3013 |
3013 |
3014 @keyparam reportSyntaxErrors flag indicating special reporting |
3014 @keyparam reportSyntaxErrors flag indicating special reporting |
3015 for syntax errors (boolean) |
3015 for syntax errors (boolean) |
3016 @return flag indicating success (boolean) |
3016 @return flag indicating success (boolean) |
3017 """ |
3017 """ |
3018 vm = e4App().getObject("ViewManager") |
3018 vm = e5App().getObject("ViewManager") |
3019 success = True |
3019 success = True |
3020 filesWithSyntaxErrors = 0 |
3020 filesWithSyntaxErrors = 0 |
3021 for fn in vm.getOpenFilenames(): |
3021 for fn in vm.getOpenFilenames(): |
3022 rfn = fn.replace(self.ppath + os.sep, '') # make relativ to project |
3022 rfn = fn.replace(self.ppath + os.sep, '') # make relativ to project |
3023 if rfn in self.pdata["SOURCES"] or rfn in self.pdata["OTHERS"]: |
3023 if rfn in self.pdata["SOURCES"] or rfn in self.pdata["OTHERS"]: |