eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/__init__.py

changeset 7505
7d3cfeeb5f4f
parent 7360
9190402e4505
child 7780
41420f82c0ac
equal deleted inserted replaced
7502:426f64d419f0 7505:7d3cfeeb5f4f
10 10
11 import os 11 import os
12 12
13 from PyQt5.QtCore import QCoreApplication 13 from PyQt5.QtCore import QCoreApplication
14 from PyQt5.QtGui import QIcon 14 from PyQt5.QtGui import QIcon
15
16 from E5Gui.E5Application import e5App
15 17
16 import UI.PixmapCache 18 import UI.PixmapCache
17 19
18 20
19 def supportedEngineNames(): 21 def supportedEngineNames():
105 @param name name of the translation engine 107 @param name name of the translation engine
106 @type str 108 @type str
107 @return engine icon 109 @return engine icon
108 @rtype QIcon 110 @rtype QIcon
109 """ 111 """
112 if e5App().usesDarkPalette():
113 iconSuffix = "dark"
114 else:
115 iconSuffix = "light"
110 if name in supportedEngineNames(): 116 if name in supportedEngineNames():
111 return UI.PixmapCache.getIcon(os.path.join( 117 icon = UI.PixmapCache.getIcon(os.path.join(
112 os.path.dirname(__file__), "..", "icons", "engines", 118 os.path.dirname(__file__), "..", "icons", "engines",
113 "{0}.png".format(name))) 119 "{0}-{1}".format(name, iconSuffix)))
120 if icon.isNull():
121 # try variant without suffix
122 icon = UI.PixmapCache.getIcon(os.path.join(
123 os.path.dirname(__file__), "..", "icons", "engines",
124 "{0}".format(name)))
125 return icon
114 else: 126 else:
115 return QIcon() 127 return QIcon()
116 128
117 129
118 def getKeyUrl(name): 130 def getKeyUrl(name):

eric ide

mercurial