forked from M-Labs/artiq
1
0
Fork 0

browser: pass mods to applets (closes #434)

This commit is contained in:
Robert Jördens 2016-05-13 15:27:23 +02:00
parent 260390b75f
commit 5b5c9b2bb7
3 changed files with 12 additions and 6 deletions

View File

@ -36,7 +36,7 @@ class DatasetsDock(QtWidgets.QDockWidget):
QtWidgets.QAbstractItemView.SingleSelection)
grid.addWidget(self.table, 1, 0)
self.table_model = Model(dict())
self.set_model(Model(dict()))
datasets_sub.add_setmodel_callback(self.set_model)
def _search_datasets(self):

View File

@ -332,6 +332,10 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
class LocalDatasetDB:
def __init__(self, datasets_sub):
self.datasets_sub = datasets_sub
datasets_sub.add_setmodel_callback(self.init)
def init(self, data):
self._data = data
@ -339,6 +343,7 @@ class LocalDatasetDB:
return self._data.backing_store[key][1]
def update(self, mod):
self.datasets_sub.update(mod)
process_mod(self._data, mod)
@ -351,8 +356,7 @@ class ExperimentsArea(QtWidgets.QMdiArea):
self.open_experiments = []
self._ddb = LocalDatasetDB()
datasets_sub.add_setmodel_callback(self._ddb.init)
self._ddb = LocalDatasetDB(datasets_sub)
self.worker_handlers = {
"get_device_db": lambda: None,

View File

@ -32,12 +32,14 @@ class LocalModelManager(ModelManager):
ModelManager.__init__(self, model_factory)
self.notify_cbs = []
def init(self, struct):
self._create_model(struct)
mod = {"action": "init", "struct": struct}
def update(self, mod):
for notify_cb in self.notify_cbs:
notify_cb(mod)
def init(self, struct):
self._create_model(struct)
self.update({"action": "init", "struct": struct})
class _SyncSubstruct:
def __init__(self, update_cb, ref):