278 """ |
279 """ |
279 self.loaded = False # flag for the loaded status |
280 self.loaded = False # flag for the loaded status |
280 self.dirty = False # dirty flag |
281 self.dirty = False # dirty flag |
281 self.pfile = "" # name of the project file |
282 self.pfile = "" # name of the project file |
282 self.ppath = "" # name of the project directory |
283 self.ppath = "" # name of the project directory |
|
284 self.ppathRe = None |
283 self.translationsRoot = "" # the translations prefix |
285 self.translationsRoot = "" # the translations prefix |
284 self.name = "" |
286 self.name = "" |
285 self.opened = False |
287 self.opened = False |
286 self.subdirs = [""] # record the project dir as a relative path (i.e. empty path) |
288 self.subdirs = [""] # record the project dir as a relative path (i.e. empty path) |
287 self.otherssubdirs = [] |
289 self.otherssubdirs = [] |
569 .format(fn)) |
571 .format(fn)) |
570 return False |
572 return False |
571 |
573 |
572 self.pfile = os.path.abspath(fn) |
574 self.pfile = os.path.abspath(fn) |
573 self.ppath = os.path.abspath(os.path.dirname(fn)) |
575 self.ppath = os.path.abspath(os.path.dirname(fn)) |
|
576 if Utilities.isWindowsPlatform(): |
|
577 self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE ) |
|
578 else: |
|
579 self.ppathRe = re.compile(re.escape(self.ppath + os.sep)) |
574 |
580 |
575 # insert filename into list of recently opened projects |
581 # insert filename into list of recently opened projects |
576 self.__syncRecent() |
582 self.__syncRecent() |
577 |
583 |
578 # now read the file |
584 # now read the file |
724 res = self.__writeXMLProject(fn) |
730 res = self.__writeXMLProject(fn) |
725 |
731 |
726 if res: |
732 if res: |
727 self.pfile = os.path.abspath(fn) |
733 self.pfile = os.path.abspath(fn) |
728 self.ppath = os.path.abspath(os.path.dirname(fn)) |
734 self.ppath = os.path.abspath(os.path.dirname(fn)) |
|
735 if Utilities.isWindowsPlatform(): |
|
736 self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE ) |
|
737 else: |
|
738 self.ppathRe = re.compile(re.escape(self.ppath + os.sep)) |
729 self.name = os.path.splitext(os.path.basename(fn))[0] |
739 self.name = os.path.splitext(os.path.basename(fn))[0] |
730 self.setDirty(False) |
740 self.setDirty(False) |
731 |
741 |
732 # insert filename into list of recently opened projects |
742 # insert filename into list of recently opened projects |
733 self.__syncRecent() |
743 self.__syncRecent() |
1540 |
1550 |
1541 The translation file is not deleted from the project directory. |
1551 The translation file is not deleted from the project directory. |
1542 |
1552 |
1543 @param langFile the translation file to be removed (string) |
1553 @param langFile the translation file to be removed (string) |
1544 """ |
1554 """ |
1545 langFile = langFile.replace(self.ppath + os.sep, '') |
1555 langFile = self.getRelativePath(langFile) |
1546 qmFile = self.__binaryTranslationFile(langFile) |
1556 qmFile = self.__binaryTranslationFile(langFile) |
1547 self.pdata["TRANSLATIONS"].remove(langFile) |
1557 self.pdata["TRANSLATIONS"].remove(langFile) |
1548 self.__model.removeItem(langFile) |
1558 self.__model.removeItem(langFile) |
1549 if qmFile: |
1559 if qmFile: |
1550 try: |
1560 try: |
1551 if self.pdata["TRANSLATIONSBINPATH"]: |
1561 if self.pdata["TRANSLATIONSBINPATH"]: |
1552 qmFile = os.path.join(self.pdata["TRANSLATIONSBINPATH"][0], |
1562 qmFile = self.getRelativePath( |
1553 os.path.basename(qmFile)).replace(self.ppath + os.sep, '') |
1563 os.path.join(self.pdata["TRANSLATIONSBINPATH"][0], |
|
1564 os.path.basename(qmFile))) |
1554 self.pdata["TRANSLATIONS"].remove(qmFile) |
1565 self.pdata["TRANSLATIONS"].remove(qmFile) |
1555 self.__model.removeItem(qmFile) |
1566 self.__model.removeItem(qmFile) |
1556 except ValueError: |
1567 except ValueError: |
1557 pass |
1568 pass |
1558 self.setDirty(True) |
1569 self.setDirty(True) |
1561 """ |
1572 """ |
1562 Public slot to delete a translation from the project directory. |
1573 Public slot to delete a translation from the project directory. |
1563 |
1574 |
1564 @param langFile the translation file to be removed (string) |
1575 @param langFile the translation file to be removed (string) |
1565 """ |
1576 """ |
1566 langFile = langFile.replace(self.ppath + os.sep, '') |
1577 langFile = self.getRelativePath(langFile) |
1567 qmFile = self.__binaryTranslationFile(langFile) |
1578 qmFile = self.__binaryTranslationFile(langFile) |
1568 |
1579 |
1569 try: |
1580 try: |
1570 fn = os.path.join(self.ppath, langFile) |
1581 fn = os.path.join(self.ppath, langFile) |
1571 if os.path.exists(fn): |
1582 if os.path.exists(fn): |
1581 |
1592 |
1582 # now get rid of the .qm file |
1593 # now get rid of the .qm file |
1583 if qmFile: |
1594 if qmFile: |
1584 try: |
1595 try: |
1585 if self.pdata["TRANSLATIONSBINPATH"]: |
1596 if self.pdata["TRANSLATIONSBINPATH"]: |
1586 qmFile = os.path.join(self.pdata["TRANSLATIONSBINPATH"][0], |
1597 qmFile = self.getRelativePath( |
1587 os.path.basename(qmFile)).replace(self.ppath + os.sep, '') |
1598 os.path.join(self.pdata["TRANSLATIONSBINPATH"][0], |
|
1599 os.path.basename(qmFile))) |
1588 fn = os.path.join(self.ppath, qmFile) |
1600 fn = os.path.join(self.ppath, qmFile) |
1589 if os.path.exists(fn): |
1601 if os.path.exists(fn): |
1590 os.remove(fn) |
1602 os.remove(fn) |
1591 except IOError: |
1603 except IOError: |
1592 QMessageBox.critical(None, |
1604 QMessageBox.critical(None, |
1606 """ |
1618 """ |
1607 dirty = False |
1619 dirty = False |
1608 |
1620 |
1609 if os.path.isabs(fn): |
1621 if os.path.isabs(fn): |
1610 # make it relative to the project root, if it starts with that path |
1622 # make it relative to the project root, if it starts with that path |
1611 newfn = fn.replace(self.ppath + os.sep, '') |
1623 newfn = self.getRelativePath(fn) |
1612 else: |
1624 else: |
1613 # assume relative paths are relative to the project root |
1625 # assume relative paths are relative to the project root |
1614 newfn = fn |
1626 newfn = fn |
1615 newdir = os.path.dirname(newfn) |
1627 newdir = os.path.dirname(newfn) |
1616 |
1628 |
1874 |
1886 |
1875 @param fn file name or directory name to add (string) |
1887 @param fn file name or directory name to add (string) |
1876 """ |
1888 """ |
1877 if fn: |
1889 if fn: |
1878 # if it is below the project directory, make it relative to that |
1890 # if it is below the project directory, make it relative to that |
1879 fn = fn.replace(self.ppath + os.sep, '') |
1891 fn = self.getRelativePath(fn) |
1880 |
1892 |
1881 # if it ends with the directory separator character, remove it |
1893 # if it ends with the directory separator character, remove it |
1882 if fn.endswith(os.sep): |
1894 if fn.endswith(os.sep): |
1883 fn = fn[:-1] |
1895 fn = fn[:-1] |
1884 |
1896 |
1956 |
1968 |
1957 @param oldfn old filename (string) |
1969 @param oldfn old filename (string) |
1958 @param newfn new filename of the main script (string) |
1970 @param newfn new filename of the main script (string) |
1959 """ |
1971 """ |
1960 if self.pdata["MAINSCRIPT"]: |
1972 if self.pdata["MAINSCRIPT"]: |
1961 ofn = oldfn.replace(self.ppath + os.sep, '') |
1973 ofn = self.getRelativePath(oldfn) |
1962 if ofn != self.pdata["MAINSCRIPT"][0]: |
1974 if ofn != self.pdata["MAINSCRIPT"][0]: |
1963 return |
1975 return |
1964 |
1976 |
1965 fn = newfn.replace(self.ppath + os.sep, '') |
1977 fn = self.getRelativePath(newfn) |
1966 self.pdata["MAINSCRIPT"] = [fn] |
1978 self.pdata["MAINSCRIPT"] = [fn] |
1967 self.setDirty(True) |
1979 self.setDirty(True) |
1968 |
1980 |
1969 def renameFile(self, oldfn, newfn = None): |
1981 def renameFile(self, oldfn, newfn = None): |
1970 """ |
1982 """ |
1972 |
1984 |
1973 @param oldfn old filename of the file (string) |
1985 @param oldfn old filename of the file (string) |
1974 @param newfn new filename of the file (string) |
1986 @param newfn new filename of the file (string) |
1975 @return flag indicating success |
1987 @return flag indicating success |
1976 """ |
1988 """ |
1977 fn = oldfn.replace(self.ppath + os.sep, '') |
1989 fn = self.getRelativePath(oldfn) |
1978 isSourceFile = fn in self.pdata["SOURCES"] |
1990 isSourceFile = fn in self.pdata["SOURCES"] |
1979 |
1991 |
1980 if newfn is None: |
1992 if newfn is None: |
1981 newfn = QFileDialog.getSaveFileName(\ |
1993 newfn = QFileDialog.getSaveFileName(\ |
1982 None, |
1994 None, |
2026 @param oldname old filename (string) |
2038 @param oldname old filename (string) |
2027 @param newname new filename (string) |
2039 @param newname new filename (string) |
2028 @param isSourceFile flag indicating that this is a source file |
2040 @param isSourceFile flag indicating that this is a source file |
2029 even if it doesn't have the source extension (boolean) |
2041 even if it doesn't have the source extension (boolean) |
2030 """ |
2042 """ |
2031 fn = oldname.replace(self.ppath + os.sep, '') |
2043 fn = self.getRelativePath(oldname) |
2032 if os.path.dirname(oldname) == os.path.dirname(newname): |
2044 if os.path.dirname(oldname) == os.path.dirname(newname): |
2033 self.removeFile(oldname, False) |
2045 self.removeFile(oldname, False) |
2034 self.appendFile(newname, isSourceFile, False) |
2046 self.appendFile(newname, isSourceFile, False) |
2035 self.__model.renameItem(fn, newname) |
2047 self.__model.renameItem(fn, newname) |
2036 else: |
2048 else: |
2045 Public method to get all files starting with a common prefix. |
2057 Public method to get all files starting with a common prefix. |
2046 |
2058 |
2047 @param start prefix (string) |
2059 @param start prefix (string) |
2048 """ |
2060 """ |
2049 filelist = [] |
2061 filelist = [] |
2050 start = start.replace(self.ppath + os.sep, '') |
2062 start = self.getRelativePath(start) |
2051 for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", "OTHERS"]: |
2063 for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", "OTHERS"]: |
2052 for entry in self.pdata[key][:]: |
2064 for entry in self.pdata[key][:]: |
2053 if entry.startswith(start): |
2065 if entry.startswith(start): |
2054 filelist.append(os.path.join(self.ppath, entry)) |
2066 filelist.append(os.path.join(self.ppath, entry)) |
2055 return filelist |
2067 return filelist |
2059 Public slot to copy a directory. |
2071 Public slot to copy a directory. |
2060 |
2072 |
2061 @param olddn original directory name (string) |
2073 @param olddn original directory name (string) |
2062 @param newdn new directory name (string) |
2074 @param newdn new directory name (string) |
2063 """ |
2075 """ |
2064 olddn = olddn.replace(self.ppath + os.sep, '') |
2076 olddn = self.getRelativePath(olddn) |
2065 newdn = newdn.replace(self.ppath + os.sep, '') |
2077 newdn = self.getRelativePath(newdn) |
2066 for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", "OTHERS"]: |
2078 for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", "OTHERS"]: |
2067 for entry in self.pdata[key][:]: |
2079 for entry in self.pdata[key][:]: |
2068 if entry.startswith(olddn): |
2080 if entry.startswith(olddn): |
2069 entry = entry.replace(olddn, newdn) |
2081 entry = entry.replace(olddn, newdn) |
2070 self.appendFile(os.path.join(self.ppath, entry), key == "SOURCES") |
2082 self.appendFile(os.path.join(self.ppath, entry), key == "SOURCES") |
2075 Public slot to move a directory. |
2087 Public slot to move a directory. |
2076 |
2088 |
2077 @param olddn old directory name (string) |
2089 @param olddn old directory name (string) |
2078 @param newdn new directory name (string) |
2090 @param newdn new directory name (string) |
2079 """ |
2091 """ |
2080 olddn = olddn.replace(self.ppath + os.sep, '') |
2092 olddn = self.getRelativePath(olddn) |
2081 newdn = newdn.replace(self.ppath + os.sep, '') |
2093 newdn = self.getRelativePath(newdn) |
2082 typeStrings = [] |
2094 typeStrings = [] |
2083 for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", "OTHERS"]: |
2095 for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", "OTHERS"]: |
2084 for entry in self.pdata[key][:]: |
2096 for entry in self.pdata[key][:]: |
2085 if entry.startswith(olddn): |
2097 if entry.startswith(olddn): |
2086 if key not in typeStrings: |
2098 if key not in typeStrings: |
2108 The file is not deleted from the project directory. |
2120 The file is not deleted from the project directory. |
2109 |
2121 |
2110 @param fn filename to be removed from the project |
2122 @param fn filename to be removed from the project |
2111 @param updateModel flag indicating an update of the model is requested (boolean) |
2123 @param updateModel flag indicating an update of the model is requested (boolean) |
2112 """ |
2124 """ |
2113 fn = fn.replace(self.ppath + os.sep, '') |
2125 fn = self.getRelativePath(fn) |
2114 dirty = True |
2126 dirty = True |
2115 if fn in self.pdata["SOURCES"]: |
2127 if fn in self.pdata["SOURCES"]: |
2116 self.pdata["SOURCES"].remove(fn) |
2128 self.pdata["SOURCES"].remove(fn) |
2117 elif fn in self.pdata["FORMS"]: |
2129 elif fn in self.pdata["FORMS"]: |
2118 self.pdata["FORMS"].remove(fn) |
2130 self.pdata["FORMS"].remove(fn) |
2137 The directory is not deleted from the project directory. |
2149 The directory is not deleted from the project directory. |
2138 |
2150 |
2139 @param dn directory name to be removed from the project |
2151 @param dn directory name to be removed from the project |
2140 """ |
2152 """ |
2141 dirty = False |
2153 dirty = False |
2142 dn = dn.replace(self.ppath + os.sep, '') |
2154 dn = self.getRelativePath(dn) |
2143 for entry in self.pdata["OTHERS"][:]: |
2155 for entry in self.pdata["OTHERS"][:]: |
2144 if entry.startswith(dn): |
2156 if entry.startswith(dn): |
2145 self.pdata["OTHERS"].remove(entry) |
2157 self.pdata["OTHERS"].remove(entry) |
2146 dirty = True |
2158 dirty = True |
2147 if not dn.endswith(os.sep): |
2159 if not dn.endswith(os.sep): |
2210 Public method to check the project for a file. |
2222 Public method to check the project for a file. |
2211 |
2223 |
2212 @param fn filename to be checked (string) |
2224 @param fn filename to be checked (string) |
2213 @return flag indicating, if the project contains the file (boolean) |
2225 @return flag indicating, if the project contains the file (boolean) |
2214 """ |
2226 """ |
2215 fn = fn.replace(self.ppath + os.sep, '') |
2227 fn = self.getRelativePath(fn) |
2216 if fn in self.pdata["SOURCES"] or \ |
2228 if fn in self.pdata["SOURCES"] or \ |
2217 fn in self.pdata["FORMS"] or \ |
2229 fn in self.pdata["FORMS"] or \ |
2218 fn in self.pdata["INTERFACES"] or \ |
2230 fn in self.pdata["INTERFACES"] or \ |
2219 fn in self.pdata["RESOURCES"] or \ |
2231 fn in self.pdata["RESOURCES"] or \ |
2220 fn in self.pdata["OTHERS"]: |
2232 fn in self.pdata["OTHERS"]: |
2509 QLineEdit.Normal, |
2521 QLineEdit.Normal, |
2510 tslist[0]) |
2522 tslist[0]) |
2511 if not pattern.isEmpty: |
2523 if not pattern.isEmpty: |
2512 self.pdata["TRANSLATIONPATTERN"] = [pattern] |
2524 self.pdata["TRANSLATIONPATTERN"] = [pattern] |
2513 self.pdata["TRANSLATIONPATTERN"][0] = \ |
2525 self.pdata["TRANSLATIONPATTERN"][0] = \ |
2514 self.pdata["TRANSLATIONPATTERN"][0].replace(self.ppath + os.sep, "") |
2526 self.getRelativePath(self.pdata["TRANSLATIONPATTERN"][0]) |
2515 pattern = self.pdata["TRANSLATIONPATTERN"][0].replace("%language%", "*") |
2527 pattern = self.pdata["TRANSLATIONPATTERN"][0].replace("%language%", "*") |
2516 for ts in tslist: |
2528 for ts in tslist: |
2517 if fnmatch.fnmatch(ts, pattern): |
2529 if fnmatch.fnmatch(ts, pattern): |
2518 self.pdata["TRANSLATIONS"].append(ts) |
2530 self.pdata["TRANSLATIONS"].append(ts) |
2519 self.emit(SIGNAL('projectLanguageAdded'), ts) |
2531 self.emit(SIGNAL('projectLanguageAdded'), ts) |
3030 """ |
3042 """ |
3031 vm = e5App().getObject("ViewManager") |
3043 vm = e5App().getObject("ViewManager") |
3032 success = True |
3044 success = True |
3033 filesWithSyntaxErrors = 0 |
3045 filesWithSyntaxErrors = 0 |
3034 for fn in vm.getOpenFilenames(): |
3046 for fn in vm.getOpenFilenames(): |
3035 rfn = fn.replace(self.ppath + os.sep, '') # make relativ to project |
3047 rfn = self.getRelativePath(fn) |
3036 if rfn in self.pdata["SOURCES"] or rfn in self.pdata["OTHERS"]: |
3048 if rfn in self.pdata["SOURCES"] or rfn in self.pdata["OTHERS"]: |
3037 editor = vm.getOpenEditor(fn) |
3049 editor = vm.getOpenEditor(fn) |
3038 success &= vm.saveEditorEd(editor) |
3050 success &= vm.saveEditorEd(editor) |
3039 if reportSyntaxErrors and editor.hasSyntaxErrors(): |
3051 if reportSyntaxErrors and editor.hasSyntaxErrors(): |
3040 filesWithSyntaxErrors += 1 |
3052 filesWithSyntaxErrors += 1 |
3135 |
3147 |
3136 @return project path (string) |
3148 @return project path (string) |
3137 """ |
3149 """ |
3138 return self.ppath |
3150 return self.ppath |
3139 |
3151 |
|
3152 def startswithProjectPath(self, path): |
|
3153 """ |
|
3154 Public method to check, if a path starts with the project path. |
|
3155 |
|
3156 @param path path to be checked (string) |
|
3157 """ |
|
3158 if self.ppathRe: |
|
3159 return self.ppathRe.match(path) is not None |
|
3160 else: |
|
3161 return False |
|
3162 |
3140 def getProjectFile(self): |
3163 def getProjectFile(self): |
3141 """ |
3164 """ |
3142 Public method to get the path of the project file. |
3165 Public method to get the path of the project file. |
3143 |
3166 |
3144 @return path of the project file (string) |
3167 @return path of the project file (string) |
3162 |
3185 |
3163 @return project hash as a hex string (string) |
3186 @return project hash as a hex string (string) |
3164 """ |
3187 """ |
3165 return self.pdata["HASH"][0] |
3188 return self.pdata["HASH"][0] |
3166 |
3189 |
3167 def getRelativePath(self, fn): |
3190 def getRelativePath(self, path): |
3168 """ |
3191 """ |
3169 Public method to convert a file path to a project relative |
3192 Public method to convert a file path to a project relative |
3170 file path. |
3193 file path. |
3171 |
3194 |
3172 @param fn file or directory name to convert (string) |
3195 @param path file or directory name to convert (string) |
3173 @return project relative path or unchanged path, if fn doesn't |
3196 @return project relative path or unchanged path, if path doesn't |
3174 belong to the project (string) |
3197 belong to the project (string) |
3175 """ |
3198 """ |
3176 return fn.replace(self.ppath + os.sep, "") |
3199 if self.startswithProjectPath(path): |
3177 |
3200 return self.ppathRe.sub("", path, 1) |
3178 def getRelativeUniversalPath(self, fn): |
3201 else: |
|
3202 return path |
|
3203 |
|
3204 def getRelativeUniversalPath(self, path): |
3179 """ |
3205 """ |
3180 Public method to convert a file path to a project relative |
3206 Public method to convert a file path to a project relative |
3181 file path with universal separators. |
3207 file path with universal separators. |
3182 |
3208 |
3183 @param fn file or directory name to convert (string) |
3209 @param path file or directory name to convert (string) |
3184 @return project relative path or unchanged path, if fn doesn't |
3210 @return project relative path or unchanged path, if path doesn't |
3185 belong to the project (string) |
3211 belong to the project (string) |
3186 """ |
3212 """ |
3187 return Utilities.fromNativeSeparators(fn.replace(self.ppath + os.sep, "")) |
3213 return Utilities.fromNativeSeparators(self.getRelativePath(path)) |
3188 |
3214 |
3189 def getAbsoluteUniversalPath(self, fn): |
3215 def getAbsoluteUniversalPath(self, fn): |
3190 """ |
3216 """ |
3191 Public method to convert a project relative file path with universal |
3217 Public method to convert a project relative file path with universal |
3192 separators to an absolute file path. |
3218 separators to an absolute file path. |
3204 |
3230 |
3205 @param fn filename to be checked (string) |
3231 @param fn filename to be checked (string) |
3206 @return flag indicating membership (boolean) |
3232 @return flag indicating membership (boolean) |
3207 """ |
3233 """ |
3208 newfn = os.path.abspath(fn) |
3234 newfn = os.path.abspath(fn) |
3209 newfn = newfn.replace(self.ppath + os.sep, '') |
3235 newfn = self.getRelativePath(newfn) |
3210 if newfn in self.pdata["SOURCES"] or \ |
3236 if newfn in self.pdata["SOURCES"] or \ |
3211 newfn in self.pdata["FORMS"] or \ |
3237 newfn in self.pdata["FORMS"] or \ |
3212 newfn in self.pdata["INTERFACES"] or \ |
3238 newfn in self.pdata["INTERFACES"] or \ |
3213 newfn in self.pdata["RESOURCES"] or \ |
3239 newfn in self.pdata["RESOURCES"] or \ |
3214 newfn in self.pdata["TRANSLATIONS"] or \ |
3240 newfn in self.pdata["TRANSLATIONS"] or \ |
3227 |
3253 |
3228 @param fn filename to be checked (string) |
3254 @param fn filename to be checked (string) |
3229 @return flag indicating membership (boolean) |
3255 @return flag indicating membership (boolean) |
3230 """ |
3256 """ |
3231 newfn = os.path.abspath(fn) |
3257 newfn = os.path.abspath(fn) |
3232 newfn = newfn.replace(self.ppath + os.sep, '') |
3258 newfn = self.getRelativePath(newfn) |
3233 return newfn in self.pdata["SOURCES"] |
3259 return newfn in self.pdata["SOURCES"] |
3234 |
3260 |
3235 def isProjectForm(self, fn): |
3261 def isProjectForm(self, fn): |
3236 """ |
3262 """ |
3237 Public method used to check, if the passed in filename belongs to the project |
3263 Public method used to check, if the passed in filename belongs to the project |
3239 |
3265 |
3240 @param fn filename to be checked (string) |
3266 @param fn filename to be checked (string) |
3241 @return flag indicating membership (boolean) |
3267 @return flag indicating membership (boolean) |
3242 """ |
3268 """ |
3243 newfn = os.path.abspath(fn) |
3269 newfn = os.path.abspath(fn) |
3244 newfn = newfn.replace(self.ppath + os.sep, '') |
3270 newfn = self.getRelativePath(newfn) |
3245 return newfn in self.pdata["FORMS"] |
3271 return newfn in self.pdata["FORMS"] |
3246 |
3272 |
3247 def isProjectInterface(self, fn): |
3273 def isProjectInterface(self, fn): |
3248 """ |
3274 """ |
3249 Public method used to check, if the passed in filename belongs to the project |
3275 Public method used to check, if the passed in filename belongs to the project |
3251 |
3277 |
3252 @param fn filename to be checked (string) |
3278 @param fn filename to be checked (string) |
3253 @return flag indicating membership (boolean) |
3279 @return flag indicating membership (boolean) |
3254 """ |
3280 """ |
3255 newfn = os.path.abspath(fn) |
3281 newfn = os.path.abspath(fn) |
3256 newfn = newfn.replace(self.ppath + os.sep, '') |
3282 newfn = self.getRelativePath(newfn) |
3257 return newfn in self.pdata["INTERFACES"] |
3283 return newfn in self.pdata["INTERFACES"] |
3258 |
3284 |
3259 def isProjectResource(self, fn): |
3285 def isProjectResource(self, fn): |
3260 """ |
3286 """ |
3261 Public method used to check, if the passed in filename belongs to the project |
3287 Public method used to check, if the passed in filename belongs to the project |
3263 |
3289 |
3264 @param fn filename to be checked (string) |
3290 @param fn filename to be checked (string) |
3265 @return flag indicating membership (boolean) |
3291 @return flag indicating membership (boolean) |
3266 """ |
3292 """ |
3267 newfn = os.path.abspath(fn) |
3293 newfn = os.path.abspath(fn) |
3268 newfn = newfn.replace(self.ppath + os.sep, '') |
3294 newfn = self.getRelativePath(newfn) |
3269 return newfn in self.pdata["RESOURCES"] |
3295 return newfn in self.pdata["RESOURCES"] |
3270 |
3296 |
3271 def initActions(self): |
3297 def initActions(self): |
3272 """ |
3298 """ |
3273 Public slot to initialize the project related actions. |
3299 Public slot to initialize the project related actions. |
4037 @param fullname full name of the item to repopulate (string) |
4063 @param fullname full name of the item to repopulate (string) |
4038 """ |
4064 """ |
4039 if not self.isOpen(): |
4065 if not self.isOpen(): |
4040 return |
4066 return |
4041 |
4067 |
4042 name = fullname.replace(self.ppath + os.sep, "") |
4068 name = self.getRelativePath(fullname) |
4043 self.emit(SIGNAL("prepareRepopulateItem"), name) |
4069 self.emit(SIGNAL("prepareRepopulateItem"), name) |
4044 self.__model.repopulateItem(name) |
4070 self.__model.repopulateItem(name) |
4045 self.emit(SIGNAL("completeRepopulateItem"), name) |
4071 self.emit(SIGNAL("completeRepopulateItem"), name) |
4046 |
4072 |
4047 ############################################################## |
4073 ############################################################## |