From c259c4f46fb150f9c5e0f2e8bc57f33358339210 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 31 Jan 2015 16:57:50 +0800 Subject: [PATCH] gui/rt_results: display group name in window title --- artiq/gui/rt_result_views.py | 8 ++++---- artiq/gui/rt_results.py | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/artiq/gui/rt_result_views.py b/artiq/gui/rt_result_views.py index e47043703..c3f593ad4 100644 --- a/artiq/gui/rt_result_views.py +++ b/artiq/gui/rt_result_views.py @@ -5,10 +5,10 @@ from artiq.gui.tools import Window class RawWindow(Window): - def __init__(self, set_names): + def __init__(self, group_name, set_names): self.labels = dict() - Window.__init__(self, title="Raw values", + Window.__init__(self, title=group_name + ": Raw values", default_size=(200, 150)) grid = Gtk.Grid(row_spacing=6, column_spacing=6) @@ -29,11 +29,11 @@ class RawWindow(Window): class PlotWindow(Window): - def __init__(self, set_names): + def __init__(self, group_name, set_names): self.set_names = set_names self.data = None - Window.__init__(self, title="/".join(set_names), + Window.__init__(self, title=group_name + ": " + "/".join(set_names), default_size=(700, 500)) self.darea = Gtk.DrawingArea() diff --git a/artiq/gui/rt_results.py b/artiq/gui/rt_results.py index 18dd300a7..e97c15409 100644 --- a/artiq/gui/rt_results.py +++ b/artiq/gui/rt_results.py @@ -5,11 +5,11 @@ from artiq.protocols.sync_struct import Subscriber 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": - r = RawWindow(set_names) + r = RawWindow(group_name, set_names) elif view_description == "xy": - r = XYWindow(set_names) + r = XYWindow(group_name, set_names) else: raise ValueError("Unknown view description: " + view_description) r.show_all() @@ -17,7 +17,8 @@ def _create_view(set_names, view_description): class _Group: - def __init__(self, init): + def __init__(self, name, init): + self.name = name # data key -> list of views using it self.views = defaultdict(list) # original data @@ -49,7 +50,7 @@ class _Group: for set_names, view_description in value.items(): if not isinstance(set_names, tuple): 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) for set_name in set_names: self.views[set_name].append(view) @@ -81,7 +82,7 @@ class _Groups: def __setitem__(self, key, value): if key in self.groups: self.groups[key].delete() - self.groups[key] = _Group(value) + self.groups[key] = _Group(key, value) def __delitem__(self, key): self.groups[key].delete()