gui/rt_results: display group name in window title

This commit is contained in:
Sebastien Bourdeauducq 2015-01-31 16:57:50 +08:00
parent 47f1e3d7be
commit c259c4f46f
2 changed files with 11 additions and 10 deletions

View File

@ -5,10 +5,10 @@ from artiq.gui.tools import Window
class RawWindow(Window): class RawWindow(Window):
def __init__(self, set_names): def __init__(self, group_name, set_names):
self.labels = dict() self.labels = dict()
Window.__init__(self, title="Raw values", Window.__init__(self, title=group_name + ": Raw values",
default_size=(200, 150)) default_size=(200, 150))
grid = Gtk.Grid(row_spacing=6, column_spacing=6) grid = Gtk.Grid(row_spacing=6, column_spacing=6)
@ -29,11 +29,11 @@ class RawWindow(Window):
class PlotWindow(Window): class PlotWindow(Window):
def __init__(self, set_names): def __init__(self, group_name, set_names):
self.set_names = set_names self.set_names = set_names
self.data = None self.data = None
Window.__init__(self, title="/".join(set_names), Window.__init__(self, title=group_name + ": " + "/".join(set_names),
default_size=(700, 500)) default_size=(700, 500))
self.darea = Gtk.DrawingArea() self.darea = Gtk.DrawingArea()

View File

@ -5,11 +5,11 @@ from artiq.protocols.sync_struct import Subscriber
from artiq.gui.rt_result_views import RawWindow, XYWindow from artiq.gui.rt_result_views import RawWindow, XYWindow
def _create_view(set_names, view_description): def _create_view(group_name, set_names, view_description):
if view_description == "raw": if view_description == "raw":
r = RawWindow(set_names) r = RawWindow(group_name, set_names)
elif view_description == "xy": elif view_description == "xy":
r = XYWindow(set_names) r = XYWindow(group_name, set_names)
else: else:
raise ValueError("Unknown view description: " + view_description) raise ValueError("Unknown view description: " + view_description)
r.show_all() r.show_all()
@ -17,7 +17,8 @@ def _create_view(set_names, view_description):
class _Group: class _Group:
def __init__(self, init): def __init__(self, name, init):
self.name = name
# data key -> list of views using it # data key -> list of views using it
self.views = defaultdict(list) self.views = defaultdict(list)
# original data # original data
@ -49,7 +50,7 @@ class _Group:
for set_names, view_description in value.items(): for set_names, view_description in value.items():
if not isinstance(set_names, tuple): if not isinstance(set_names, tuple):
set_names = (set_names, ) set_names = (set_names, )
view = _create_view(set_names, view_description) view = _create_view(self.name, set_names, view_description)
view.set_data(self.data) view.set_data(self.data)
for set_name in set_names: for set_name in set_names:
self.views[set_name].append(view) self.views[set_name].append(view)
@ -81,7 +82,7 @@ class _Groups:
def __setitem__(self, key, value): def __setitem__(self, key, value):
if key in self.groups: if key in self.groups:
self.groups[key].delete() self.groups[key].delete()
self.groups[key] = _Group(value) self.groups[key] = _Group(key, value)
def __delitem__(self, key): def __delitem__(self, key):
self.groups[key].delete() self.groups[key].delete()