From cda394e0ceb5bd8e47c134023af765a7ad58c18d Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 31 Dec 2014 11:11:38 +0800 Subject: [PATCH] gui: add basic parameters window --- artiq/gui/parameters.py | 19 +++++++++++++++++++ artiq/gui/scheduler.py | 1 - frontend/artiq_gui.py | 17 +++++++++++------ 3 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 artiq/gui/parameters.py diff --git a/artiq/gui/parameters.py b/artiq/gui/parameters.py new file mode 100644 index 000000000..00bb73bab --- /dev/null +++ b/artiq/gui/parameters.py @@ -0,0 +1,19 @@ +from gi.repository import Gtk + +from artiq.gui.tools import Window + + +class ParametersWindow(Window): + def __init__(self): + Window.__init__(self, title="Parameters") + self.set_default_size(500, 500) + + self.parameters_store = Gtk.ListStore(str, str) + tree = Gtk.TreeView(self.parameters_store) + for i, title in enumerate(["Parameter", "Value"]): + renderer = Gtk.CellRendererText() + column = Gtk.TreeViewColumn(title, renderer, text=i) + tree.append_column(column) + scroll = Gtk.ScrolledWindow() + scroll.add(tree) + self.add(scroll) diff --git a/artiq/gui/scheduler.py b/artiq/gui/scheduler.py index 76f423e3b..a3c7b041e 100644 --- a/artiq/gui/scheduler.py +++ b/artiq/gui/scheduler.py @@ -89,7 +89,6 @@ class SchedulerWindow(Window): hbox = Gtk.HBox(spacing=6) enable = Gtk.Switch(active=True) label = Gtk.Label("Run experiments") - label.set_justify(Gtk.Justification.RIGHT) hbox.pack_start(label, False, False, 0) hbox.pack_start(enable, False, False, 0) topvbox.pack_start(hbox, False, False, 0) diff --git a/frontend/artiq_gui.py b/frontend/artiq_gui.py index 99efe08c6..26e50faad 100755 --- a/frontend/artiq_gui.py +++ b/frontend/artiq_gui.py @@ -7,6 +7,7 @@ import gbulb from gi.repository import Gtk from artiq.gui.scheduler import SchedulerWindow +from artiq.gui.parameters import ParametersWindow def _get_args(): @@ -29,16 +30,20 @@ def main(): asyncio.set_event_loop_policy(gbulb.GtkEventLoopPolicy()) loop = asyncio.get_event_loop() try: - win = SchedulerWindow() - win.connect("delete-event", Gtk.main_quit) - win.show_all() + scheduler_win = SchedulerWindow() + scheduler_win.connect("delete-event", Gtk.main_quit) + scheduler_win.show_all() - loop.run_until_complete(win.sub_connect(args.server, - args.port_schedule_notify)) + parameters_win = ParametersWindow() + parameters_win.connect("delete-event", Gtk.main_quit) + parameters_win.show_all() + + loop.run_until_complete(scheduler_win.sub_connect( + args.server, args.port_schedule_notify)) try: loop.run_forever() finally: - loop.run_until_complete(win.sub_close()) + loop.run_until_complete(scheduler_win.sub_close()) finally: loop.close()