From 7f501820de2d1f7578f6519d899ddbcc0b8c6089 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 10 Mar 2016 10:34:37 +0800 Subject: [PATCH] gui: delete log/applet docks instead of hiding them --- artiq/gui/applets.py | 12 ++++++++---- artiq/gui/log.py | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/artiq/gui/applets.py b/artiq/gui/applets.py index b25ac1829..f9c93d9f5 100644 --- a/artiq/gui/applets.py +++ b/artiq/gui/applets.py @@ -85,7 +85,7 @@ class AppletIPCServer(AsyncioParentComm): await asyncio.wait([self.server_task]) -class AppletDock(QDockWidgetCloseDetect): +class _AppletDock(QDockWidgetCloseDetect): def __init__(self, datasets_sub, uid, name, command): QDockWidgetCloseDetect.__init__(self, "Applet: " + name) self.setObjectName("applet" + str(uid)) @@ -137,7 +137,7 @@ class AppletDock(QDockWidgetCloseDetect): def fix_initial_size(self): self.embed_window.resize(self.embed_widget.size()) - async def terminate(self): + async def terminate(self, delete_self=True): if self.starting_stopping: return self.starting_stopping = True @@ -163,8 +163,12 @@ class AppletDock(QDockWidgetCloseDetect): self.starting_stopping = False + if delete_self: + self.setParent(None) + self.deleteLater() + async def restart(self): - await self.terminate() + await self.terminate(False) await self.start() @@ -235,7 +239,7 @@ class AppletsDock(QtWidgets.QDockWidget): self.table.cellChanged.connect(self.cell_changed) def create(self, uid, name, command): - dock = AppletDock(self.datasets_sub, uid, name, command) + dock = _AppletDock(self.datasets_sub, uid, name, command) self.main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock) dock.setFloating(True) asyncio.ensure_future(dock.start()) diff --git a/artiq/gui/log.py b/artiq/gui/log.py index 3a33a9d3d..5b5dbbd39 100644 --- a/artiq/gui/log.py +++ b/artiq/gui/log.py @@ -303,6 +303,9 @@ class LogDockManager: return dock def on_dock_closed(self, name): + dock = self.docks[name] + dock.setParent(None) + dock.deleteLater() del self.docks[name] self.update_closable()