# HG changeset patch # User Dirk Olmes # Date 1398571497 -7200 # Node ID 699d8f1cebd48a2c7e4cfe14723f7875f42aa917 # Parent bb3c851b18b199df5596ae69515b737541ddda70 unify imports, especially Qt imports. Use consistent super syntax diff -r bb3c851b18b1 -r 699d8f1cebd4 AddFeed.py --- a/AddFeed.py Sun Apr 27 05:33:34 2014 +0200 +++ b/AddFeed.py Sun Apr 27 06:04:57 2014 +0200 @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -from PyQt4 import QtGui +from PyQt4.QtGui import QDialog from Ui_AddFeed import Ui_AddFeed import logging -class AddFeed(QtGui.QDialog): +class AddFeed(QDialog): def __init__(self, backend=None): - QtGui.QWidget.__init__(self, None) + super(AddFeed, self).__init__(None) self.backend = backend self.exception = None self.ui = Ui_AddFeed() @@ -18,8 +18,8 @@ self.backend.createFeed(url) except AttributeError as ae: logging.getLogger("AddFeed").info(ae) - self.exception = ae - QtGui.QDialog.accept(self) + self.exception = ae + super(AddFeed, self).accept() def getUrl(self): text = self.ui.url.text() diff -r bb3c851b18b1 -r 699d8f1cebd4 DisplayModel.py --- a/DisplayModel.py Sun Apr 27 05:33:34 2014 +0200 +++ b/DisplayModel.py Sun Apr 27 06:04:57 2014 +0200 @@ -3,7 +3,7 @@ class DisplayModel(QAbstractListModel): def __init__(self, parent=None, list=None, displayAttribute=None, **args): - QAbstractListModel.__init__(self, parent, *args) + super(DisplayModel, self).__init__(parent, *args) self.list = list self.displayAttribute = displayAttribute diff -r bb3c851b18b1 -r 699d8f1cebd4 FeedEntryItemDelegate.py --- a/FeedEntryItemDelegate.py Sun Apr 27 05:33:34 2014 +0200 +++ b/FeedEntryItemDelegate.py Sun Apr 27 06:04:57 2014 +0200 @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- -from PyQt4 import QtGui -from PyQt4.QtGui import QFont +from PyQt4.QtGui import QFont, QStyledItemDelegate -class FeedEntryItemDelegate(QtGui.QStyledItemDelegate): +class FeedEntryItemDelegate(QStyledItemDelegate): def __init__(self): - QtGui.QStyledItemDelegate.__init__(self, None) + super(FeedEntryItemDelegate, self).__init__(None) def paint(self, painter, style, index): feedEntryTableModel = index.model() @@ -16,4 +15,4 @@ style.font.setWeight(QFont.Normal) else: style.font.setWeight(QFont.Bold) - QtGui.QStyledItemDelegate.paint(self, painter, style, index) + super(FeedEntryItemDelegate, self).paint(painter, style, index) diff -r bb3c851b18b1 -r 699d8f1cebd4 FeedSettings.py --- a/FeedSettings.py Sun Apr 27 05:33:34 2014 +0200 +++ b/FeedSettings.py Sun Apr 27 06:04:57 2014 +0200 @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- -from PyQt4 import QtGui +from PyQt4.QtGui import QDialog from Ui_FeedSettings import Ui_FeedSettings -class FeedSettings(QtGui.QDialog): +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): - QtGui.QWidget.__init__(self, None) + super(FeedSettings, self).__init__(None) self.backend = backend self.feed = backend.selectedFeed self.changes = {} @@ -45,4 +45,4 @@ def accept(self): self.backend.updateFeed(self.feed, self.changes) - QtGui.QDialog.accept(self) + super(FeedSettings, self).accept() diff -r bb3c851b18b1 -r 699d8f1cebd4 MainWindow.py --- a/MainWindow.py Sun Apr 27 05:33:34 2014 +0200 +++ b/MainWindow.py Sun Apr 27 06:04:57 2014 +0200 @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import subprocess from AddFeed import AddFeed from DisplayModel import DisplayModel from FeedEntryItemDelegate import FeedEntryItemDelegate @@ -6,11 +7,8 @@ from FeedSettings import FeedSettings from PreferencesDialog import PreferencesDialog from PyQt4.QtCore import QUrl -from PyQt4.QtGui import QApplication -from PyQt4.QtGui import QMainWindow -from PyQt4.QtGui import QWidget +from PyQt4.QtGui import QApplication, QMainWindow, QWidget from Ui_MainWindow import Ui_MainWindow -import subprocess STATUS_MESSAGE_DISPLAY_MILLIS = 20000 diff -r bb3c851b18b1 -r 699d8f1cebd4 OpmlImport.py --- a/OpmlImport.py Sun Apr 27 05:33:34 2014 +0200 +++ b/OpmlImport.py Sun Apr 27 06:04:57 2014 +0200 @@ -8,7 +8,7 @@ for outline in outlines: url = outline.getAttribute("xmlUrl") title = outline.getAttribute("title") - + feed = Feed(title, url) session.add(feed) session.commit() diff -r bb3c851b18b1 -r 699d8f1cebd4 PreferencesDialog.py --- a/PreferencesDialog.py Sun Apr 27 05:33:34 2014 +0200 +++ b/PreferencesDialog.py Sun Apr 27 06:04:57 2014 +0200 @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from PyQt4 import QtGui +from PyQt4.QtGui import QDialog from Ui_Preferences import Ui_Preferences -class PreferencesDialog(QtGui.QDialog): +class PreferencesDialog(QDialog): def __init__(self, backend=None): - QtGui.QWidget.__init__(self, None) + super(PreferencesDialog, self).__init__(None) self.backend = backend self.preferences = backend.preferences() self.ui = Ui_Preferences() @@ -83,9 +83,8 @@ def accept(self): self.storeProxySettings() self.preferences.commit(); - QtGui.QDialog.accept(self) + super(PreferencesDialog, self).accept() def reject(self): self.preferences.rollback() - QtGui.QDialog.reject(self) - + super(PreferencesDialog, self).reject() diff -r bb3c851b18b1 -r 699d8f1cebd4 backend/AbstractBackend.py --- a/backend/AbstractBackend.py Sun Apr 27 05:33:34 2014 +0200 +++ b/backend/AbstractBackend.py Sun Apr 27 06:04:57 2014 +0200 @@ -2,10 +2,10 @@ from datetime import datetime, timedelta def calculateExpireDate(preferences): - now = datetime.now() - daysToKeepFeedEntries = preferences.daysToKeepFeedEntries() - delta = timedelta(days=daysToKeepFeedEntries) - return now - delta + now = datetime.now() + daysToKeepFeedEntries = preferences.daysToKeepFeedEntries() + delta = timedelta(days=daysToKeepFeedEntries) + return now - delta class AbstractBackend(object): def __init__(self): diff -r bb3c851b18b1 -r 699d8f1cebd4 backend/AbstractFeedUpdater.py --- a/backend/AbstractFeedUpdater.py Sun Apr 27 05:33:34 2014 +0200 +++ b/backend/AbstractFeedUpdater.py Sun Apr 27 06:04:57 2014 +0200 @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -from datetime import datetime -from urllib2 import ProxyHandler import AbstractBackend import feedparser import logging +from datetime import datetime +from urllib2 import ProxyHandler STATUS_ERROR = 400 log = logging.getLogger("FeedUpdater") diff -r bb3c851b18b1 -r 699d8f1cebd4 backend/couchdb/CouchDbBackend.py --- a/backend/couchdb/CouchDbBackend.py Sun Apr 27 05:33:34 2014 +0200 +++ b/backend/couchdb/CouchDbBackend.py Sun Apr 27 06:04:57 2014 +0200 @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- +import couchdb +import logging from FeedUpdater import FeedUpdater from Preferences import Preferences from backend.AbstractBackend import AbstractBackend from backend.couchdb import CouchDb from backend.couchdb.Feed import Feed from backend.couchdb.FeedEntry import FeedEntry -import couchdb -import logging class CouchDbBackend(AbstractBackend): ''' @@ -14,6 +14,7 @@ ''' def __init__(self): + super(CouchDbBackend, self).__init__() CouchDb.init() server = self._initServer() self.database = server[CouchDb.database] diff -r bb3c851b18b1 -r 699d8f1cebd4 backend/sqlalchemy/Feed.py --- a/backend/sqlalchemy/Feed.py Sun Apr 27 05:33:34 2014 +0200 +++ b/backend/sqlalchemy/Feed.py Sun Apr 27 06:04:57 2014 +0200 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- +import FeedEntry from datetime import datetime, timedelta -import FeedEntry class Feed(object): @staticmethod diff -r bb3c851b18b1 -r 699d8f1cebd4 backend/sqlalchemy/FeedEntry.py --- a/backend/sqlalchemy/FeedEntry.py Sun Apr 27 05:33:34 2014 +0200 +++ b/backend/sqlalchemy/FeedEntry.py Sun Apr 27 06:04:57 2014 +0200 @@ -29,13 +29,13 @@ def userPresentableString(self): return self.title - + def toggleRead(self): if self.read: self.markUnread() else: self.markRead() - + def markRead(self): self.read = 1 diff -r bb3c851b18b1 -r 699d8f1cebd4 backend/sqlalchemy/Preference.py --- a/backend/sqlalchemy/Preference.py Sun Apr 27 05:33:34 2014 +0200 +++ b/backend/sqlalchemy/Preference.py Sun Apr 27 06:04:57 2014 +0200 @@ -3,10 +3,10 @@ @staticmethod def forKey(key, session): return session.query(Preference).filter(Preference.key == key).first() - + def __init__(self, key, value): self.key = key self.value = value - + def __repr__(self): return "" % (self.key, self.value) diff -r bb3c851b18b1 -r 699d8f1cebd4 backend/sqlalchemy/SqlAlchemyBackend.py --- a/backend/sqlalchemy/SqlAlchemyBackend.py Sun Apr 27 05:33:34 2014 +0200 +++ b/backend/sqlalchemy/SqlAlchemyBackend.py Sun Apr 27 06:04:57 2014 +0200 @@ -1,4 +1,8 @@ # -*- coding: utf-8 -*- +import Database +import Mapping +import logging +import util from Feed import Feed from FeedEntry import FeedEntry from FeedUpdater import FeedUpdater @@ -6,10 +10,6 @@ from backend.AbstractBackend import AbstractBackend from sqlalchemy.orm import joinedload from sqlalchemy.sql import and_ -import Database -import Mapping -import logging -import util class SqlAlchemyBackend(AbstractBackend): '''