gui/explib: add to artiq top-level import

pull/11/merge
Sebastien Bourdeauducq 2015-02-05 19:50:03 +08:00
parent e029ebb23f
commit 4167e669d2
3 changed files with 10 additions and 6 deletions

View File

@ -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 *

View File

@ -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)

View File

@ -1,4 +1,4 @@
from artiq.gui.explib import GladeControls
from artiq import GladeControls
class Controls(GladeControls):