More multiple inheritance porting

This commit is contained in:
Kovid Goyal 2014-04-24 14:52:54 +05:30
parent 53991dc588
commit 4ff0c73b1a
3 changed files with 12 additions and 11 deletions

View File

@ -26,15 +26,6 @@ __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
# http://qt-project.org/doc/qt-5/obsoleteclasses.html as these will not be # http://qt-project.org/doc/qt-5/obsoleteclasses.html as these will not be
# present in PyQt5 # present in PyQt5
# QT5XX: For classes that inherit both a QObject based class and
# SearchQueryParser, PyQt5 class the SearchQueryParser __init__ method when
# calling the QObject based classes __init__ method. The simplest fix is to
# make SearchQueryParser the first base class instead of the second. An
# alternative fix is to create a derived class from SearchQueryParser whose
# __init__ method accepts any args and does nothing and inherit from that. Do
# this porting and test the results when possible. Porting already done and
# tested for keyboard.py
# QT5XX: Delete this file after migration is completed # QT5XX: Delete this file after migration is completed
import os, re import os, re

View File

@ -23,7 +23,12 @@ from calibre.utils.search_query_parser import SearchQueryParser
from calibre.utils.icu import lower from calibre.utils.icu import lower
from calibre.constants import iswindows from calibre.constants import iswindows
class PluginModel(QAbstractItemModel, SearchQueryParser): # {{{ class AdaptSQP(SearchQueryParser):
def __init__(self, *args, **kwargs):
pass
class PluginModel(QAbstractItemModel, AdaptSQP): # {{{
def __init__(self, show_only_user_plugins=False): def __init__(self, show_only_user_plugins=False):
QAbstractItemModel.__init__(self) QAbstractItemModel.__init__(self)

View File

@ -25,6 +25,11 @@ from PyQt5.Qt import (QAbstractListModel, Qt, QStyledItemDelegate, QStyle,
ROOT = QModelIndex() ROOT = QModelIndex()
class AdaptSQP(SearchQueryParser):
def __init__(self, *args, **kwargs):
pass
class Delegate(QStyledItemDelegate): # {{{ class Delegate(QStyledItemDelegate): # {{{
def __init__(self, view): def __init__(self, view):
QStyledItemDelegate.__init__(self, view) QStyledItemDelegate.__init__(self, view)
@ -98,7 +103,7 @@ class Tweak(object): # {{{
# }}} # }}}
class Tweaks(QAbstractListModel, SearchQueryParser): # {{{ class Tweaks(QAbstractListModel, AdaptSQP): # {{{
def __init__(self, parent=None): def __init__(self, parent=None):
QAbstractListModel.__init__(self, parent) QAbstractListModel.__init__(self, parent)