From c719ad4355e5fae81c95cf1fb32206ae854dcb4a Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Mon, 31 Jul 2017 17:04:53 -0700 Subject: [PATCH] Check for existence of QtCore.QString before using it --- pyqtgraph/parametertree/parameterTypes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyqtgraph/parametertree/parameterTypes.py b/pyqtgraph/parametertree/parameterTypes.py index e3ed8853..ace0c9a4 100644 --- a/pyqtgraph/parametertree/parameterTypes.py +++ b/pyqtgraph/parametertree/parameterTypes.py @@ -333,13 +333,14 @@ class SimpleParameter(Parameter): return fn(v) def _interpStr(self, v): + isQString = hasattr(QtCore, 'QString') and isinstance(v, QtCore.QString) if sys.version[0] == '2': - if isinstance(v, QtCore.QString): + if isQString: v = unicode(v) elif not isinstance(v, basestring): raise TypeError("Cannot set str parmeter from object %r" % v) else: - if isinstance(v, QtCore.QString): + if isQString: v = str(v) elif not isinstance(v, str): raise TypeError("Cannot set str parmeter from object %r" % v)