# HG changeset patch # User Dirk Olmes # Date 1400730586 -7200 # Node ID f6dcc85cd8cad2301609b568e8f9cad06f6a9e5e # Parent 218c2b3761699e667c77ca4aa5cf416545d0847a use SIP API v2 diff -r 218c2b376169 -r f6dcc85cd8ca DisplayModel.py --- a/DisplayModel.py Thu May 22 05:49:14 2014 +0200 +++ b/DisplayModel.py Thu May 22 05:49:46 2014 +0200 @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from PyQt4.QtCore import QAbstractListModel, QModelIndex, QVariant, Qt +from PyQt4.QtCore import QAbstractListModel, QModelIndex, Qt class DisplayModel(QAbstractListModel): def __init__(self, parent=None, list=None, displayAttribute=None, **args): @@ -15,9 +15,9 @@ row = index.row() item = self.list[row] displayString = self._stringToDisplay(item) - return QVariant(displayString) + return displayString else: - return QVariant() + return None def _stringToDisplay(self, item): if hasattr(item, self.displayAttribute): diff -r 218c2b376169 -r f6dcc85cd8ca FeedEntryTableModel.py --- a/FeedEntryTableModel.py Thu May 22 05:49:14 2014 +0200 +++ b/FeedEntryTableModel.py Thu May 22 05:49:46 2014 +0200 @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from PyQt4.QtCore import QAbstractTableModel, QVariant, Qt +from PyQt4.QtCore import QAbstractTableModel, Qt class TableModel(QAbstractTableModel): ''' @@ -12,18 +12,18 @@ def headerData(self, section, orientation, role): if orientation == Qt.Horizontal and role == Qt.DisplayRole: value = self.headerDataForColumn(section) - return QVariant(value) + value else: - return QVariant() + return None def data(self, index, role): if not index.isValid(): - return QVariant() + return None elif role != Qt.DisplayRole: - return QVariant() + return None else: value = self.dataForRowAndColumn(index.row(), index.column()) - return QVariant(value) + return value class FeedEntryTableModel(TableModel): diff -r 218c2b376169 -r f6dcc85cd8ca feedworm.py --- a/feedworm.py Thu May 22 05:49:14 2014 +0200 +++ b/feedworm.py Thu May 22 05:49:46 2014 +0200 @@ -1,4 +1,10 @@ # -*- coding: utf-8 -*- + +# see http://stackoverflow.com/questions/6238193/pyqt-new-api-with-python-2 +import sip +sip.setapi('QString', 2) +sip.setapi('QVariant', 2) + from MainWindow import MainWindow from PyQt4 import QtGui from PyQt4.QtNetwork import QNetworkProxy @@ -7,6 +13,13 @@ import sys import warnings +def filterWarnings(): + # filter out the warnings about duplicate inclusion of argparse + warnings.filterwarnings("ignore", category=UserWarning) + +def configureLogging(): + logging.basicConfig(level=logging.DEBUG) + def setupProxy(preferences): if preferences.isProxyConfigured() and preferences.useProxy(): proxyHost = preferences.proxyHost() @@ -15,10 +28,9 @@ QNetworkProxy.setApplicationProxy(proxy) if __name__ == '__main__': - # filter out the warnings about duplicate inclusion of argparse - warnings.filterwarnings("ignore", category=UserWarning) - - logging.basicConfig(level=logging.DEBUG) + filterWarnings() + configureLogging() + backend = BackendFactory.createBackend() preferences = backend.preferences() setupProxy(preferences)