eric6/Plugins/UiExtensionPlugins/Translator/Translator.py

changeset 7505
7d3cfeeb5f4f
parent 7360
9190402e4505
child 7513
d8354f4d3dc7
equal deleted inserted replaced
7502:426f64d419f0 7505:7d3cfeeb5f4f
20 20
21 class Translator(QObject): 21 class Translator(QObject):
22 """ 22 """
23 Class implementing the translator object. 23 Class implementing the translator object.
24 """ 24 """
25 def __init__(self, plugin, parent=None): 25 def __init__(self, plugin, usesDarkPalette, parent=None):
26 """ 26 """
27 Constructor 27 Constructor
28 28
29 @param plugin reference to the plugin object (TranslatorPlugin) 29 @param plugin reference to the plugin object (TranslatorPlugin)
30 @param parent parent (QObject) 30 @param parent parent (QObject)
33 33
34 self.__plugin = plugin 34 self.__plugin = plugin
35 self.__ui = parent 35 self.__ui = parent
36 36
37 self.__widget = None 37 self.__widget = None
38
39 if usesDarkPalette:
40 self.__iconSuffix = "dark"
41 else:
42 self.__iconSuffix = "light"
38 43
39 def activate(self): 44 def activate(self):
40 """ 45 """
41 Public method to activate the translator. 46 Public method to activate the translator.
42 """ 47 """
44 49
45 self.__widget = TranslatorWidget(self.__plugin, self) 50 self.__widget = TranslatorWidget(self.__plugin, self)
46 self.__ui.addSideWidget( 51 self.__ui.addSideWidget(
47 self.__ui.BottomSide, self.__widget, 52 self.__ui.BottomSide, self.__widget,
48 UI.PixmapCache.getIcon( 53 UI.PixmapCache.getIcon(
49 os.path.join(os.path.dirname(__file__), "icons", "flag.png")), 54 os.path.join(os.path.dirname(__file__), "icons",
55 "flag-{0}".format(self.__iconSuffix))),
50 self.tr("Translator")) 56 self.tr("Translator"))
51 57
52 self.__activateAct = E5Action( 58 self.__activateAct = E5Action(
53 self.tr('Translator'), 59 self.tr('Translator'),
54 self.tr('T&ranslator'), 60 self.tr('T&ranslator'),
83 89
84 @param name name of the icon file (string) 90 @param name name of the icon file (string)
85 @return icon (QIcon) 91 @return icon (QIcon)
86 """ 92 """
87 return UI.PixmapCache.getIcon(os.path.join( 93 return UI.PixmapCache.getIcon(os.path.join(
88 os.path.dirname(__file__), "icons", name)) 94 os.path.dirname(__file__), "icons",
95 "{0}-{1}".format(name, self.__iconSuffix)
96 ))
89 97
90 def __activateWidget(self): 98 def __activateWidget(self):
91 """ 99 """
92 Private slot to handle the activation of the project browser. 100 Private slot to handle the activation of the project browser.
93 """ 101 """

eric ide

mercurial