Sat, 11 Apr 2015 14:03:40 +0200
Added functionality to reorganize the files automatically, when the project type or file type associations are changed.
--- a/APIs/Python3/eric6.api Fri Apr 10 19:16:57 2015 +0200 +++ b/APIs/Python3/eric6.api Sat Apr 11 14:03:40 2015 +0200 @@ -3981,6 +3981,7 @@ eric6.Plugins.CheckerPlugins.CodeStyleChecker.translations._messages?8 eric6.Plugins.CheckerPlugins.CodeStyleChecker.translations._messages_sample_args?8 eric6.Plugins.CheckerPlugins.CodeStyleChecker.translations.getTranslatedMessage?4(message) +eric6.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck.VcsConflictMarkerRe?7 eric6.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck.extractLineFlags?4(line, startComment=") eric6.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck.initService?4() eric6.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck.normalizeCode?4(codestring)
--- a/Documentation/Help/source.qhp Fri Apr 10 19:16:57 2015 +0200 +++ b/Documentation/Help/source.qhp Sat Apr 11 14:03:40 2015 +0200 @@ -8790,6 +8790,7 @@ <keyword name="Project.__readSession" id="Project.__readSession" ref="eric6.Project.Project.html#Project.__readSession" /> <keyword name="Project.__readTasks" id="Project.__readTasks" ref="eric6.Project.Project.html#Project.__readTasks" /> <keyword name="Project.__readUserProperties" id="Project.__readUserProperties" ref="eric6.Project.Project.html#Project.__readUserProperties" /> + <keyword name="Project.__reorganizeFiles" id="Project.__reorganizeFiles" ref="eric6.Project.Project.html#Project.__reorganizeFiles" /> <keyword name="Project.__saveRecent" id="Project.__saveRecent" ref="eric6.Project.Project.html#Project.__saveRecent" /> <keyword name="Project.__searchNewFiles" id="Project.__searchNewFiles" ref="eric6.Project.Project.html#Project.__searchNewFiles" /> <keyword name="Project.__showCodeCoverage" id="Project.__showCodeCoverage" ref="eric6.Project.Project.html#Project.__showCodeCoverage" />
--- a/Documentation/Source/eric6.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck.html Fri Apr 10 19:16:57 2015 +0200 +++ b/Documentation/Source/eric6.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck.html Sat Apr 11 14:03:40 2015 +0200 @@ -25,7 +25,7 @@ </p> <h3>Global Attributes</h3> <table> -<tr><td>None</td></tr> +<tr><td>VcsConflictMarkerRe</td></tr> </table> <h3>Classes</h3> <table>
--- a/Documentation/Source/eric6.Project.Project.html Fri Apr 10 19:16:57 2015 +0200 +++ b/Documentation/Source/eric6.Project.Project.html Sat Apr 11 14:03:40 2015 +0200 @@ -260,6 +260,9 @@ <td><a href="#Project.__readUserProperties">__readUserProperties</a></td> <td>Private method to read in the user specific project file (.e4q).</td> </tr><tr> +<td><a href="#Project.__reorganizeFiles">__reorganizeFiles</a></td> +<td>Private method to reorganize files stored in the project.</td> +</tr><tr> <td><a href="#Project.__saveRecent">__saveRecent</a></td> <td>Private method to save the list of recently opened filenames.</td> </tr><tr> @@ -976,6 +979,11 @@ <b>__readUserProperties</b>(<i></i>) <p> Private method to read in the user specific project file (.e4q). +</p><a NAME="Project.__reorganizeFiles" ID="Project.__reorganizeFiles"></a> +<h4>Project.__reorganizeFiles</h4> +<b>__reorganizeFiles</b>(<i></i>) +<p> + Private method to reorganize files stored in the project. </p><a NAME="Project.__saveRecent" ID="Project.__saveRecent"></a> <h4>Project.__saveRecent</h4> <b>__saveRecent</b>(<i></i>)
--- a/Project/Project.py Fri Apr 10 19:16:57 2015 +0200 +++ b/Project/Project.py Sat Apr 11 14:03:40 2015 +0200 @@ -1856,6 +1856,45 @@ filelist.append(os.path.join(self.ppath, entry)) return filelist + def __reorganizeFiles(self): + """ + Private method to reorganize files stored in the project. + """ + reorganized = False + + # init data store for the reorganization + newPdata = {} + for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", "OTHERS", + "TRANSLATIONS"]: + newPdata[key] = [] + + # iterate over all files checking for a reassignment + for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", "OTHERS", + "TRANSLATIONS"]: + for fn in self.pdata[key][:]: + filetype = key + bfn = os.path.basename(fn) + for pattern in reversed( + sorted(self.pdata["FILETYPES"].keys())): + if fnmatch.fnmatch(bfn, pattern): + filetype = self.pdata["FILETYPES"][pattern] + break + + if filetype != "__IGNORE__": + newPdata[filetype].append(fn) + if filetype != key: + reorganized = True + + if reorganized: + # copy the reorganized files back to the project + for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", + "OTHERS", "TRANSLATIONS"]: + self.pdata[key] = newPdata[key][:] + + # repopulate the model + self.__model.projectClosed() + self.__model.projectOpened() + def copyDirectory(self, olddn, newdn): """ Public slot to copy a directory. @@ -2471,6 +2510,9 @@ self.__model.projectPropertiesChanged() self.projectPropertiesChanged.emit() + + if self.pdata["PROJECTTYPE"][0] != projectType: + self.__reorganizeFiles() def __showUserProperties(self): """ @@ -2526,6 +2568,7 @@ if dlg.exec_() == QDialog.Accepted: dlg.transferData() self.setDirty(True) + self.__reorganizeFiles() def __showLexerAssociations(self): """
--- a/changelog Fri Apr 10 19:16:57 2015 +0200 +++ b/changelog Sat Apr 11 14:03:40 2015 +0200 @@ -16,6 +16,9 @@ -- added a message filter including a configuration page - Previewers -- added capability to use 'Sphinx' to preview ReST files +- Project + -- added functionality to reorganize the files automatically, + when the project type or file type associations are changed - Project Browser -- added capability to show imports of a Python script - Task Viewer