src/eric7/Plugins/PluginVcsPySvn.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9278
36448ca469c2
--- a/src/eric7/Plugins/PluginVcsPySvn.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/Plugins/PluginVcsPySvn.py	Wed Jul 13 14:55:47 2022 +0200
@@ -31,9 +31,7 @@
 className = "VcsPySvnPlugin"
 packageName = "__core__"
 shortDescription = "Implements the PySvn version control interface."
-longDescription = (
-    """This plugin provides the PySvn version control interface."""
-)
+longDescription = """This plugin provides the PySvn version control interface."""
 pyqtApi = 2
 # End-Of-Header
 
@@ -43,11 +41,12 @@
 def exeDisplayData():
     """
     Public method to support the display of some executable info.
-    
+
     @return dictionary containing the data to be shown
     """
     try:
         import pysvn
+
         try:
             text = os.path.dirname(pysvn.__file__)
         except AttributeError:
@@ -56,22 +55,23 @@
     except ImportError:
         text = "PySvn"
         version = ""
-    
+
     data = {
         "programEntry": False,
         "header": QCoreApplication.translate(
-            "VcsPySvnPlugin", "Version Control - Subversion (pysvn)"),
+            "VcsPySvnPlugin", "Version Control - Subversion (pysvn)"
+        ),
         "text": text,
         "version": version,
     }
-    
+
     return data
 
 
 def getVcsSystemIndicator():
     """
     Public function to get the indicators for this version control system.
-    
+
     @return dictionary with indicator as key and a tuple with the vcs name
         (string) and vcs display string (string)
     """
@@ -85,49 +85,53 @@
 def displayString():
     """
     Public function to get the display string.
-    
+
     @return display string (string)
     """
     try:
-        import pysvn        # __IGNORE_WARNING__
-        return QCoreApplication.translate('VcsPySvnPlugin',
-                                          'Subversion (pysvn)')
+        import pysvn  # __IGNORE_WARNING__
+
+        return QCoreApplication.translate("VcsPySvnPlugin", "Subversion (pysvn)")
     except ImportError:
         return ""
 
+
 subversionCfgPluginObject = None
 
 
 def createConfigurationPage(configDlg):
     """
     Module function to create the configuration page.
-    
+
     @param configDlg reference to the configuration dialog (QDialog)
     @return reference to the configuration page
     """
     global subversionCfgPluginObject
-    from VcsPlugins.vcsPySvn.ConfigurationPage.SubversionPage import (
-        SubversionPage
-    )
+    from VcsPlugins.vcsPySvn.ConfigurationPage.SubversionPage import SubversionPage
+
     if subversionCfgPluginObject is None:
         subversionCfgPluginObject = VcsPySvnPlugin(None)
     page = SubversionPage(subversionCfgPluginObject)
     return page
-    
+
 
 def getConfigData():
     """
     Module function returning data as required by the configuration dialog.
-    
+
     @return dictionary with key "zzz_subversionPage" containing the relevant
     data
     """
     return {
-        "zzz_subversionPage":
-        [QCoreApplication.translate("VcsPySvnPlugin", "Subversion"),
-         os.path.join("VcsPlugins", "vcsPySvn", "icons",
-                      "preferences-subversion.svg"),
-         createConfigurationPage, "vcsPage", None],
+        "zzz_subversionPage": [
+            QCoreApplication.translate("VcsPySvnPlugin", "Subversion"),
+            os.path.join(
+                "VcsPlugins", "vcsPySvn", "icons", "preferences-subversion.svg"
+            ),
+            createConfigurationPage,
+            "vcsPage",
+            None,
+        ],
     }
 
 
@@ -135,40 +139,42 @@
     """
     Module function to prepare for an uninstallation.
     """
-    if not ericApp().getObject("PluginManager").isPluginLoaded(
-            "PluginVcsSubversion"):
+    if not ericApp().getObject("PluginManager").isPluginLoaded("PluginVcsSubversion"):
         Preferences.getSettings().remove("Subversion")
-    
+
 
 class VcsPySvnPlugin(QObject):
     """
     Class implementing the PySvn version control plugin.
     """
+
     def __init__(self, ui):
         """
         Constructor
-        
+
         @param ui reference to the user interface object (UI.UserInterface)
         """
         super().__init__(ui)
         self.__ui = ui
-        
+
         self.__subversionDefaults = {
             "StopLogOnCopy": 1,
             "LogLimit": 20,
         }
-        
+
         from VcsPlugins.vcsPySvn.ProjectHelper import PySvnProjectHelper
+
         self.__projectHelperObject = PySvnProjectHelper(None, None)
         with contextlib.suppress(KeyError):
             ericApp().registerPluginObject(
-                pluginTypename, self.__projectHelperObject, pluginType)
+                pluginTypename, self.__projectHelperObject, pluginType
+            )
         readShortcuts(pluginName=pluginTypename)
-    
+
     def getProjectHelper(self):
         """
         Public method to get a reference to the project helper object.
-        
+
         @return reference to the project helper object
         """
         return self.__projectHelperObject
@@ -176,104 +182,112 @@
     def initToolbar(self, ui, toolbarManager):
         """
         Public slot to initialize the VCS toolbar.
-        
+
         @param ui reference to the main window (UserInterface)
         @param toolbarManager reference to a toolbar manager object
             (EricToolBarManager)
         """
         if self.__projectHelperObject:
             self.__projectHelperObject.initToolbar(ui, toolbarManager)
-    
+
     def activate(self):
         """
         Public method to activate this plugin.
-        
+
         @return tuple of reference to instantiated viewmanager and
             activation status (boolean)
         """
         from VcsPlugins.vcsPySvn.subversion import Subversion
+
         self.__object = Subversion(self, self.__ui)
-        
+
         tb = self.__ui.getToolbar("vcs")[1]
         tb.setVisible(False)
         tb.setEnabled(False)
-        
+
         tb = self.__ui.getToolbar("pysvn")[1]
         tb.setVisible(Preferences.getVCS("ShowVcsToolbar"))
         tb.setEnabled(True)
-        
+
         return self.__object, True
-    
+
     def deactivate(self):
         """
         Public method to deactivate this plugin.
         """
         self.__object = None
-        
+
         tb = self.__ui.getToolbar("pysvn")[1]
         tb.setVisible(False)
         tb.setEnabled(False)
-        
+
         tb = self.__ui.getToolbar("vcs")[1]
         tb.setVisible(Preferences.getVCS("ShowVcsToolbar"))
         tb.setEnabled(True)
-    
+
     def getPreferences(self, key):
         """
         Public method to retrieve the various settings.
-        
+
         @param key the key of the value to get
         @return the requested refactoring setting
         """
         if key in ["StopLogOnCopy"]:
-            return Preferences.toBool(Preferences.getSettings().value(
-                "Subversion/" + key, self.__subversionDefaults[key]))
+            return Preferences.toBool(
+                Preferences.getSettings().value(
+                    "Subversion/" + key, self.__subversionDefaults[key]
+                )
+            )
         elif key in ["LogLimit"]:
-            return int(Preferences.getSettings().value(
-                "Subversion/" + key,
-                self.__subversionDefaults[key]))
+            return int(
+                Preferences.getSettings().value(
+                    "Subversion/" + key, self.__subversionDefaults[key]
+                )
+            )
         elif key in ["Commits"]:
-            return Preferences.toList(Preferences.getSettings().value(
-                "Subversion/" + key))
+            return Preferences.toList(
+                Preferences.getSettings().value("Subversion/" + key)
+            )
         else:
             return Preferences.getSettings().value("Subversion/" + key)
-    
+
     def setPreferences(self, key, value):
         """
         Public method to store the various settings.
-        
+
         @param key the key of the setting to be set
         @param value the value to be set
         """
         Preferences.getSettings().setValue("Subversion/" + key, value)
-    
+
     def getServersPath(self):
         """
         Public method to get the filename of the servers file.
-        
+
         @return filename of the servers file (string)
         """
         return getServersPath()
-    
+
     def getConfigPath(self):
         """
         Public method to get the filename of the config file.
-        
+
         @return filename of the config file (string)
         """
         return getConfigPath()
-    
+
     def prepareUninstall(self):
         """
         Public method to prepare for an uninstallation.
         """
         ericApp().unregisterPluginObject(pluginTypename)
-    
+
     def prepareUnload(self):
         """
         Public method to prepare for an unload.
         """
         if self.__projectHelperObject:
             self.__projectHelperObject.removeToolbar(
-                self.__ui, ericApp().getObject("ToolbarManager"))
+                self.__ui, ericApp().getObject("ToolbarManager")
+            )
         ericApp().unregisterPluginObject(pluginTypename)

eric ide

mercurial