1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#!/usr/bin/python
# This file is part of PySide: Python for Qt
#
# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
#
# Contact: PySide team <contact@pyside.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
# This is a small script printing out Qt binding class hierarchies
# for comparison purposes.
#
# Usage:
#
# ./list-class-hierarchy.py PySide > pyside.list
# ./list-class-hierarchy.py PyQt4 > pyqt4.list
#
# meld pyside.list pyqt4.list
import sys
import pdb
from inspect import isclass
ignore = ["staticMetaObject",
"pyqtConfigure",
"registerUserData",
"thread",
]
def recurse_into(el,obj):
#s = el.split('.')[-1]
#pdb.set_trace()
for item in sorted(dir(obj)):
if item[0]=='_':
continue
mel = el + '.' + item
try:
mobj = eval(mel)
except Exception:
continue
if item in ignore:
continue
print mel
if isclass(mobj):
recurse_into(mel,mobj)
if __name__=='__main__':
top = sys.argv[1]
if top=="PyQt4":
import sip
sip.setapi('QDate',2)
sip.setapi('QDateTime',2)
sip.setapi('QString',2)
sip.setapi('QTextStream',2)
sip.setapi('QTime',2)
sip.setapi('QUrl',2)
sip.setapi('QVariant',2)
if len(sys.argv)>2:
modules = sys.argv[2:]
else:
modules = [ 'QtCore',
'QtGui',
'QtHelp',
#'QtMultimedia',
'QtNetwork',
'QtOpenGL',
'QtScript',
'QtScriptTools',
'QtSql',
'QtSvg',
'QtTest',
#'QtUiTools',
'QtWebKit',
'QtXml',
'QtXmlPatterns' ]
for m in modules:
exec "from %s import %s" % (top,m) in globals(), locals()
recurse_into(m,eval(m))
|