added set_data; refactored sync_item_and_plots
This commit is contained in:
@ -86,6 +86,7 @@ class MainWindow(QMainWindow):
|
||||
rst.start()
|
||||
rst.server.register_function(self.new_plot)
|
||||
rst.server.register_function(self.append_data)
|
||||
rst.server.register_function(self.set_data)
|
||||
|
||||
self.sig_make_new_plot.connect(self.on_make_new_plot)
|
||||
|
||||
@ -116,14 +117,17 @@ class MainWindow(QMainWindow):
|
||||
item = self.lst.get(name)
|
||||
desc = item.value
|
||||
desc.append(point)
|
||||
alarm = True
|
||||
for sub in self.mdi.subWindowList():
|
||||
if name in sub.plots:
|
||||
plot = sub.plots[name]
|
||||
plot.setData(*desc.data)
|
||||
alarm = False
|
||||
item.timestamps.modification.update()
|
||||
item.set_alarm(alarm)
|
||||
self.sync_item_and_plots(item)
|
||||
|
||||
def set_data(self, name, data):
|
||||
"""
|
||||
Set <data> as the data of the (existing) plot <name>.
|
||||
The data is assigned to the data attribute of PlotDescription.
|
||||
"""
|
||||
item = self.lst.get(name)
|
||||
desc = item.value
|
||||
desc.data = data
|
||||
self.sync_item_and_plots(item)
|
||||
|
||||
|
||||
# Signal callbacks
|
||||
@ -196,6 +200,17 @@ class MainWindow(QMainWindow):
|
||||
self.lst.set(name, desc)
|
||||
return desc
|
||||
|
||||
def sync_item_and_plots(self, item):
|
||||
name, desc = item.key, item.value
|
||||
alarm = True
|
||||
for sub in self.mdi.subWindowList():
|
||||
if name in sub.plots:
|
||||
plot = sub.plots[name]
|
||||
plot.setData(*desc.data)
|
||||
alarm = False
|
||||
item.timestamps.modification.update()
|
||||
item.set_alarm(alarm)
|
||||
|
||||
def plot_single_item(self, item):
|
||||
item.timestamps.access.update()
|
||||
item.set_alarm(False)
|
||||
|
Reference in New Issue
Block a user