diff --git a/artiq/__init__.py b/artiq/__init__.py index 29f6ef2bd..38b84d574 100644 --- a/artiq/__init__.py +++ b/artiq/__init__.py @@ -3,3 +3,4 @@ from artiq.language.db import * from artiq.language.units import check_unit from artiq.language.units import ps, ns, us, ms, s from artiq.language.units import Hz, kHz, MHz, GHz +from artiq.gui.explib import * diff --git a/artiq/gui/explib.py b/artiq/gui/explib.py index 0a3a551f8..0f1ee708b 100644 --- a/artiq/gui/explib.py +++ b/artiq/gui/explib.py @@ -1,13 +1,11 @@ -import asyncio - -from gi.repository import Gtk +import asyncio as _aio class BaseControls: def __init__(self, facilities): self.facilities = facilities - @asyncio.coroutine + @_aio.coroutine def build(self): self.finalize() @@ -21,8 +19,13 @@ class GladeControls(BaseControls): self.glade_file = glade_file self.top_widget_name = top_widget_name - @asyncio.coroutine + @_aio.coroutine def build(self): + # lazy import GTK so that the artiq top-level + # (which imports from us) can be imported on systems + # without GTK installed + from gi.repository import Gtk + self.builder = Gtk.Builder() data = yield from self.facilities.get_data(self.glade_file) self.builder.add_from_string(data) diff --git a/examples/flopping_f_simulation_gui.py b/examples/flopping_f_simulation_gui.py index 9d13795f6..e948061a4 100644 --- a/examples/flopping_f_simulation_gui.py +++ b/examples/flopping_f_simulation_gui.py @@ -1,4 +1,4 @@ -from artiq.gui.explib import GladeControls +from artiq import GladeControls class Controls(GladeControls):