25 """ |
25 """ |
26 def __init__(self): |
26 def __init__(self): |
27 """ |
27 """ |
28 Constructor |
28 Constructor |
29 """ |
29 """ |
30 super(NotificationsPage, self).__init__() |
30 super().__init__() |
31 self.setupUi(self) |
31 self.setupUi(self) |
32 self.setObjectName("NotificationsPage") |
32 self.setObjectName("NotificationsPage") |
33 |
33 |
34 geom = QApplication.screens()[0].availableVirtualGeometry() |
34 geom = QApplication.screens()[0].availableVirtualGeometry() |
35 self.xSpinBox.setMinimum(geom.x()) |
35 self.xSpinBox.setMinimum(geom.x()) |
36 self.xSpinBox.setMaximum(geom.width()) |
36 self.xSpinBox.setMaximum(geom.width()) |
37 self.ySpinBox.setMinimum(geom.y()) |
37 self.ySpinBox.setMinimum(geom.y()) |
38 self.ySpinBox.setMaximum(geom.height()) |
38 self.ySpinBox.setMaximum(geom.height()) |
39 |
39 |
40 self.warningIcon.setPixmap( |
40 self.warningIcon.setPixmap( |
41 NotificationFrame.getIcon(NotificationTypes.Warning)) |
41 NotificationFrame.getIcon(NotificationTypes.WARNING)) |
42 self.criticalIcon.setPixmap( |
42 self.criticalIcon.setPixmap( |
43 NotificationFrame.getIcon(NotificationTypes.Critical)) |
43 NotificationFrame.getIcon(NotificationTypes.CRITICAL)) |
44 |
44 |
45 self.__notification = None |
45 self.__notification = None |
46 self.__firstTime = True |
46 self.__firstTime = True |
47 |
47 |
48 # set initial values |
48 # set initial values |
83 """ |
83 """ |
84 Preferences.setUI("NotificationTimeout", self.timeoutSpinBox.value()) |
84 Preferences.setUI("NotificationTimeout", self.timeoutSpinBox.value()) |
85 Preferences.setUI("NotificationPosition", QPoint( |
85 Preferences.setUI("NotificationPosition", QPoint( |
86 self.xSpinBox.value(), self.ySpinBox.value())) |
86 self.xSpinBox.value(), self.ySpinBox.value())) |
87 |
87 |
88 for key in self.__colors.keys(): |
88 for key in self.__colors: |
89 Preferences.setUI(key, self.__colors[key]) |
89 Preferences.setUI(key, self.__colors[key]) |
90 |
90 |
91 @pyqtSlot(bool) |
91 @pyqtSlot(bool) |
92 def on_visualButton_clicked(self, checked): |
92 def on_visualButton_clicked(self, checked): |
93 """ |
93 """ |
98 if checked: |
98 if checked: |
99 from UI.NotificationWidget import NotificationWidget |
99 from UI.NotificationWidget import NotificationWidget |
100 self.__notification = NotificationWidget( |
100 self.__notification = NotificationWidget( |
101 parent=self, setPosition=True) |
101 parent=self, setPosition=True) |
102 self.__notification.showNotification( |
102 self.__notification.showNotification( |
103 NotificationFrame.getIcon(NotificationTypes.Other), |
103 NotificationFrame.getIcon(NotificationTypes.OTHER), |
104 self.tr("Visual Selection"), |
104 self.tr("Visual Selection"), |
105 self.tr("Drag the notification window to" |
105 self.tr("Drag the notification window to" |
106 " the desired place and release the button."), |
106 " the desired place and release the button."), |
107 timeout=0 |
107 timeout=0 |
108 ) |
108 ) |