Tue, 23 Oct 2012 20:06:07 +0200
Changed the Python debugger backends to cope with latest PyQt4.
(grafted from aa3bdc7cb686df4d6281785d858899b4f9268535)
DebugClients/Python/DebugClientBase.py | file | annotate | diff | comparison | revisions | |
DebugClients/Python3/DebugClientBase.py | file | annotate | diff | comparison | revisions |
--- a/DebugClients/Python/DebugClientBase.py Sat Oct 20 17:27:09 2012 +0200 +++ b/DebugClients/Python/DebugClientBase.py Tue Oct 23 20:06:07 2012 +0200 @@ -1269,6 +1269,10 @@ oaccess = "" odict = dict + qtVariable = False + qvar = None + qvtype = "" + while i < len(var): if len(dict): udict = dict @@ -1333,12 +1337,16 @@ try: exec 'mdict = dict%s.__dict__' % access ndict.update(mdict) # __IGNORE_WARNING__ + exec 'obj = dict%s' % access + if "PyQt4." in str(type(obj)): + qtVariable = True + qvar = obj + qvtype = ("%s" % type(qvar))[1:-1].split()[1][1:-1] except: pass try: exec 'mcdict = dict%s.__class__.__dict__' % access ndict.update(mcdict) # __IGNORE_WARNING__ - exec 'obj = dict%s' % access if mdict and not "sipThis" in mdict.keys(): # __IGNORE_WARNING__ del rvar[0:2] access = "" @@ -1355,6 +1363,10 @@ ndict.update(cdict) exec 'obj = dict%s' % access access = "" + if "PyQt4." in str(type(obj)): + qtVariable = True + qvar = obj + qvtype = ("%s" % type(qvar))[1:-1].split()[1][1:-1] except: pass else: @@ -1363,6 +1375,10 @@ ndict.update(dict[var[i]].__class__.__dict__) del rvar[0] obj = dict[var[i]] + if "PyQt4." in str(type(obj)): + qtVariable = True + qvar = obj + qvtype = ("%s" % type(qvar))[1:-1].split()[1][1:-1] except: pass try: @@ -1375,13 +1391,19 @@ pass ndict.update(cdict) obj = dict[var[i]] + if "PyQt4." in str(type(obj)): + qtVariable = True + qvar = obj + qvtype = ("%s" % type(qvar))[1:-1].split()[1][1:-1] except: pass odict = dict dict = ndict i += 1 - if ("sipThis" in dict.keys() and len(dict) == 1) or \ + if qtVariable: + vlist = self.__formatQt4Variable(qvar, qvtype) + elif ("sipThis" in dict.keys() and len(dict) == 1) or \ (len(dict) == 0 and len(udict) > 0): if access: exec 'qvar = udict%s' % access @@ -1454,6 +1476,16 @@ if qttype == 'QChar': varlist.append(("", "QChar", "%s" % unichr(value.unicode()))) varlist.append(("", "int", "%d" % value.unicode())) + elif qttype == 'QByteArray': + varlist.append(("hex", "QByteArray", "%s" % value.toHex())) + varlist.append(("base64", "QByteArray", "%s" % value.toBase64())) + varlist.append(("percent encoding", "QByteArray", + "%s" % value.toPercentEncoding())) + elif qttype == 'QString': + varlist.append(("", "QString", "%s" % value)) + elif qttype == 'QStringList': + for i in range(value.count()): + varlist.append(("%d" % i, "QString", "%s" % value[i])) elif qttype == 'QPoint': varlist.append(("x", "int", "%d" % value.x())) varlist.append(("y", "int", "%d" % value.y())) @@ -1625,6 +1657,9 @@ elif valtype == "sip.methoddescriptor": if ConfigVarTypeStrings.index('instance method') in filter: continue + elif valtype == "sip.enumtype": + if ConfigVarTypeStrings.index('class') in filter: + continue elif not valtype.startswith("PySide") and \ ConfigVarTypeStrings.index('other') in filter: continue
--- a/DebugClients/Python3/DebugClientBase.py Sat Oct 20 17:27:09 2012 +0200 +++ b/DebugClients/Python3/DebugClientBase.py Tue Oct 23 20:06:07 2012 +0200 @@ -1269,6 +1269,10 @@ oaccess = "" odict = dict + qtVariable = False + qvar = None + qvtype = "" + while i < len(var): if len(dict): udict = dict @@ -1336,6 +1340,10 @@ .format(access), globals(), loc) mdict = loc["mdict"] obj = loc["obj"] + if "PyQt4." in str(type(obj)): + qtVariable = True + qvar = obj + qvtype = str(type(qvar))[1:-1].split()[1][1:-1] ndict.update(mdict) except: pass @@ -1364,6 +1372,10 @@ exec('obj = dict{0!s}'.format(access), globals(), loc) obj = loc["obj"] access = "" + if "PyQt4." in str(type(obj)): + qtVariable = True + qvar = obj + qvtype = str(type(qvar))[1:-1].split()[1][1:-1] except: pass else: @@ -1372,6 +1384,10 @@ ndict.update(dict[var[i]].__class__.__dict__) del rvar[0] obj = dict[var[i]] + if "PyQt4." in str(type(obj)): + qtVariable = True + qvar = obj + qvtype = str(type(qvar))[1:-1].split()[1][1:-1] except: pass try: @@ -1386,13 +1402,19 @@ pass ndict.update(loc["cdict"]) obj = dict[var[i]] + if "PyQt4." in str(type(obj)): + qtVariable = True + qvar = obj + qvtype = str(type(qvar))[1:-1].split()[1][1:-1] except: pass odict = dict dict = ndict i += 1 - if ("sipThis" in dict.keys() and len(dict) == 1) or \ + if qtVariable: + vlist = self.__formatQt4Variable(qvar, qvtype) + elif ("sipThis" in dict.keys() and len(dict) == 1) or \ (len(dict) == 0 and len(udict) > 0): if access: loc = {"udict": udict} @@ -1477,6 +1499,12 @@ if qttype == 'QChar': varlist.append(("", "QChar", "{0}".format(chr(value.unicode())))) varlist.append(("", "int", "{0:d}".format(value.unicode()))) + elif qttype == 'QByteArray': + varlist.append(("bytes", "QByteArray", "{0}".format(bytes(value))[2:-1])) + varlist.append(("hex", "QByteArray", "{0}".format(value.toHex())[2:-1])) + varlist.append(("base64", "QByteArray", "{0}".format(value.toBase64())[2:-1])) + varlist.append(("percent encoding", "QByteArray", + "{0}".format(value.toPercentEncoding())[2:-1])) elif qttype == 'QPoint': varlist.append(("x", "int", "{0:d}".format(value.x()))) varlist.append(("y", "int", "{0:d}".format(value.y()))) @@ -1641,6 +1669,12 @@ if valtype not in ConfigVarTypeStrings: if ConfigVarTypeStrings.index('instance') in filter: continue + elif valtype == "sip.methoddescriptor": + if ConfigVarTypeStrings.index('instance method') in filter: + continue + elif valtype == "sip.enumtype": + if ConfigVarTypeStrings.index('class') in filter: + continue valtype = valtypestr else: try: @@ -1653,6 +1687,9 @@ elif valtype == "sip.methoddescriptor": if ConfigVarTypeStrings.index('instance method') in filter: continue + elif valtype == "sip.enumtype": + if ConfigVarTypeStrings.index('class') in filter: + continue elif not valtype.startswith("PySide") and \ ConfigVarTypeStrings.index('other') in filter: continue