Skip to content

Commit

Permalink
gui: handle exit in explorer
Browse files Browse the repository at this point in the history
sbourdeauducq committed Jan 27, 2015
1 parent d2d07f2 commit 71c5115
Showing 2 changed files with 13 additions and 12 deletions.
9 changes: 4 additions & 5 deletions artiq/frontend/artiq_gui.py
Original file line number Diff line number Diff line change
@@ -67,20 +67,19 @@ def main():
atexit.register(
lambda: loop.run_until_complete(parameters_win.sub_close()))

def exit(*args):
lmgr.save()
Gtk.main_quit(*args)
explorer_win = lmgr.create_window(ExplorerWindow,
"explorer",
exit,
schedule_ctl,
repository)
loop.run_until_complete(explorer_win.load_controls())
scheduler_win.show_all()
parameters_win.show_all()
explorer_win.show_all()

def exit(*args):
lmgr.save()
Gtk.main_quit(*args)
explorer_win.connect("delete-event", exit)

rtr = RTResults()
loop.run_until_complete(rtr.sub_connect(
args.server, args.port_notify))
16 changes: 9 additions & 7 deletions artiq/gui/explorer.py
Original file line number Diff line number Diff line change
@@ -6,14 +6,15 @@


class ExplorerWindow(Window):
def __init__(self, schedule_ctl, repository, layout_dict=dict()):
def __init__(self, exit_fn, schedule_ctl, repository, layout_dict=dict()):
self.schedule_ctl = schedule_ctl
self.repository = repository

Window.__init__(self,
title="Explorer",
default_size=(800, 570),
layout_dict=layout_dict)
self.connect("delete-event", exit_fn)

topvbox = Gtk.VBox(spacing=6)
self.add(topvbox)
@@ -23,13 +24,14 @@ def __init__(self, schedule_ctl, repository, layout_dict=dict()):

windows = Gtk.MenuItem("Windows")
windows_menu = Gtk.Menu()
scheduler = Gtk.MenuItem("Scheduler")
parameters = Gtk.MenuItem("Parameters")
quit = Gtk.MenuItem("Quit")
windows_menu.append(scheduler)
windows_menu.append(parameters)
menuitem = Gtk.MenuItem("Scheduler")
windows_menu.append(menuitem)
menuitem = Gtk.MenuItem("Parameters")
windows_menu.append(menuitem)
windows_menu.append(Gtk.SeparatorMenuItem())
windows_menu.append(quit)
menuitem = Gtk.MenuItem("Quit")
menuitem.connect("activate", exit_fn)
windows_menu.append(menuitem)
windows.set_submenu(windows_menu)
menubar.append(windows)

0 comments on commit 71c5115

Please sign in to comment.