annotate FeedSettings.py @ 73:5585f3d23541

Simplify: no classes needed for simple if
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 11 Aug 2010 03:26:21 +0200
parents 6bc6899f3330
children d292ab61ed6f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
1
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
2 from PyQt4 import QtGui
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
3 from Ui_FeedSettings import Ui_FeedSettings
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
4
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
5 class FeedSettings(QtGui.QDialog):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
6 def __init__(self, session, feed):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
7 QtGui.QWidget.__init__(self, None)
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
8 self.session = session
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
9 self.feed = feed
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
10 self.ui = Ui_FeedSettings()
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
11 self.ui.setupUi(self)
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
12 self.initUi()
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
13
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
14 def initUi(self):
52
6bc6899f3330 allow changing a feed's title
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 48
diff changeset
15 self.ui.feedTitle.setText(self.feed.title)
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
16 self.ui.autoLoadArticle.setChecked(self.feed.auto_load_entry_link)
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
17
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
18 def autoLoadArticleChanged(self, change):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
19 if change:
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
20 self.feed.auto_load_entry_link = True
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
21 else:
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
22 self.feed.auto_load_entry_link = False
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
23
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
24 def accept(self):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
25 self.session.commit()
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
26 QtGui.QDialog.accept(self)
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
27
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
28 def reject(self):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
29 self.session.rollback()
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
30 QtGui.QDialog.reject(self)
52
6bc6899f3330 allow changing a feed's title
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 48
diff changeset
31
6bc6899f3330 allow changing a feed's title
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 48
diff changeset
32 def editingTitleFinished(self):
6bc6899f3330 allow changing a feed's title
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 48
diff changeset
33 title = str(self.ui.feedTitle.text())
6bc6899f3330 allow changing a feed's title
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 48
diff changeset
34 self.feed.title = title