From 09b16baed13b41e71e94f25d2c24dae04bc491f1 Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Mon, 13 May 2013 08:51:59 -0400 Subject: [PATCH] python3 fixes imageview fix --- pyqtgraph/imageview/ImageView.py | 7 ++++--- pyqtgraph/parametertree/ParameterItem.py | 6 ++++++ pyqtgraph/widgets/SpinBox.py | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pyqtgraph/imageview/ImageView.py b/pyqtgraph/imageview/ImageView.py index f0c13a60..cb72241a 100644 --- a/pyqtgraph/imageview/ImageView.py +++ b/pyqtgraph/imageview/ImageView.py @@ -209,7 +209,7 @@ class ImageView(QtGui.QWidget): *pos* Change the position of the displayed image *scale* Change the scale of the displayed image - *transform* Set the transform of the dispalyed image. This option overrides *pos* + *transform* Set the transform of the displayed image. This option overrides *pos* and *scale*. ============== ======================================================================= """ @@ -271,8 +271,9 @@ class ImageView(QtGui.QWidget): if levels is None and autoLevels: self.autoLevels() if levels is not None: ## this does nothing since getProcessedImage sets these values again. - self.levelMax = levels[1] - self.levelMin = levels[0] + #self.levelMax = levels[1] + #self.levelMin = levels[0] + self.setLevels(*levels) if self.ui.roiBtn.isChecked(): self.roiChanged() diff --git a/pyqtgraph/parametertree/ParameterItem.py b/pyqtgraph/parametertree/ParameterItem.py index 376e900d..46499fd3 100644 --- a/pyqtgraph/parametertree/ParameterItem.py +++ b/pyqtgraph/parametertree/ParameterItem.py @@ -157,3 +157,9 @@ class ParameterItem(QtGui.QTreeWidgetItem): ## since destroying the menu in mid-action will cause a crash. QtCore.QTimer.singleShot(0, self.param.remove) + ## for python 3 support, we need to redefine hash and eq methods. + def __hash__(self): + return id(self) + + def __eq__(self, x): + return x is self diff --git a/pyqtgraph/widgets/SpinBox.py b/pyqtgraph/widgets/SpinBox.py index 71695f4a..57e4f1ed 100644 --- a/pyqtgraph/widgets/SpinBox.py +++ b/pyqtgraph/widgets/SpinBox.py @@ -313,7 +313,7 @@ class SpinBox(QtGui.QAbstractSpinBox): s = [D(-1), D(1)][n >= 0] ## determine sign of step val = self.val - for i in range(abs(n)): + for i in range(int(abs(n))): if self.opts['log']: raise Exception("Log mode no longer supported.")