From af317f9b64c080c725fb4e88bac2567d90bf40a1 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Fri, 20 May 2016 16:11:34 +0200 Subject: [PATCH] gui.models: clean up LocalModelManager a bit --- artiq/browser/experiments.py | 2 -- artiq/gui/models.py | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/artiq/browser/experiments.py b/artiq/browser/experiments.py index d6f1da9dd..bafd0986c 100644 --- a/artiq/browser/experiments.py +++ b/artiq/browser/experiments.py @@ -11,7 +11,6 @@ from artiq import __artiq_dir__ as artiq_dir from artiq.gui.tools import LayoutWidget, log_level_to_name, get_open_file_name from artiq.gui.entries import argty_to_entry from artiq.protocols import pyon -from artiq.protocols.sync_struct import process_mod from artiq.master.worker import Worker, log_worker_exception logger = logging.getLogger(__name__) @@ -341,7 +340,6 @@ class LocalDatasetDB: def update(self, mod): self.datasets_sub.update(mod) - process_mod(self._data, mod) class ExperimentsArea(QtWidgets.QMdiArea): diff --git a/artiq/gui/models.py b/artiq/gui/models.py index df4750509..63ecd2a0b 100644 --- a/artiq/gui/models.py +++ b/artiq/gui/models.py @@ -1,6 +1,6 @@ from PyQt5 import QtCore -from artiq.protocols.sync_struct import Subscriber +from artiq.protocols.sync_struct import Subscriber, process_mod class ModelManager: @@ -33,12 +33,15 @@ class LocalModelManager(ModelManager): self.notify_cbs = [] def update(self, mod): + process_mod(self.model, 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}) + mod = {"action": "init", "struct": struct} + for notify_cb in self.notify_cbs: + notify_cb(mod) class _SyncSubstruct: