44 self.ySpinBox.setMaximum(maxY) |
44 self.ySpinBox.setMaximum(maxY) |
45 |
45 |
46 self.__notification = None |
46 self.__notification = None |
47 |
47 |
48 # set initial values |
48 # set initial values |
49 self.enableCheckBox.setChecked(Preferences.getUI("NotificationsEnabled")) |
49 self.enableCheckBox.setChecked( |
|
50 Preferences.getUI("NotificationsEnabled")) |
50 self.timeoutSpinBox.setValue(Preferences.getUI("NotificationTimeout")) |
51 self.timeoutSpinBox.setValue(Preferences.getUI("NotificationTimeout")) |
51 point = Preferences.getUI("NotificationPosition") |
52 point = Preferences.getUI("NotificationPosition") |
52 self.xSpinBox.setValue(point.x()) |
53 self.xSpinBox.setValue(point.x()) |
53 self.ySpinBox.setValue(point.y()) |
54 self.ySpinBox.setValue(point.y()) |
54 |
55 |
55 def save(self): |
56 def save(self): |
56 """ |
57 """ |
57 Public slot to save the Notifications configuration. |
58 Public slot to save the Notifications configuration. |
58 """ |
59 """ |
59 Preferences.setUI("NotificationsEnabled", self.enableCheckBox.isChecked()) |
60 Preferences.setUI( |
|
61 "NotificationsEnabled", self.enableCheckBox.isChecked()) |
60 Preferences.setUI("NotificationTimeout", self.timeoutSpinBox.value()) |
62 Preferences.setUI("NotificationTimeout", self.timeoutSpinBox.value()) |
61 Preferences.setUI("NotificationPosition", QPoint( |
63 Preferences.setUI("NotificationPosition", QPoint( |
62 self.xSpinBox.value(), self.ySpinBox.value())) |
64 self.xSpinBox.value(), self.ySpinBox.value())) |
63 |
65 |
64 @pyqtSlot(bool) |
66 @pyqtSlot(bool) |
68 |
70 |
69 @param checked state of the button (boolean) |
71 @param checked state of the button (boolean) |
70 """ |
72 """ |
71 if checked: |
73 if checked: |
72 from UI.NotificationWidget import NotificationWidget |
74 from UI.NotificationWidget import NotificationWidget |
73 self.__notification = NotificationWidget(parent=self, setPosition=True) |
75 self.__notification = NotificationWidget( |
74 self.__notification.setPixmap(UI.PixmapCache.getPixmap("notification48.png")) |
76 parent=self, setPosition=True) |
|
77 self.__notification.setPixmap( |
|
78 UI.PixmapCache.getPixmap("notification48.png")) |
75 self.__notification.setHeading(self.trUtf8("Visual Selection")) |
79 self.__notification.setHeading(self.trUtf8("Visual Selection")) |
76 self.__notification.setText(self.trUtf8("Drag the notification window to" |
80 self.__notification.setText( |
77 " the desired place and release the button.")) |
81 self.trUtf8("Drag the notification window to" |
78 self.__notification.move(QPoint(self.xSpinBox.value(), self.ySpinBox.value())) |
82 " the desired place and release the button.")) |
|
83 self.__notification.move( |
|
84 QPoint(self.xSpinBox.value(), self.ySpinBox.value())) |
79 self.__notification.show() |
85 self.__notification.show() |
80 else: |
86 else: |
81 # retrieve the position |
87 # retrieve the position |
82 point = self.__notification.frameGeometry().topLeft() |
88 point = self.__notification.frameGeometry().topLeft() |
83 self.xSpinBox.setValue(point.x()) |
89 self.xSpinBox.setValue(point.x()) |