Check for existence of QtCore.QString before using it
This commit is contained in:
parent
7de20b8847
commit
c719ad4355
@ -333,13 +333,14 @@ class SimpleParameter(Parameter):
|
|||||||
return fn(v)
|
return fn(v)
|
||||||
|
|
||||||
def _interpStr(self, v):
|
def _interpStr(self, v):
|
||||||
|
isQString = hasattr(QtCore, 'QString') and isinstance(v, QtCore.QString)
|
||||||
if sys.version[0] == '2':
|
if sys.version[0] == '2':
|
||||||
if isinstance(v, QtCore.QString):
|
if isQString:
|
||||||
v = unicode(v)
|
v = unicode(v)
|
||||||
elif not isinstance(v, basestring):
|
elif not isinstance(v, basestring):
|
||||||
raise TypeError("Cannot set str parmeter from object %r" % v)
|
raise TypeError("Cannot set str parmeter from object %r" % v)
|
||||||
else:
|
else:
|
||||||
if isinstance(v, QtCore.QString):
|
if isQString:
|
||||||
v = str(v)
|
v = str(v)
|
||||||
elif not isinstance(v, str):
|
elif not isinstance(v, str):
|
||||||
raise TypeError("Cannot set str parmeter from object %r" % v)
|
raise TypeError("Cannot set str parmeter from object %r" % v)
|
||||||
|
Loading…
Reference in New Issue
Block a user