2014-12-29 12:48:14 +08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import asyncio
|
|
|
|
|
|
|
|
import gbulb
|
|
|
|
from gi.repository import Gtk
|
|
|
|
|
2014-12-30 18:18:23 +08:00
|
|
|
from artiq.gui.scheduler import SchedulerWindow
|
2014-12-31 11:11:38 +08:00
|
|
|
from artiq.gui.parameters import ParametersWindow
|
2014-12-29 18:44:50 +08:00
|
|
|
|
2014-12-29 12:48:14 +08:00
|
|
|
|
|
|
|
def _get_args():
|
|
|
|
parser = argparse.ArgumentParser(description="ARTIQ GUI client")
|
|
|
|
parser.add_argument(
|
|
|
|
"-s", "--server", default="::1",
|
|
|
|
help="hostname or IP of the master to connect to")
|
|
|
|
parser.add_argument(
|
|
|
|
"--port-schedule-control", default=8888, type=int,
|
|
|
|
help="TCP port to connect to for schedule control")
|
|
|
|
parser.add_argument(
|
|
|
|
"--port-schedule-notify", default=8887, type=int,
|
|
|
|
help="TCP port to connect to for schedule notifications")
|
|
|
|
return parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
args = _get_args()
|
|
|
|
|
|
|
|
asyncio.set_event_loop_policy(gbulb.GtkEventLoopPolicy())
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
try:
|
2014-12-31 11:11:38 +08:00
|
|
|
scheduler_win = SchedulerWindow()
|
|
|
|
scheduler_win.connect("delete-event", Gtk.main_quit)
|
|
|
|
scheduler_win.show_all()
|
2014-12-29 12:48:14 +08:00
|
|
|
|
2014-12-31 11:11:38 +08:00
|
|
|
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))
|
2014-12-29 12:48:14 +08:00
|
|
|
try:
|
|
|
|
loop.run_forever()
|
|
|
|
finally:
|
2014-12-31 11:11:38 +08:00
|
|
|
loop.run_until_complete(scheduler_win.sub_close())
|
2014-12-29 12:48:14 +08:00
|
|
|
finally:
|
|
|
|
loop.close()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|