Tue, 12 Nov 2024 18:01:04 +0100
Added a configuration entry on the Qt page to enter the path of the 'lrelease' program for that cases, where it cannot be detected automatically (e.g. due to different name).
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
10439
21c28b0f9e41
Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10428
diff
changeset
|
3 | # Copyright (c) 2012 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the Notifications configuration page. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
10 | from PyQt6.QtCore import QPoint, pyqtSlot |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
11 | from PyQt6.QtGui import QColor |
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
12 | from PyQt6.QtWidgets import QApplication, QColorDialog |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
14 | from eric7 import Preferences |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
15 | from eric7.UI.NotificationWidget import NotificationFrame, NotificationTypes |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
16 | |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | from .ConfigurationPageBase import ConfigurationPageBase |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | from .Ui_NotificationsPage import Ui_NotificationsPage |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | class NotificationsPage(ConfigurationPageBase, Ui_NotificationsPage): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | Class implementing the Notifications configuration page. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
25 | |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | def __init__(self): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | Constructor |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8205
diff
changeset
|
30 | super().__init__() |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | self.setupUi(self) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | self.setObjectName("NotificationsPage") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
33 | |
7952
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
34 | geom = QApplication.screens()[0].availableVirtualGeometry() |
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
35 | self.xSpinBox.setMinimum(geom.x()) |
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
36 | self.xSpinBox.setMaximum(geom.width()) |
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
37 | self.ySpinBox.setMinimum(geom.y()) |
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
38 | self.ySpinBox.setMaximum(geom.height()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
39 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
40 | self.warningIcon.setPixmap(NotificationFrame.getIcon(NotificationTypes.WARNING)) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
41 | self.criticalIcon.setPixmap( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
42 | NotificationFrame.getIcon(NotificationTypes.CRITICAL) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
43 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
44 | |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | self.__notification = None |
7945
76daafe10009
Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
46 | self.__firstTime = True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
47 | |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | # set initial values |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | self.timeoutSpinBox.setValue(Preferences.getUI("NotificationTimeout")) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | point = Preferences.getUI("NotificationPosition") |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | self.xSpinBox.setValue(point.x()) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | self.ySpinBox.setValue(point.y()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
53 | |
7952
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
54 | self.xSpinBox.valueChanged.connect(self.__moveNotification) |
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
55 | self.ySpinBox.valueChanged.connect(self.__moveNotification) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
56 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
57 | self.__colors = {} |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
58 | self.__colors["NotificationWarningForeground"] = Preferences.getUI( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
59 | "NotificationWarningForeground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
60 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
61 | self.__colors["NotificationWarningBackground"] = Preferences.getUI( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
62 | "NotificationWarningBackground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
63 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
64 | self.__colors["NotificationCriticalForeground"] = Preferences.getUI( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
65 | "NotificationCriticalForeground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
66 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
67 | self.__colors["NotificationCriticalBackground"] = Preferences.getUI( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | "NotificationCriticalBackground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
69 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
70 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
71 | self.warningFrame.setStyleSheet( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
72 | NotificationFrame.NotificationStyleSheetTemplate.format( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
73 | self.__colors["NotificationWarningForeground"], |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
74 | self.__colors["NotificationWarningBackground"], |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
75 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
76 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
77 | self.criticalFrame.setStyleSheet( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
78 | NotificationFrame.NotificationStyleSheetTemplate.format( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
79 | self.__colors["NotificationCriticalForeground"], |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
80 | self.__colors["NotificationCriticalBackground"], |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
81 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
82 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
83 | |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | def save(self): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | Public slot to save the Notifications configuration. |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | Preferences.setUI("NotificationTimeout", self.timeoutSpinBox.value()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
89 | Preferences.setUI( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
90 | "NotificationPosition", QPoint(self.xSpinBox.value(), self.ySpinBox.value()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
91 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
92 | |
8205
4a0f1f896341
Applied some code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7959
diff
changeset
|
93 | for key in self.__colors: |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
94 | Preferences.setUI(key, self.__colors[key]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
95 | |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | @pyqtSlot(bool) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | def on_visualButton_clicked(self, checked): |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | Private slot to select the position visually. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
100 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
101 | @param checked state of the button |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
102 | @type bool |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
104 | from eric7.UI.NotificationWidget import NotificationWidget |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
105 | |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | if checked: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
107 | self.__notification = NotificationWidget(parent=self, setPosition=True) |
7952
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
108 | self.__notification.showNotification( |
8265
0090cfa83159
Converted enum names to use all uppercase letters (except for E5PathPickerModes to keep plug-ins using this compatible with previous eric releases).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
109 | NotificationFrame.getIcon(NotificationTypes.OTHER), |
7952
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
110 | self.tr("Visual Selection"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
111 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
112 | "Drag the notification window to" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
113 | " the desired place and release the button." |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
114 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
115 | timeout=0, |
7952
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
116 | ) |
3010
befeff46ec0f
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2964
diff
changeset
|
117 | self.__notification.move( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
118 | QPoint(self.xSpinBox.value(), self.ySpinBox.value()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
119 | ) |
7945
76daafe10009
Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
120 | if self.__firstTime: |
76daafe10009
Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
121 | # adjust the maximum values to the width of the notification |
76daafe10009
Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
122 | self.xSpinBox.setMaximum( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
123 | self.xSpinBox.maximum() - self.__notification.width() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
124 | ) |
7945
76daafe10009
Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
125 | self.ySpinBox.setMaximum( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
126 | self.ySpinBox.maximum() - self.__notification.height() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
127 | ) |
7945
76daafe10009
Removed code dealing with Qt versions less than the required one and removed use of QDesktopWidget or QApplication.desktop().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
128 | self.__firstTime = False |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | else: |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | # retrieve the position |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | point = self.__notification.frameGeometry().topLeft() |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | self.xSpinBox.setValue(point.x()) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | self.ySpinBox.setValue(point.y()) |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | self.__notification.close() |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | self.__notification = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
136 | |
7952
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
137 | @pyqtSlot() |
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
138 | def __moveNotification(self): |
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
139 | """ |
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
140 | Private slot to move the notification widget. |
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
141 | """ |
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
142 | if self.visualButton.isChecked(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
143 | self.__notification.move(self.xSpinBox.value(), self.ySpinBox.value()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
144 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
145 | ################################################################## |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
146 | ## colors for warning notifications |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
147 | ################################################################## |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
148 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
149 | @pyqtSlot() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
150 | def on_warningFgButton_clicked(self): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
151 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
152 | Private slot to set the foreground color of the warning notifications. |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
153 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
154 | color = QColorDialog.getColor( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
155 | QColor(self.__colors["NotificationWarningForeground"]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
156 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
157 | if color.isValid(): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
158 | self.__colors["NotificationWarningForeground"] = color.name() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
159 | self.warningFrame.setStyleSheet( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
160 | NotificationFrame.NotificationStyleSheetTemplate.format( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
161 | self.__colors["NotificationWarningForeground"], |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
162 | self.__colors["NotificationWarningBackground"], |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
163 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
164 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
165 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
166 | @pyqtSlot() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
167 | def on_warningBgButton_clicked(self): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
168 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
169 | Private slot to set the background color of the warning notifications. |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
170 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
171 | color = QColorDialog.getColor( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
172 | QColor(self.__colors["NotificationWarningBackground"]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
173 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
174 | if color.isValid(): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
175 | self.__colors["NotificationWarningBackground"] = color.name() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
176 | self.warningFrame.setStyleSheet( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
177 | NotificationFrame.NotificationStyleSheetTemplate.format( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
178 | self.__colors["NotificationWarningForeground"], |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
179 | self.__colors["NotificationWarningBackground"], |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
180 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
181 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
182 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
183 | @pyqtSlot() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
184 | def on_warningResetButton_clicked(self): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
185 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
186 | Private slot to reset the colors for warning notifications to their |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
187 | current values. |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
188 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
189 | self.__colors["NotificationWarningForeground"] = Preferences.getUI( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
190 | "NotificationWarningForeground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
191 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
192 | self.__colors["NotificationWarningBackground"] = Preferences.getUI( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
193 | "NotificationWarningBackground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
194 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
195 | self.warningFrame.setStyleSheet( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
196 | NotificationFrame.NotificationStyleSheetTemplate.format( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
197 | self.__colors["NotificationWarningForeground"], |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
198 | self.__colors["NotificationWarningBackground"], |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
199 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
200 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
201 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
202 | @pyqtSlot() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
203 | def on_warningDefaultButton_clicked(self): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
204 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
205 | Private slot to reset the colors for warning notifications to their |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
206 | default values. |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
207 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
208 | self.__colors["NotificationWarningForeground"] = Preferences.Prefs.uiDefaults[ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
209 | "NotificationWarningForeground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
210 | ] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
211 | self.__colors["NotificationWarningBackground"] = Preferences.Prefs.uiDefaults[ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
212 | "NotificationWarningBackground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
213 | ] |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
214 | self.warningFrame.setStyleSheet( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
215 | NotificationFrame.NotificationStyleSheetTemplate.format( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
216 | self.__colors["NotificationWarningForeground"], |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
217 | self.__colors["NotificationWarningBackground"], |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
218 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
219 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
220 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
221 | ################################################################## |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
222 | ## colors for critical notifications |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
223 | ################################################################## |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
224 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
225 | @pyqtSlot() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
226 | def on_criticalFgButton_clicked(self): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
227 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
228 | Private slot to set the foreground color of the critical notifications. |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
229 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
230 | color = QColorDialog.getColor( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
231 | QColor(self.__colors["NotificationCriticalForeground"]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
232 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
233 | if color.isValid(): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
234 | self.__colors["NotificationCriticalForeground"] = color.name() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
235 | self.criticalFrame.setStyleSheet( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
236 | NotificationFrame.NotificationStyleSheetTemplate.format( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
237 | self.__colors["NotificationCriticalForeground"], |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
238 | self.__colors["NotificationCriticalBackground"], |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
239 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
240 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
241 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
242 | @pyqtSlot() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
243 | def on_criticalBgButton_clicked(self): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
244 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
245 | Private slot to set the background color of the critical notifications. |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
246 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
247 | color = QColorDialog.getColor( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
248 | QColor(self.__colors["NotificationCriticalBackground"]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
249 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
250 | if color.isValid(): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
251 | self.__colors["NotificationCriticalBackground"] = color.name() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
252 | self.criticalFrame.setStyleSheet( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
253 | NotificationFrame.NotificationStyleSheetTemplate.format( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
254 | self.__colors["NotificationCriticalForeground"], |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
255 | self.__colors["NotificationCriticalBackground"], |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
256 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
257 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
258 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
259 | @pyqtSlot() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
260 | def on_criticalResetButton_clicked(self): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
261 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
262 | Private slot to reset the colors for critical notifications to their |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
263 | current values. |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
264 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
265 | self.__colors["NotificationCriticalForeground"] = Preferences.getUI( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
266 | "NotificationCriticalForeground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
267 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
268 | self.__colors["NotificationCriticalBackground"] = Preferences.getUI( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
269 | "NotificationCriticalBackground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
270 | ) |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
271 | self.criticalFrame.setStyleSheet( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
272 | NotificationFrame.NotificationStyleSheetTemplate.format( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
273 | self.__colors["NotificationCriticalForeground"], |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
274 | self.__colors["NotificationCriticalBackground"], |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
275 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
276 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
277 | |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
278 | @pyqtSlot() |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
279 | def on_criticalDefaultButton_clicked(self): |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
280 | """ |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
281 | Private slot to reset the colors for critical notifications to their |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
282 | default values. |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
283 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
284 | self.__colors["NotificationCriticalForeground"] = Preferences.Prefs.uiDefaults[ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
285 | "NotificationCriticalForeground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
286 | ] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
287 | self.__colors["NotificationCriticalBackground"] = Preferences.Prefs.uiDefaults[ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
288 | "NotificationCriticalBackground" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
289 | ] |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
290 | self.criticalFrame.setStyleSheet( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
291 | NotificationFrame.NotificationStyleSheetTemplate.format( |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
292 | self.__colors["NotificationCriticalForeground"], |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
293 | self.__colors["NotificationCriticalBackground"], |
7959
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
294 | ) |
44e15eda6506
Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7955
diff
changeset
|
295 | ) |
7952
1849f61cf2b6
Changed the notification widget to be able to show multiple notification simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7945
diff
changeset
|
296 | |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
297 | |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
298 | def create(_dlg): |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
299 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
300 | Module function to create the configuration page. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
301 | |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
302 | @param _dlg reference to the configuration dialog (unused) |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
303 | @type ConfigurationDialog |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
304 | @return reference to the instantiated page |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
305 | @rtype ConfigurationPageBase |
2190
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
306 | """ |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
307 | page = NotificationsPage() |
abd65b78425e
Added a notification system and updated the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
308 | return page |