2822 Public method used to check, if the passed in filename belongs to the project. |
2822 Public method used to check, if the passed in filename belongs to the project. |
2823 |
2823 |
2824 @param fn filename to be checked (string) |
2824 @param fn filename to be checked (string) |
2825 @return flag indicating membership (boolean) |
2825 @return flag indicating membership (boolean) |
2826 """ |
2826 """ |
|
2827 for group in ["SOURCES", "FORMS", "INTERFACES", |
|
2828 "RESOURCES", "TRANSLATIONS", "OTHERS"]: |
|
2829 if self.__checkProjectFileGroup(fn, group): |
|
2830 return True |
|
2831 |
|
2832 return False |
|
2833 |
|
2834 def __checkProjectFileGroup(self, fn, group): |
|
2835 """ |
|
2836 Private method to check, if a file is in a specific file group of the project. |
|
2837 |
|
2838 @param fn filename to be checked (string) |
|
2839 @param group group to check (string) |
|
2840 @return flag indicating membership (boolean) |
|
2841 """ |
2827 newfn = os.path.abspath(fn) |
2842 newfn = os.path.abspath(fn) |
2828 newfn = self.getRelativePath(newfn) |
2843 newfn = self.getRelativePath(newfn) |
2829 if newfn in self.pdata["SOURCES"] or \ |
2844 if newfn in self.pdata[group]: |
2830 newfn in self.pdata["FORMS"] or \ |
|
2831 newfn in self.pdata["INTERFACES"] or \ |
|
2832 newfn in self.pdata["RESOURCES"] or \ |
|
2833 newfn in self.pdata["TRANSLATIONS"] or \ |
|
2834 newfn in self.pdata["OTHERS"]: |
|
2835 return True |
2845 return True |
2836 else: |
2846 elif group == "OTHERS": |
2837 for entry in self.pdata["OTHERS"]: |
2847 for entry in self.pdata[group]: |
2838 if newfn.startswith(entry): |
2848 if newfn.startswith(entry): |
2839 return True |
2849 return True |
2840 |
2850 |
2841 if Utilities.isWindowsPlatform(): |
2851 if Utilities.isWindowsPlatform(): |
2842 # try the above case-insensitive |
2852 # try the above case-insensitive |
2843 newfn = newfn.lower() |
2853 newfn = newfn.lower() |
2844 for group in ["SOURCES", "FORMS", "INTERFACES", |
2854 for entry in self.pdata[group]: |
2845 "RESOURCES", "TRANSLATIONS", "OTHERS"]: |
2855 if entry.lower() == newfn: |
2846 for entry in self.pdata[group]: |
2856 return True |
2847 if entry.lower() == newfn: |
2857 elif group == "OTHERS": |
2848 return True |
2858 for entry in self.pdata[group]: |
2849 for entry in self.pdata["OTHERS"]: |
|
2850 if newfn.startswith(entry.lower()): |
2859 if newfn.startswith(entry.lower()): |
2851 return True |
2860 return True |
2852 |
2861 |
2853 return False |
2862 return False |
2854 |
2863 |
2858 sources. |
2867 sources. |
2859 |
2868 |
2860 @param fn filename to be checked (string) |
2869 @param fn filename to be checked (string) |
2861 @return flag indicating membership (boolean) |
2870 @return flag indicating membership (boolean) |
2862 """ |
2871 """ |
2863 newfn = os.path.abspath(fn) |
2872 return self.__checkProjectFileGroup(fn, "SOURCES") |
2864 newfn = self.getRelativePath(newfn) |
|
2865 return newfn in self.pdata["SOURCES"] |
|
2866 |
2873 |
2867 def isProjectForm(self, fn): |
2874 def isProjectForm(self, fn): |
2868 """ |
2875 """ |
2869 Public method used to check, if the passed in filename belongs to the project |
2876 Public method used to check, if the passed in filename belongs to the project |
2870 forms. |
2877 forms. |
2871 |
2878 |
2872 @param fn filename to be checked (string) |
2879 @param fn filename to be checked (string) |
2873 @return flag indicating membership (boolean) |
2880 @return flag indicating membership (boolean) |
2874 """ |
2881 """ |
2875 newfn = os.path.abspath(fn) |
2882 return self.__checkProjectFileGroup(fn, "FORMS") |
2876 newfn = self.getRelativePath(newfn) |
|
2877 return newfn in self.pdata["FORMS"] |
|
2878 |
2883 |
2879 def isProjectInterface(self, fn): |
2884 def isProjectInterface(self, fn): |
2880 """ |
2885 """ |
2881 Public method used to check, if the passed in filename belongs to the project |
2886 Public method used to check, if the passed in filename belongs to the project |
2882 interfaces. |
2887 interfaces. |
2883 |
2888 |
2884 @param fn filename to be checked (string) |
2889 @param fn filename to be checked (string) |
2885 @return flag indicating membership (boolean) |
2890 @return flag indicating membership (boolean) |
2886 """ |
2891 """ |
2887 newfn = os.path.abspath(fn) |
2892 return self.__checkProjectFileGroup(fn, "INTERFACES") |
2888 newfn = self.getRelativePath(newfn) |
|
2889 return newfn in self.pdata["INTERFACES"] |
|
2890 |
2893 |
2891 def isProjectResource(self, fn): |
2894 def isProjectResource(self, fn): |
2892 """ |
2895 """ |
2893 Public method used to check, if the passed in filename belongs to the project |
2896 Public method used to check, if the passed in filename belongs to the project |
2894 resources. |
2897 resources. |
2895 |
2898 |
2896 @param fn filename to be checked (string) |
2899 @param fn filename to be checked (string) |
2897 @return flag indicating membership (boolean) |
2900 @return flag indicating membership (boolean) |
2898 """ |
2901 """ |
2899 newfn = os.path.abspath(fn) |
2902 return self.__checkProjectFileGroup(fn, "RESOURCES") |
2900 newfn = self.getRelativePath(newfn) |
|
2901 return newfn in self.pdata["RESOURCES"] |
|
2902 |
2903 |
2903 def initActions(self): |
2904 def initActions(self): |
2904 """ |
2905 """ |
2905 Public slot to initialize the project related actions. |
2906 Public slot to initialize the project related actions. |
2906 """ |
2907 """ |