better add_new_desc_to_list; fixed multi plots with marked image; typo
This commit is contained in:
@ -109,7 +109,7 @@ class MainWindow(QMainWindow):
|
|||||||
The configuration is forwarded to the constructor of PlotDescription.
|
The configuration is forwarded to the constructor of PlotDescription.
|
||||||
Allowed keys are: title, xlabel, ylabel, xs, ys.
|
Allowed keys are: title, xlabel, ylabel, xs, ys.
|
||||||
"""
|
"""
|
||||||
desc = self.add_new_desc_to_list(name, cfg)
|
desc = self.add_new_desc_to_list(PlotDescription, name, cfg)
|
||||||
if self.menu_settings.checkboxes["Open new plots"].isChecked():
|
if self.menu_settings.checkboxes["Open new plots"].isChecked():
|
||||||
if not self.mdi.findSubWindow(name):
|
if not self.mdi.findSubWindow(name):
|
||||||
self.sig_make_new_plot.emit(name, desc)
|
self.sig_make_new_plot.emit(name, desc)
|
||||||
@ -150,7 +150,7 @@ class MainWindow(QMainWindow):
|
|||||||
The configuration is forwarded to the constructor of ImageDescription.
|
The configuration is forwarded to the constructor of ImageDescription.
|
||||||
Allowed keys are: title, xlabel, ylabel, image.
|
Allowed keys are: title, xlabel, ylabel, image.
|
||||||
"""
|
"""
|
||||||
desc = self.add_new_desc_to_list(name, cfg, Desc=ImageDescription) #TODO: clean up Desc argument
|
desc = self.add_new_desc_to_list(ImageDescription, name, cfg)
|
||||||
if self.menu_settings.checkboxes["Open new plots"].isChecked():
|
if self.menu_settings.checkboxes["Open new plots"].isChecked():
|
||||||
sub = self.mdi.findSubWindow(name)
|
sub = self.mdi.findSubWindow(name)
|
||||||
if sub:
|
if sub:
|
||||||
@ -209,8 +209,8 @@ class MainWindow(QMainWindow):
|
|||||||
for fn in fns:
|
for fn in fns:
|
||||||
data = read_dict(fn)
|
data = read_dict(fn)
|
||||||
for k, v in data.items():
|
for k, v in data.items():
|
||||||
Desc = ImageDescription if "image" in v else PlotDescription #TODO
|
DescType = ImageDescription if "image" in v else PlotDescription #TODO
|
||||||
self.add_new_desc_to_list(k, v, Desc=Desc)
|
self.add_new_desc_to_list(DescType, k, v)
|
||||||
|
|
||||||
|
|
||||||
def on_file_save(self):
|
def on_file_save(self):
|
||||||
@ -228,8 +228,8 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
# Plumbing
|
# Plumbing
|
||||||
|
|
||||||
def add_new_desc_to_list(self, name, cfg, Desc=PlotDescription): #TODO
|
def add_new_desc_to_list(self, DescType, name, cfg):
|
||||||
desc = Desc(name, **cfg)
|
desc = DescType(name, **cfg)
|
||||||
self.lst.set(name, desc)
|
self.lst.set(name, desc)
|
||||||
return desc
|
return desc
|
||||||
|
|
||||||
@ -255,13 +255,14 @@ class MainWindow(QMainWindow):
|
|||||||
for i in items:
|
for i in items:
|
||||||
i.timestamps.access.update()
|
i.timestamps.access.update()
|
||||||
i.set_alarm(False)
|
i.set_alarm(False)
|
||||||
|
items = (i for i in items if isinstance(i.value, PlotDescription)) #TODO
|
||||||
descs = {i.key: i.value for i in items}
|
descs = {i.key: i.value for i in items}
|
||||||
names = descs.keys()
|
names = descs.keys()
|
||||||
name = " | ".join(names)
|
name = " | ".join(names)
|
||||||
self.activate_or_make_subwin(MDISubMultiPlot, name, descs)
|
self.activate_or_make_subwin(MDISubMultiPlot, name, descs)
|
||||||
|
|
||||||
|
|
||||||
#TODO: the following two could be methods to MDIArea?
|
#TODO: the following two could be methods of MDIArea?
|
||||||
|
|
||||||
def activate_or_make_subwin(self, MDISubType, name, *args, **kwargs):
|
def activate_or_make_subwin(self, MDISubType, name, *args, **kwargs):
|
||||||
sub = self.mdi.findSubWindow(name)
|
sub = self.mdi.findSubWindow(name)
|
||||||
|
Reference in New Issue
Block a user