view FeedSettings.py @ 242:03e3ebb1d52f

Disable the use of a proxy when updating feeds - https traffic does not seem to work currently over a proxy.
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 08 Jun 2015 19:20:46 +0200
parents 699d8f1cebd4
children 8e73a8ae863f
line wrap: on
line source

# -*- coding: utf-8 -*-
from PyQt4.QtGui import QDialog
from Ui_FeedSettings import Ui_FeedSettings

class FeedSettings(QDialog):
    """
    Copy all feed properties into the GUI on initialization. Collect all changes
    in a separate dict that's passed into the backend along with the feed to modify.
    """
    def __init__(self, backend):
        super(FeedSettings, self).__init__(None)
        self.backend = backend
        self.feed = backend.selectedFeed
        self.changes = {}
        self.ui = Ui_FeedSettings()
        self.ui.setupUi(self)
        self.initUi()

    def initUi(self):
        self.ui.urlLabel.setText(self.feed.rss_url)
        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.changes["title"] = title

    def editingUpdateIntervalFinished(self):
        updateInterval = int(str(self.ui.updateInterval.text()))
        self.changes["update_interval"] = updateInterval

    def autoLoadArticleChanged(self, change):
        if change:
            self.changes["auto_load_entry_link"] = True
        else:
            self.changes["auto_load_entry_link"] = False

    def alwaysOpenInExternalBrowser(self, change):
        if change:
            self.changes["always_open_in_browser"] = True
        else:
            self.changes["always_open_in_browser"] = False

    def accept(self):
        self.backend.updateFeed(self.feed, self.changes)
        super(FeedSettings, self).accept()