Bugfixes:

- ViewBox ignore bounds on zoom box
- Fixed improper pixel size caching
- Fixed check for 'win' in sys.platform (matches 'darwin' as well)
This commit is contained in:
Luke Campagnola 2013-01-30 15:51:38 -05:00
parent 18d5c6644b
commit 413a8f930e
4 changed files with 9 additions and 9 deletions

View File

@ -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()

View File

@ -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"

View File

@ -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

View File

@ -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.