10 |
10 |
11 import os |
11 import os |
12 import sys |
12 import sys |
13 |
13 |
14 from PyQt5.QtCore import QTranslator, QLocale, QLibraryInfo, QDir |
14 from PyQt5.QtCore import QTranslator, QLocale, QLibraryInfo, QDir |
|
15 from PyQt5.QtGui import QPalette |
15 from PyQt5.QtWidgets import QApplication |
16 from PyQt5.QtWidgets import QApplication |
16 |
17 |
17 from E5Gui.E5Application import E5Application |
18 from E5Gui.E5Application import E5Application |
18 |
19 |
19 import Globals |
20 import Globals |
112 print("Warning: translation file '" + tn + "'could not be loaded.") |
113 print("Warning: translation file '" + tn + "'could not be loaded.") |
113 print("Using default.") |
114 print("Using default.") |
114 return (None, False) |
115 return (None, False) |
115 |
116 |
116 |
117 |
117 def initializeResourceSearchPath(): |
118 def initializeResourceSearchPath(application): |
118 """ |
119 """ |
119 Module function to initialize the default mime source factory. |
120 Module function to initialize the default mime source factory. |
|
121 |
|
122 @param application reference to the application objetc |
|
123 @type QGuiApplication |
120 """ |
124 """ |
121 import Preferences |
125 import Preferences |
122 |
126 |
|
127 palette = application.palette() |
|
128 lightness = palette.color(QPalette.Window).lightness() |
|
129 if lightness > 128: |
|
130 # light desktop |
|
131 iconPath = "breeze" |
|
132 else: |
|
133 # dark desktop |
|
134 iconPath = "breeze-dark" |
123 defaultIconPaths = [ |
135 defaultIconPaths = [ |
|
136 # add paths for vector graphics |
|
137 os.path.join(getConfig('ericIconDir'), iconPath), |
|
138 os.path.join(getConfig('ericIconDir'), iconPath, "languages"), |
|
139 # add old default pixel icons |
124 os.path.join(getConfig('ericIconDir'), "default"), |
140 os.path.join(getConfig('ericIconDir'), "default"), |
125 os.path.join(getConfig('ericIconDir'), "default", "languages"), |
141 os.path.join(getConfig('ericIconDir'), "default", "languages"), |
126 ] |
142 ] |
127 iconPaths = Preferences.getIcons("Path") |
143 iconPaths = Preferences.getIcons("Path") |
128 for iconPath in iconPaths: |
144 for iconPath in iconPaths: |
230 app.setQuitOnLastWindowClosed(quitOnLastWindowClosed) |
246 app.setQuitOnLastWindowClosed(quitOnLastWindowClosed) |
231 |
247 |
232 # the following code depends upon a valid application object |
248 # the following code depends upon a valid application object |
233 import Preferences |
249 import Preferences |
234 |
250 |
235 initializeResourceSearchPath() |
251 initializeResourceSearchPath(app) |
236 QApplication.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) |
252 QApplication.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) |
237 |
253 |
238 qtTransDir = Preferences.getQtTranslationsDir() |
254 qtTransDir = Preferences.getQtTranslationsDir() |
239 if not qtTransDir: |
255 if not qtTransDir: |
240 qtTransDir = QLibraryInfo.location(QLibraryInfo.TranslationsPath) |
256 qtTransDir = QLibraryInfo.location(QLibraryInfo.TranslationsPath) |