view FeedSettings.py @ 116:7f07ced80d6f

update README
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 20 Aug 2011 07:15:03 +0200
parents d11c3f71ac40
children a4b2077c9603
line wrap: on
line source


from PyQt4 import QtGui
from Ui_FeedSettings import Ui_FeedSettings

class FeedSettings(QtGui.QDialog):
    def __init__(self, session, feed):
        QtGui.QWidget.__init__(self, None)
        self.session = session
        self.feed = feed
        self.ui = Ui_FeedSettings()
        self.ui.setupUi(self)
        self.initUi()
        
    def initUi(self):
        self.ui.feedTitle.setText(self.feed.title)
        self.ui.updateInterval.setText(str(self.feed.update_interval))
        self.ui.autoLoadArticle.setChecked(self.feed.auto_load_entry_link)
        self.ui.alwaysOpenInBrowser.setChecked(self.feed.always_open_in_browser)

    def editingTitleFinished(self):
        title = str(self.ui.feedTitle.text())
        self.feed.title = title
        
    def editingUpdateIntervalFinished(self):
        updateInterval = int(str(self.ui.updateInterval.text()))
        self.feed.update_interval = updateInterval
        self.feed.incrementNextUpdateDate()

    def autoLoadArticleChanged(self, change):
        if change:
            self.feed.auto_load_entry_link = True
        else:
            self.feed.auto_load_entry_link = False

    def alwaysOpenInExternalBrowser(self, change):
        if change:
            self.feed.always_open_in_browser = True
        else:
            self.feed.always_open_in_browser = False

    def accept(self):
        self.session.commit()
        QtGui.QDialog.accept(self)
        
    def reject(self):
        self.session.rollback()
        QtGui.QDialog.reject(self)