gui: make plot windows children of the node, so they close automatically

Change-Id: I025bff02bc566be8bbaa8d90bf0035d1e2bf2a69
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/30494
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Georg Brandl <g.brandl@fz-juelich.de>
This commit is contained in:
Georg Brandl
2023-02-21 17:20:28 +01:00
committed by Markus Zolliker
parent e0132ed201
commit 65c5277a79
2 changed files with 10 additions and 4 deletions

View File

@ -273,7 +273,7 @@ class NodeWidget(QWidget):
plot.addCurve(self._node, module, param)
plot.setCurveColor(module, param, Colors.colors[len(plot.curves) % 6])
else:
plot = getPlotWidget()
plot = getPlotWidget(self)
plot.addCurve(self._node, module, param)
plot.setCurveColor(module, param, Colors.colors[1])
self._activePlots[(module, param)] = plot

View File

@ -9,14 +9,20 @@ except ImportError:
from frappy.gui.util import Colors
from frappy.gui.qt import QWidget, QVBoxLayout, QLabel, Qt, pyqtSignal
def getPlotWidget():
def getPlotWidget(parent):
if pg:
pg.setConfigOption('background', Colors.colors['plot-bg'])
pg.setConfigOption('foreground', Colors.colors['plot-fg'])
if pg is None:
return PlotPlaceHolderWidget()
return PlotWidget()
window = PlotPlaceHolderWidget(parent)
else:
window = PlotWidget(parent)
window.setWindowFlags(Qt.WindowType.Window)
return window
class PlotPlaceHolderWidget(QWidget):
closed = pyqtSignal(object)