eric6/Project/Project.py

changeset 7518
6dea4abd3097
parent 7360
9190402e4505
child 7533
88261c96484b
equal deleted inserted replaced
7517:d6910340b538 7518:6dea4abd3097
709 Public method to get a reference to the project browser model. 709 Public method to get a reference to the project browser model.
710 710
711 @return reference to the project browser model (ProjectBrowserModel) 711 @return reference to the project browser model (ProjectBrowserModel)
712 """ 712 """
713 return self.__model 713 return self.__model
714
715 def startFileSystemMonitoring(self):
716 """
717 Public method to (re)start monitoring the project file system.
718 """
719 self.__model.startFileSystemMonitoring()
720
721 def stopFileSystemMonitoring(self):
722 """
723 Public method to stop monitoring the project file system.
724 """
725 self.__model.stopFileSystemMonitoring()
714 726
715 def getVcs(self): 727 def getVcs(self):
716 """ 728 """
717 Public method to get a reference to the VCS object. 729 Public method to get a reference to the VCS object.
718 730
2015 @param isSourceFile flag indicating that this is a source file 2027 @param isSourceFile flag indicating that this is a source file
2016 even if it doesn't have the source extension (boolean) 2028 even if it doesn't have the source extension (boolean)
2017 """ 2029 """
2018 fn = self.getRelativePath(oldname) 2030 fn = self.getRelativePath(oldname)
2019 if os.path.dirname(oldname) == os.path.dirname(newname): 2031 if os.path.dirname(oldname) == os.path.dirname(newname):
2020 self.removeFile(oldname, False) 2032 if self.__isInPdata(oldname):
2021 self.appendFile(newname, isSourceFile, False) 2033 self.removeFile(oldname, False)
2034 self.appendFile(newname, isSourceFile, False)
2022 self.__model.renameItem(fn, newname) 2035 self.__model.renameItem(fn, newname)
2023 else: 2036 else:
2024 self.removeFile(oldname) 2037 self.removeFile(oldname)
2025 self.appendFile(newname, isSourceFile) 2038 self.appendFile(newname, isSourceFile)
2026 self.projectFileRenamed.emit(oldname, newname) 2039 self.projectFileRenamed.emit(oldname, newname)
2123 if newdn not in self.otherssubdirs: 2136 if newdn not in self.otherssubdirs:
2124 self.otherssubdirs.append(newdn) 2137 self.otherssubdirs.append(newdn)
2125 else: 2138 else:
2126 if newdn not in self.subdirs: 2139 if newdn not in self.subdirs:
2127 self.subdirs.append(newdn) 2140 self.subdirs.append(newdn)
2128 self.setDirty(True) 2141 if typeStrings:
2129 typeString = typeStrings[0] 2142 # the directory is controlled by the project
2130 del typeStrings[0] 2143 self.setDirty(True)
2131 self.__model.removeItem(olddn) 2144 self.__model.removeItem(olddn)
2132 self.__model.addNewItem(typeString, newdn, typeStrings) 2145 typeString = typeStrings[0]
2146 del typeStrings[0]
2147 self.__model.addNewItem(typeString, newdn, typeStrings)
2148 else:
2149 self.__model.renameItem(olddn, self.getAbsolutePath(newdn))
2133 self.directoryRemoved.emit(olddn) 2150 self.directoryRemoved.emit(olddn)
2134 2151
2135 def removeFile(self, fn, updateModel=True): 2152 def removeFile(self, fn, updateModel=True):
2136 """ 2153 """
2137 Public slot to remove a file from the project. 2154 Public slot to remove a file from the project.
3719 3736
3720 @return project description 3737 @return project description
3721 @rtype str 3738 @rtype str
3722 """ 3739 """
3723 return self.pdata["DESCRIPTION"] 3740 return self.pdata["DESCRIPTION"]
3724 3741
3742 def __isInPdata(self, fn):
3743 """
3744 Private method used to check, if the passed in filename is project
3745 controlled..
3746
3747 @param fn filename to be checked
3748 @type str
3749 @return flag indicating membership
3750 @rtype bool
3751 """
3752 newfn = os.path.abspath(fn)
3753 newfn = self.getRelativePath(newfn)
3754 for group in ["SOURCES", "FORMS", "INTERFACES", "PROTOCOLS",
3755 "RESOURCES", "TRANSLATIONS", "OTHERS"]:
3756 if newfn in self.pdata[group]:
3757 return True
3758 return False
3759
3725 def isProjectFile(self, fn): 3760 def isProjectFile(self, fn):
3726 """ 3761 """
3727 Public method used to check, if the passed in filename belongs to the 3762 Public method used to check, if the passed in filename belongs to the
3728 project. 3763 project.
3729 3764

eric ide

mercurial