7 Class implementing a specialized application class. |
7 Class implementing a specialized application class. |
8 """ |
8 """ |
9 |
9 |
10 import contextlib |
10 import contextlib |
11 import os |
11 import os |
|
12 import pathlib |
12 import sys |
13 import sys |
13 |
14 |
14 from PyQt6.QtCore import QCoreApplication, Qt |
15 from PyQt6.QtCore import QCoreApplication, Qt |
15 from PyQt6.QtGui import QColor, QPalette |
16 from PyQt6.QtGui import QColor, QPalette |
16 from PyQt6.QtWidgets import QApplication |
17 from PyQt6.QtWidgets import QApplication |
17 |
18 |
18 if not QCoreApplication.testAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts): |
19 if not QCoreApplication.testAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts): |
19 QCoreApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts, True) |
20 QCoreApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts, True) |
20 |
|
21 from eric7.SystemUtilities import FileSystemUtilities |
|
22 |
21 |
23 from . import EricMessageBox |
22 from . import EricMessageBox |
24 |
23 |
25 |
24 |
26 class EricApplication(QApplication): |
25 class EricApplication(QApplication): |
202 # default is the 'StyleIcons' sub-directory of the icons |
201 # default is the 'StyleIcons' sub-directory of the icons |
203 # directory |
202 # directory |
204 styleIconsPath = os.path.join(getConfig("ericIconDir"), "StyleIcons") |
203 styleIconsPath = os.path.join(getConfig("ericIconDir"), "StyleIcons") |
205 |
204 |
206 if universal: |
205 if universal: |
207 return FileSystemUtilities.fromNativeSeparators(styleIconsPath) |
206 return ( |
|
207 pathlib.PurePath(styleIconsPath).as_posix() |
|
208 if bool(styleIconsPath) |
|
209 else "" |
|
210 ) |
208 else: |
211 else: |
209 return styleIconsPath |
212 return styleIconsPath |
210 |
213 |
211 def setStyleSheetFile(self, filename): |
214 def setStyleSheetFile(self, filename): |
212 """ |
215 """ |