Merge branch 'lidstrom83-DockArea_apoptose_fix' into develop

Also corrected temporary container persisting after calling dockarea.addDock()
This commit is contained in:
Luke Campagnola 2015-03-14 15:49:45 -04:00
commit b700a1ad3d
4 changed files with 12 additions and 6 deletions

View File

@ -3,9 +3,11 @@ pyqtgraph-0.9.11 [unreleased]
Bugfixes: Bugfixes:
- Fixed git version string generation on python3 - Fixed git version string generation on python3
- Fixed setting default values for out-of-bound points in pg.interpolateArray - Fixed setting default values for out-of-bound points in pg.interpolateArray
- Fixed adding Docks to DockArea after all Docks have been removed
- Fixed plot downsampling bug on python 3
New Features: New Features:
- PyQt5 support - Preliminary PyQt5 support
pyqtgraph-0.9.10 pyqtgraph-0.9.10

View File

@ -34,6 +34,7 @@ Contributors
* John David Reaver * John David Reaver
* David Kaplan * David Kaplan
* Martin Fitzpatrick * Martin Fitzpatrick
* Daniel Lidstrom
Requirements Requirements
------------ ------------

View File

@ -11,6 +11,7 @@ class Dock(QtGui.QWidget, DockDrop):
def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False): def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False):
QtGui.QWidget.__init__(self) QtGui.QWidget.__init__(self)
DockDrop.__init__(self) DockDrop.__init__(self)
self._container = None
self.area = area self.area = area
self.label = DockLabel(name, self, closable) self.label = DockLabel(name, self, closable)
if closable: if closable:

View File

@ -102,9 +102,12 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
'below': 'after' 'below': 'after'
}[position] }[position]
#print "request insert", dock, insertPos, neighbor #print "request insert", dock, insertPos, neighbor
old = dock.container()
container.insert(dock, insertPos, neighbor) container.insert(dock, insertPos, neighbor)
dock.area = self dock.area = self
self.docks[dock.name()] = dock self.docks[dock.name()] = dock
if old is not None:
old.apoptose()
return dock return dock
@ -112,12 +115,10 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
""" """
Move an existing Dock to a new location. Move an existing Dock to a new location.
""" """
old = dock.container()
## Moving to the edge of a tabbed dock causes a drop outside the tab box ## Moving to the edge of a tabbed dock causes a drop outside the tab box
if position in ['left', 'right', 'top', 'bottom'] and neighbor is not None and neighbor.container() is not None and neighbor.container().type() == 'tab': if position in ['left', 'right', 'top', 'bottom'] and neighbor is not None and neighbor.container() is not None and neighbor.container().type() == 'tab':
neighbor = neighbor.container() neighbor = neighbor.container()
self.addDock(dock, position, neighbor) self.addDock(dock, position, neighbor)
old.apoptose()
def getContainer(self, obj): def getContainer(self, obj):
if obj is None: if obj is None:
@ -296,10 +297,11 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
def apoptose(self): def apoptose(self):
#print "apoptose area:", self.temporary, self.topContainer, self.topContainer.count() #print "apoptose area:", self.temporary, self.topContainer, self.topContainer.count()
if self.temporary and self.topContainer.count() == 0: if self.topContainer.count() == 0:
self.topContainer = None self.topContainer = None
self.home.removeTempArea(self) if self.temporary:
#self.close() self.home.removeTempArea(self)
#self.close()
## PySide bug: We need to explicitly redefine these methods ## PySide bug: We need to explicitly redefine these methods
## or else drag/drop events will not be delivered. ## or else drag/drop events will not be delivered.