Merge branch 'close_signal_upon_dock_close' of https://github.com/lidstrom83/pyqtgraph into lidstrom83-close_signal_upon_dock_close
This commit is contained in:
commit
ddc7f45b9b
@ -7,6 +7,7 @@ from ..python2_3 import asUnicode
|
||||
class Dock(QtGui.QWidget, DockDrop):
|
||||
|
||||
sigStretchChanged = QtCore.Signal()
|
||||
sigClosed = QtCore.Signal(object)
|
||||
|
||||
def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False):
|
||||
QtGui.QWidget.__init__(self)
|
||||
@ -237,6 +238,7 @@ class Dock(QtGui.QWidget, DockDrop):
|
||||
self.label.setParent(None)
|
||||
self._container.apoptose()
|
||||
self._container = None
|
||||
self.sigClosed.emit(self)
|
||||
|
||||
def __repr__(self):
|
||||
return "<Dock %s %s>" % (self.name(), self.stretch())
|
||||
|
@ -172,8 +172,7 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
|
||||
if self.home is None:
|
||||
area = DockArea(temporary=True, home=self)
|
||||
self.tempAreas.append(area)
|
||||
win = QtGui.QMainWindow()
|
||||
win.setCentralWidget(area)
|
||||
win = TempAreaWindow(area)
|
||||
area.win = win
|
||||
win.show()
|
||||
else:
|
||||
@ -309,6 +308,11 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
|
||||
if self.temporary:
|
||||
self.home.removeTempArea(self)
|
||||
#self.close()
|
||||
|
||||
def clear(self):
|
||||
docks = self.findAll()[1]
|
||||
for dock in docks.values():
|
||||
dock.close()
|
||||
|
||||
## PySide bug: We need to explicitly redefine these methods
|
||||
## or else drag/drop events will not be delivered.
|
||||
@ -324,5 +328,12 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
|
||||
def dropEvent(self, *args):
|
||||
DockDrop.dropEvent(self, *args)
|
||||
|
||||
|
||||
|
||||
|
||||
class TempAreaWindow(QtGui.QMainWindow):
|
||||
def __init__(self, area, **kwargs):
|
||||
QtGui.QMainWindow.__init__(self, **kwargs)
|
||||
self.setCentralWidget(area)
|
||||
|
||||
def closeEvent(self, *args, **kwargs):
|
||||
self.centralWidget().clear()
|
||||
QtGui.QMainWindow.closeEvent(self, *args, **kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user