From 21507b8c12042c5388f3241058efab0a3ae1e6c5 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Mon, 19 Dec 2022 13:48:02 +0100 Subject: [PATCH] moved MDISubPlot to separate file --- mainwin.py | 3 ++- mdi.py => mdiarea.py | 20 +------------------- mdisubplot.py | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 20 deletions(-) rename mdi.py => mdiarea.py (73%) create mode 100644 mdisubplot.py diff --git a/mainwin.py b/mainwin.py index 2438ab4..5c66198 100644 --- a/mainwin.py +++ b/mainwin.py @@ -3,7 +3,8 @@ from PyQt5.QtWidgets import QMainWindow, QSplitter import assets from dictlist import DictList -from mdi import MDIArea, MDISubPlot +from mdiarea import MDIArea +from mdisubplot import MDISubPlot from rpcserverthread import RPCServerThread from plotdesc import PlotDescription from exampledata import exampledata diff --git a/mdi.py b/mdiarea.py similarity index 73% rename from mdi.py rename to mdiarea.py index 8943f34..316c4e2 100644 --- a/mdi.py +++ b/mdiarea.py @@ -1,7 +1,5 @@ -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QMdiArea, QMdiSubWindow, QAction +from PyQt5.QtWidgets import QMdiArea, QAction from PyQt5.QtGui import QPainter -import pyqtgraph as pg import assets from theme import MDI_BKG @@ -69,19 +67,3 @@ class MDIArea(QMdiArea): -class MDISubPlot(QMdiSubWindow): - - def __init__(self, title, desc, *args, **kwargs): - super().__init__(*args, **kwargs) - self.setWindowTitle(title) - self.setWindowIcon(assets.char()) - - # without this, the SubWindow is not removed from the subWindowList - self.setAttribute(Qt.WA_DeleteOnClose) - - plt = pg.PlotWidget() - self.plot = desc.make_plot(plt) - self.setWidget(plt) - - - diff --git a/mdisubplot.py b/mdisubplot.py new file mode 100644 index 0000000..e7779d7 --- /dev/null +++ b/mdisubplot.py @@ -0,0 +1,22 @@ +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QMdiSubWindow +import pyqtgraph as pg +import assets + + +class MDISubPlot(QMdiSubWindow): + + def __init__(self, title, desc, *args, **kwargs): + super().__init__(*args, **kwargs) + self.setWindowTitle(title) + self.setWindowIcon(assets.char()) + + # without this, the SubWindow is not removed from the subWindowList + self.setAttribute(Qt.WA_DeleteOnClose) + + plt = pg.PlotWidget() + self.plot = desc.make_plot(plt) + self.setWidget(plt) + + +