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 sys |
12 |
13 |
13 from PyQt6.QtCore import QCoreApplication, Qt |
14 from PyQt6.QtCore import QCoreApplication, Qt |
14 from PyQt6.QtGui import QColor, QPalette |
15 from PyQt6.QtGui import QColor, QPalette |
15 from PyQt6.QtWidgets import QApplication |
16 from PyQt6.QtWidgets import QApplication |
16 |
17 |
43 "highlighted-text": QPalette.ColorRole.HighlightedText, |
44 "highlighted-text": QPalette.ColorRole.HighlightedText, |
44 "link": QPalette.ColorRole.Link, |
45 "link": QPalette.ColorRole.Link, |
45 "link-visited": QPalette.ColorRole.LinkVisited, |
46 "link-visited": QPalette.ColorRole.LinkVisited, |
46 } |
47 } |
47 |
48 |
48 def __init__(self, argv): |
49 def __init__(self, args): |
49 """ |
50 """ |
50 Constructor |
51 Constructor |
51 |
52 |
52 @param argv command line arguments |
53 @param args namespace object containing the parsed command line parameters |
53 @type list |
54 @type argparse.Namespace |
54 """ |
55 """ |
55 super().__init__(argv) |
56 super().__init__(sys.argv) |
56 |
57 |
57 QCoreApplication.setAttribute( |
58 QCoreApplication.setAttribute( |
58 Qt.ApplicationAttribute.AA_DontCreateNativeWidgetSiblings, True |
59 Qt.ApplicationAttribute.AA_DontCreateNativeWidgetSiblings, True |
59 ) |
60 ) |
60 |
61 |
61 self.__objectRegistry = {} |
62 self.__objectRegistry = {} |
62 self.__pluginObjectRegistry = {} |
63 self.__pluginObjectRegistry = {} |
63 |
64 |
64 self.__smallScreen = False |
65 try: |
65 if "--small-screen" in argv: |
66 self.__smallScreen = args.small_screen |
66 self.__smallScreen = True |
67 except AttributeError: |
67 argv.remove("--small-screen") |
68 self.__smallScreen = False |
68 if not self.__smallScreen: |
69 if not self.__smallScreen: |
69 primaryScreenSize = self.primaryScreen().size() |
70 primaryScreenSize = self.primaryScreen().size() |
70 self.__smallScreen = ( |
71 self.__smallScreen = ( |
71 primaryScreenSize.width() < 1920 or primaryScreenSize.height() < 1080 |
72 primaryScreenSize.width() < 1920 or primaryScreenSize.height() < 1080 |
72 ) |
73 ) |