annotate PreferencesDialog.py @ 63:b8d209fdad14

helper class to create Feed objects from an OPML feed
author dirk@xanthippe.ping.de
date Wed, 28 Jul 2010 21:14:34 +0200
parents db35ab7753f0
children e8c2730eb444
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
1
43
12ed8b5fa08c first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 42
diff changeset
2 from Preferences import Preferences
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
3 from PyQt4 import QtGui
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
4 from Ui_Preferences import Ui_Preferences
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
5
42
0c0d1760b737 Rename Preferences to PreferencesDialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 41
diff changeset
6 class PreferencesDialog(QtGui.QDialog):
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
7 def __init__(self, session=None):
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
8 QtGui.QWidget.__init__(self, None)
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
9 self.session = session
43
12ed8b5fa08c first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 42
diff changeset
10 self.preferences = Preferences(session)
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
11 self.ui = Ui_Preferences()
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
12 self.ui.setupUi(self)
42
0c0d1760b737 Rename Preferences to PreferencesDialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 41
diff changeset
13 self.fillUi()
0c0d1760b737 Rename Preferences to PreferencesDialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 41
diff changeset
14
0c0d1760b737 Rename Preferences to PreferencesDialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 41
diff changeset
15 def fillUi(self):
43
12ed8b5fa08c first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 42
diff changeset
16 maximized = self.preferences.startMaximized()
12ed8b5fa08c first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 42
diff changeset
17 self.ui.startMaximized.setChecked(maximized)
61
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
18
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
19 hideRead = self.preferences.hideReadFeedEntries()
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
20 self.ui.hideReadFeedEntries.setChecked(hideRead)
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
21
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
22 def startMaximizedChanged(self, change):
46
03358c113170 Better preferences handling: the GUI's responsibility is to convert the input from the event into a boolean value
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 44
diff changeset
23 if change:
03358c113170 Better preferences handling: the GUI's responsibility is to convert the input from the event into a boolean value
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 44
diff changeset
24 self.preferences.setStartMaximized(True)
03358c113170 Better preferences handling: the GUI's responsibility is to convert the input from the event into a boolean value
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 44
diff changeset
25 else:
03358c113170 Better preferences handling: the GUI's responsibility is to convert the input from the event into a boolean value
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 44
diff changeset
26 self.preferences.setStartMaximized(False)
41
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
27
61
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
28 def hideReadFeedEntriesChanged(self, change):
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
29 if change:
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
30 self.preferences.setHideReadFeedEntries(True)
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
31 else:
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
32 self.preferences.setHideReadFeedEntries(False)
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
33
41
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
34 def accept(self):
44
be990ac6e478 saving the preference "start maximized" from GUI implemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 43
diff changeset
35 self.session.commit()
41
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
36 QtGui.QDialog.accept(self)
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
37
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
38 def reject(self):
44
be990ac6e478 saving the preference "start maximized" from GUI implemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 43
diff changeset
39 self.session.rollback()
41
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
40 QtGui.QDialog.reject(self)
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
41
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
42