Fri, 24 Feb 2017 18:59:38 +0100
Added some code to clear out history information of projects, VCS plug-ins and untyped plug-ins, that implement a clearPrivateData() module function.
--- a/PluginManager/PluginManager.py Fri Feb 24 18:58:27 2017 +0100 +++ b/PluginManager/PluginManager.py Fri Feb 24 18:59:38 2017 +0100 @@ -1034,7 +1034,7 @@ pluginName in self.__onDemandActiveModules ########################################################################### - ## Specialized plugin module handling methods below + ## Specialized plug-in module handling methods below ########################################################################### ########################################################################### @@ -1297,6 +1297,30 @@ ignored = self.__sslErrorHandler.sslErrorsReply(reply, errors)[0] if ignored == E5SslErrorHandler.NotIgnored: self.__downloadCancelled = True + + ######################################################################## + ## Methods to clear private data of plug-ins below + ######################################################################## + + def clearPluginsPrivateData(self, type_): + """ + Public method to clear the private data of plug-ins of a specified + type. + + Plugins supporting this functionality must support the module function + clearPrivateData() and have the module level attribute pluginType. + + @param type_ type of the plugin to be activated (string) + """ + for name, module in \ + list(self.__onDemandActiveModules.items()) + \ + list(self.__onDemandInactiveModules.items()) + \ + list(self.__activeModules.items()) + \ + list(self.__inactiveModules.items()): + if getattr(module, "pluginType", "") == type_: + if hasattr(module, "clearPrivateData"): + module.clearPrivateData() + # TODO: document this in the plug-ins paper # # eflag: noqa = M801
--- a/Project/Project.py Fri Feb 24 18:58:27 2017 +0100 +++ b/Project/Project.py Fri Feb 24 18:59:38 2017 +0100 @@ -4193,7 +4193,17 @@ """ self.recent = [] self.__saveRecent() - + + def clearHistories(self): + """ + Public method to clear the project related histories. + """ + self.clearRecent() + + for key in ["DebugClientsHistory", "DebuggerInterpreterHistory"]: + Preferences.setProject(key, []) + Preferences.syncPreferences() + def __searchNewFiles(self): """ Private slot used to handle the search new files action.
--- a/UI/ClearPrivateDataDialog.py Fri Feb 24 18:58:27 2017 +0100 +++ b/UI/ClearPrivateDataDialog.py Fri Feb 24 18:59:38 2017 +0100 @@ -37,7 +37,7 @@ @return flags indicating which data to clear (recent files, recent projects, recent multi projects, - debug histories, shell histories) + debug histories, shell histories, VCS histories) @rtype tuple of bool """ return ( @@ -46,4 +46,6 @@ self.multiProjectsCheckBox.isChecked(), self.debugCheckBox.isChecked(), self.shellCheckBox.isChecked(), + self.vcsCheckBox.isChecked(), + self.pluginsCheckBox.isChecked(), )
--- a/UI/ClearPrivateDataDialog.ui Fri Feb 24 18:58:27 2017 +0100 +++ b/UI/ClearPrivateDataDialog.ui Fri Feb 24 18:59:38 2017 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>400</width> - <height>196</height> + <height>211</height> </rect> </property> <property name="windowTitle"> @@ -33,10 +33,10 @@ <item> <widget class="QCheckBox" name="projectsCheckBox"> <property name="toolTip"> - <string>Select to clear the list of recently opened projects</string> + <string>Select to clear the list of recently opened projects and project related histories</string> </property> <property name="text"> - <string>Recently opened projects</string> + <string>Recently opened projects and project histories</string> </property> <property name="checked"> <bool>true</bool> @@ -83,6 +83,39 @@ </widget> </item> <item> + <widget class="QCheckBox" name="vcsCheckBox"> + <property name="toolTip"> + <string>Select to clear the VCS related histories</string> + </property> + <property name="text"> + <string>Version Control System histories</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="pluginsCheckBox"> + <property name="toolTip"> + <string>Select to clear the private data of plug-ins not covered above</string> + </property> + <property name="text"> + <string>Plug-in private data</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum>
--- a/UI/UserInterface.py Fri Feb 24 18:58:27 2017 +0100 +++ b/UI/UserInterface.py Fri Feb 24 18:59:38 2017 +0100 @@ -5669,13 +5669,14 @@ if dlg.exec_() == QDialog.Accepted: # recent files, recent projects, recent multi projects, # debug histories, shell histories - (files, projects, multiProjects, debug, shell) = dlg.getData() + (files, projects, multiProjects, debug, shell, vcs, plugins) = \ + dlg.getData() if files: # clear list of recently opened files self.viewmanager.clearRecent() if projects: - # clear list of recently opened projects - self.project.clearRecent() + # clear list of recently opened projects and other histories + self.project.clearHistories() if multiProjects: # clear list of recently opened multi projects self.multiProject.clearRecent() @@ -5685,7 +5686,15 @@ if shell: # clear the shell histories self.shell.clearAllHistories() - + if vcs: + # clear the VCS related histories + self.pluginManager.clearPluginsPrivateData("version_control") + if plugins: + # clear private data of plug-ins not covered above + self.pluginManager.clearPluginsPrivateData("") + + Preferences.syncPreferences() + def __newProject(self): """ Private slot to handle the NewProject signal.