forked from M-Labs/artiq
browser: pass mods to applets (closes #434)
This commit is contained in:
parent
260390b75f
commit
5b5c9b2bb7
|
@ -36,7 +36,7 @@ class DatasetsDock(QtWidgets.QDockWidget):
|
||||||
QtWidgets.QAbstractItemView.SingleSelection)
|
QtWidgets.QAbstractItemView.SingleSelection)
|
||||||
grid.addWidget(self.table, 1, 0)
|
grid.addWidget(self.table, 1, 0)
|
||||||
|
|
||||||
self.table_model = Model(dict())
|
self.set_model(Model(dict()))
|
||||||
datasets_sub.add_setmodel_callback(self.set_model)
|
datasets_sub.add_setmodel_callback(self.set_model)
|
||||||
|
|
||||||
def _search_datasets(self):
|
def _search_datasets(self):
|
||||||
|
|
|
@ -332,6 +332,10 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
|
||||||
|
|
||||||
|
|
||||||
class LocalDatasetDB:
|
class LocalDatasetDB:
|
||||||
|
def __init__(self, datasets_sub):
|
||||||
|
self.datasets_sub = datasets_sub
|
||||||
|
datasets_sub.add_setmodel_callback(self.init)
|
||||||
|
|
||||||
def init(self, data):
|
def init(self, data):
|
||||||
self._data = data
|
self._data = data
|
||||||
|
|
||||||
|
@ -339,6 +343,7 @@ class LocalDatasetDB:
|
||||||
return self._data.backing_store[key][1]
|
return self._data.backing_store[key][1]
|
||||||
|
|
||||||
def update(self, mod):
|
def update(self, mod):
|
||||||
|
self.datasets_sub.update(mod)
|
||||||
process_mod(self._data, mod)
|
process_mod(self._data, mod)
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,8 +356,7 @@ class ExperimentsArea(QtWidgets.QMdiArea):
|
||||||
|
|
||||||
self.open_experiments = []
|
self.open_experiments = []
|
||||||
|
|
||||||
self._ddb = LocalDatasetDB()
|
self._ddb = LocalDatasetDB(datasets_sub)
|
||||||
datasets_sub.add_setmodel_callback(self._ddb.init)
|
|
||||||
|
|
||||||
self.worker_handlers = {
|
self.worker_handlers = {
|
||||||
"get_device_db": lambda: None,
|
"get_device_db": lambda: None,
|
||||||
|
|
|
@ -32,12 +32,14 @@ class LocalModelManager(ModelManager):
|
||||||
ModelManager.__init__(self, model_factory)
|
ModelManager.__init__(self, model_factory)
|
||||||
self.notify_cbs = []
|
self.notify_cbs = []
|
||||||
|
|
||||||
def init(self, struct):
|
def update(self, mod):
|
||||||
self._create_model(struct)
|
|
||||||
mod = {"action": "init", "struct": struct}
|
|
||||||
for notify_cb in self.notify_cbs:
|
for notify_cb in self.notify_cbs:
|
||||||
notify_cb(mod)
|
notify_cb(mod)
|
||||||
|
|
||||||
|
def init(self, struct):
|
||||||
|
self._create_model(struct)
|
||||||
|
self.update({"action": "init", "struct": struct})
|
||||||
|
|
||||||
|
|
||||||
class _SyncSubstruct:
|
class _SyncSubstruct:
|
||||||
def __init__(self, update_cb, ref):
|
def __init__(self, update_cb, ref):
|
||||||
|
|
Loading…
Reference in New Issue