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