From b4e722f07bd09e7adfbcead693c09e3f5ee1a974 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Mon, 31 Jul 2017 17:16:46 -0700 Subject: [PATCH] Loosen string type checking a bit; let asUnicode throw errors if it needs to. --- pyqtgraph/parametertree/parameterTypes.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/pyqtgraph/parametertree/parameterTypes.py b/pyqtgraph/parametertree/parameterTypes.py index ace0c9a4..8c1e587d 100644 --- a/pyqtgraph/parametertree/parameterTypes.py +++ b/pyqtgraph/parametertree/parameterTypes.py @@ -326,26 +326,12 @@ class SimpleParameter(Parameter): 'int': int, 'float': float, 'bool': bool, - 'str': self._interpStr, + 'str': asUnicode, 'color': self._interpColor, 'colormap': self._interpColormap, }[self.opts['type']] return fn(v) - def _interpStr(self, v): - isQString = hasattr(QtCore, 'QString') and isinstance(v, QtCore.QString) - if sys.version[0] == '2': - if isQString: - v = unicode(v) - elif not isinstance(v, basestring): - raise TypeError("Cannot set str parmeter from object %r" % v) - else: - if isQString: - v = str(v) - elif not isinstance(v, str): - raise TypeError("Cannot set str parmeter from object %r" % v) - return v - def _interpColor(self, v): return fn.mkColor(v)