Preferences/ConfigurationPages/NotificationsPage.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3010
befeff46ec0f
child 3145
a9de05d4a22f
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
24 Class implementing the Notifications configuration page. 24 Class implementing the Notifications configuration page.
25 """ 25 """
26 def __init__(self): 26 def __init__(self):
27 """ 27 """
28 Constructor 28 Constructor
29
30 @param parent reference to the parent widget (QWidget)
31 """ 29 """
32 super(NotificationsPage, self).__init__() 30 super(NotificationsPage, self).__init__()
33 self.setupUi(self) 31 self.setupUi(self)
34 self.setObjectName("NotificationsPage") 32 self.setObjectName("NotificationsPage")
35 33
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())
93 def create(dlg): 97 def create(dlg):
94 """ 98 """
95 Module function to create the configuration page. 99 Module function to create the configuration page.
96 100
97 @param dlg reference to the configuration dialog 101 @param dlg reference to the configuration dialog
102 @return reference to the instantiated page (ConfigurationPageBase)
98 """ 103 """
99 page = NotificationsPage() 104 page = NotificationsPage()
100 return page 105 return page

eric ide

mercurial