From 5053318348b7a1195e8d82679b95782919d71672 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Wed, 30 Jan 2013 15:51:38 -0500 Subject: [PATCH] Bugfixes: - ViewBox ignore bounds on zoom box - Fixed improper pixel size caching - Fixed check for 'win' in sys.platform (matches 'darwin' as well) --- graphicsItems/ScatterPlotItem.py | 2 +- graphicsItems/ViewBox/ViewBox.py | 2 +- ptime.py | 2 +- widgets/RemoteGraphicsView.py | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/graphicsItems/ScatterPlotItem.py b/graphicsItems/ScatterPlotItem.py index 0b422596..ccb6229f 100644 --- a/graphicsItems/ScatterPlotItem.py +++ b/graphicsItems/ScatterPlotItem.py @@ -599,7 +599,7 @@ class ScatterPlotItem(GraphicsObject): self.invalidate() def dataBounds(self, ax, frac=1.0, orthoRange=None): - if frac >= 1.0 and self.bounds[ax] is not None: + if frac >= 1.0 and orthoRange is None and self.bounds[ax] is not None: return self.bounds[ax] #self.prepareGeometryChange() diff --git a/graphicsItems/ViewBox/ViewBox.py b/graphicsItems/ViewBox/ViewBox.py index f5aa03b8..8b4ba2af 100644 --- a/graphicsItems/ViewBox/ViewBox.py +++ b/graphicsItems/ViewBox/ViewBox.py @@ -138,7 +138,7 @@ class ViewBox(GraphicsWidget): self.rbScaleBox.setPen(fn.mkPen((255,255,100), width=1)) self.rbScaleBox.setBrush(fn.mkBrush(255,255,0,100)) self.rbScaleBox.hide() - self.addItem(self.rbScaleBox) + self.addItem(self.rbScaleBox, ignoreBounds=True) self.axHistory = [] # maintain a history of zoom locations self.axHistoryPointer = -1 # pointer into the history. Allows forward/backward movement, not just "undo" diff --git a/ptime.py b/ptime.py index ac61f57f..1de8282f 100644 --- a/ptime.py +++ b/ptime.py @@ -20,7 +20,7 @@ def unixTime(): """Return the current time in seconds with high precision (unix version, use Manager.time() to stay platform independent).""" return systime.time() -if 'win' in sys.platform: +if sys.platform.startswith('win'): cstart = systime.clock() ### Required to start the clock in windows START_TIME = systime.time() - cstart diff --git a/widgets/RemoteGraphicsView.py b/widgets/RemoteGraphicsView.py index 3722e87e..2dd1fe9b 100644 --- a/widgets/RemoteGraphicsView.py +++ b/widgets/RemoteGraphicsView.py @@ -32,7 +32,7 @@ class RemoteGraphicsView(QtGui.QWidget): self.setMouseTracking(True) self.shm = None shmFileName = self._view.shmFileName() - if 'win' in sys.platform: + if sys.platform.startswith('win'): self.shmtag = shmFileName else: self.shmFile = open(shmFileName, 'r') @@ -60,7 +60,7 @@ class RemoteGraphicsView(QtGui.QWidget): if self.shm is None or self.shm.size != size: if self.shm is not None: self.shm.close() - if 'win' in sys.platform: + if sys.platform.startswith('win'): self.shmtag = newfile ## on windows, we create a new tag for every resize self.shm = mmap.mmap(-1, size, self.shmtag) ## can't use tmpfile on windows because the file can only be opened once. else: @@ -119,7 +119,7 @@ class Renderer(GraphicsView): def __init__(self, *args, **kwds): ## Create shared memory for rendered image - if 'win' in sys.platform: + if sys.platform.startswith('win'): self.shmtag = "pyqtgraph_shmem_" + ''.join([chr((random.getrandbits(20)%25) + 97) for i in range(20)]) self.shm = mmap.mmap(-1, mmap.PAGESIZE, self.shmtag) # use anonymous mmap on windows else: @@ -138,11 +138,11 @@ class Renderer(GraphicsView): def close(self): self.shm.close() - if 'win' not in sys.platform: + if sys.platform.startswith('win'): self.shmFile.close() def shmFileName(self): - if 'win' in sys.platform: + if sys.platform.startswith('win'): return self.shmtag else: return self.shmFile.name @@ -164,7 +164,7 @@ class Renderer(GraphicsView): return size = self.width() * self.height() * 4 if size > self.shm.size(): - if 'win' in sys.platform: + if sys.platform.startswith('win'): ## windows says "WindowsError: [Error 87] the parameter is incorrect" if we try to resize the mmap self.shm.close() ## it also says (sometimes) 'access is denied' if we try to reuse the tag.