added and use a mapping DescType to MDISubType

This commit is contained in:
2023-04-15 13:51:18 +02:00
parent 839b1a1e21
commit 593241d66f

View File

@ -14,6 +14,12 @@ from .shortcut import shortcut
from .webview import WebView
DESC_TYPE_TO_MDI_SUB_TYPE = {
ImageDescription: MDISubImage,
PlotDescription: MDISubPlot
}
class MainWindow(QMainWindow):
sig_make_new_plot = pyqtSignal(str, PlotDescription)
@ -248,7 +254,8 @@ class MainWindow(QMainWindow):
item.timestamps.access.update()
item.set_alarm(False)
name, desc = item.key, item.value
MDISubType = MDISubImage if isinstance(desc, ImageDescription) else MDISubPlot #TODO
DescType = type(desc)
MDISubType = DESC_TYPE_TO_MDI_SUB_TYPE[DescType]
self.activate_or_make_subwin(MDISubType, name, desc)
def plot_multiple_items(self, items):