src/eric7/Plugins/UiExtensionPlugins/Translator/Translator.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
--- a/src/eric7/Plugins/UiExtensionPlugins/Translator/Translator.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/Plugins/UiExtensionPlugins/Translator/Translator.py	Wed Jul 13 14:55:47 2022 +0200
@@ -21,10 +21,11 @@
     """
     Class implementing the translator object.
     """
+
     def __init__(self, plugin, usesDarkPalette, parent=None):
         """
         Constructor
-        
+
         @param plugin reference to the plugin object
         @type TranslatorPlugin
         @param usesDarkPalette flag indicating that the platform uses a palette
@@ -34,77 +35,88 @@
         @type QObject
         """
         QObject.__init__(self, parent)
-        
+
         self.__plugin = plugin
         self.__ui = parent
-        
+
         self.__widget = None
-        
+
         if usesDarkPalette:
             self.__iconSuffix = "dark"
         else:
             self.__iconSuffix = "light"
-    
+
     def activate(self):
         """
         Public method to activate the translator.
         """
         from .TranslatorWidget import TranslatorWidget
-        
+
         self.__widget = TranslatorWidget(self.__plugin, self)
         iconName = (
             "sbTranslator96"
-            if self.__ui.getLayoutType() == "Sidebars" else
-            "flag-{0}".format(self.__iconSuffix)
+            if self.__ui.getLayoutType() == "Sidebars"
+            else "flag-{0}".format(self.__iconSuffix)
         )
         self.__ui.addSideWidget(
-            self.__ui.BottomSide, self.__widget,
+            self.__ui.BottomSide,
+            self.__widget,
             UI.PixmapCache.getIcon(
-                os.path.join(os.path.dirname(__file__), "icons", iconName)),
-            self.tr("Translator"))
-        
+                os.path.join(os.path.dirname(__file__), "icons", iconName)
+            ),
+            self.tr("Translator"),
+        )
+
         self.__activateAct = EricAction(
-            self.tr('Translator'),
-            self.tr('T&ranslator'),
+            self.tr("Translator"),
+            self.tr("T&ranslator"),
             QKeySequence(self.tr("Alt+Shift+R")),
-            0, self,
-            'translator_activate')
-        self.__activateAct.setStatusTip(self.tr(
-            "Switch the input focus to the Translator window."))
-        self.__activateAct.setWhatsThis(self.tr(
-            """<b>Activate Translator</b>"""
-            """<p>This switches the input focus to the Translator"""
-            """ window.</p>"""
-        ))
+            0,
+            self,
+            "translator_activate",
+        )
+        self.__activateAct.setStatusTip(
+            self.tr("Switch the input focus to the Translator window.")
+        )
+        self.__activateAct.setWhatsThis(
+            self.tr(
+                """<b>Activate Translator</b>"""
+                """<p>This switches the input focus to the Translator"""
+                """ window.</p>"""
+            )
+        )
         self.__activateAct.triggered.connect(self.__activateWidget)
-        
-        self.__ui.addEricActions([self.__activateAct], 'ui')
+
+        self.__ui.addEricActions([self.__activateAct], "ui")
         menu = self.__ui.getMenu("subwindow")
         menu.addAction(self.__activateAct)
-    
+
     def deactivate(self):
         """
         Public method to deactivate the time tracker.
         """
         menu = self.__ui.getMenu("subwindow")
         menu.removeAction(self.__activateAct)
-        self.__ui.removeEricActions([self.__activateAct], 'ui')
+        self.__ui.removeEricActions([self.__activateAct], "ui")
         self.__ui.removeSideWidget(self.__widget)
-    
+
     def getAppIcon(self, name):
         """
         Public method to get an icon.
-        
+
         @param name name of the icon file
         @type str
         @return icon
         @rtype QIcon
         """
-        return UI.PixmapCache.getIcon(os.path.join(
-            os.path.dirname(__file__), "icons",
-            "{0}-{1}".format(name, self.__iconSuffix)
-        ))
-    
+        return UI.PixmapCache.getIcon(
+            os.path.join(
+                os.path.dirname(__file__),
+                "icons",
+                "{0}-{1}".format(name, self.__iconSuffix),
+            )
+        )
+
     def __activateWidget(self):
         """
         Private slot to handle the activation of the project browser.

eric ide

mercurial