From 444bab21863b85c282663c927f9ed9dd4b6d589c Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 30 May 2023 15:44:30 +0800 Subject: [PATCH] gui: datasets_sub -> dataset_sub (nfc) --- artiq/browser/datasets.py | 4 ++-- artiq/browser/experiments.py | 12 ++++++------ artiq/dashboard/datasets.py | 4 ++-- artiq/frontend/artiq_browser.py | 16 ++++++++-------- artiq/gui/applets.py | 26 +++++++++++++------------- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/artiq/browser/datasets.py b/artiq/browser/datasets.py index b66b18216..78bf6e8f7 100644 --- a/artiq/browser/datasets.py +++ b/artiq/browser/datasets.py @@ -24,7 +24,7 @@ class Model(DictSyncTreeSepModel): class DatasetsDock(QtWidgets.QDockWidget): - def __init__(self, datasets_sub, master_host, master_port): + def __init__(self, dataset_sub, master_host, master_port): QtWidgets.QDockWidget.__init__(self, "Datasets") self.setObjectName("Datasets") self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | @@ -62,7 +62,7 @@ class DatasetsDock(QtWidgets.QDockWidget): self.table.addAction(upload_action) self.set_model(Model(dict())) - datasets_sub.add_setmodel_callback(self.set_model) + dataset_sub.add_setmodel_callback(self.set_model) self.master_host = master_host self.master_port = master_port diff --git a/artiq/browser/experiments.py b/artiq/browser/experiments.py index a67b93736..23a271eb9 100644 --- a/artiq/browser/experiments.py +++ b/artiq/browser/experiments.py @@ -378,9 +378,9 @@ 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, dataset_sub): + self.dataset_sub = dataset_sub + dataset_sub.add_setmodel_callback(self.init) def init(self, data): self._data = data @@ -389,11 +389,11 @@ class LocalDatasetDB: return self._data.backing_store[key][1] def update(self, mod): - self.datasets_sub.update(mod) + self.dataset_sub.update(mod) class ExperimentsArea(QtWidgets.QMdiArea): - def __init__(self, root, datasets_sub): + def __init__(self, root, dataset_sub): QtWidgets.QMdiArea.__init__(self) self.pixmap = QtGui.QPixmap(os.path.join( artiq_dir, "gui", "logo_ver.svg")) @@ -402,7 +402,7 @@ class ExperimentsArea(QtWidgets.QMdiArea): self.open_experiments = [] - self._ddb = LocalDatasetDB(datasets_sub) + self._ddb = LocalDatasetDB(dataset_sub) self.worker_handlers = { "get_device_db": lambda: {}, diff --git a/artiq/dashboard/datasets.py b/artiq/dashboard/datasets.py index 1052e03d1..f512c3d74 100644 --- a/artiq/dashboard/datasets.py +++ b/artiq/dashboard/datasets.py @@ -106,7 +106,7 @@ class Model(DictSyncTreeSepModel): class DatasetsDock(QtWidgets.QDockWidget): - def __init__(self, datasets_sub, dataset_ctl): + def __init__(self, dataset_sub, dataset_ctl): QtWidgets.QDockWidget.__init__(self, "Datasets") self.setObjectName("Datasets") self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | @@ -146,7 +146,7 @@ class DatasetsDock(QtWidgets.QDockWidget): self.table.addAction(delete_action) self.table_model = Model(dict()) - datasets_sub.add_setmodel_callback(self.set_model) + dataset_sub.add_setmodel_callback(self.set_model) def _search_datasets(self): if hasattr(self, "table_model_filter"): diff --git a/artiq/frontend/artiq_browser.py b/artiq/frontend/artiq_browser.py index 398244b0e..af469c05a 100755 --- a/artiq/frontend/artiq_browser.py +++ b/artiq/frontend/artiq_browser.py @@ -48,7 +48,7 @@ def get_argparser(): class Browser(QtWidgets.QMainWindow): - def __init__(self, smgr, datasets_sub, browse_root, + def __init__(self, smgr, dataset_sub, browse_root, master_host, master_port, *, loop=None): QtWidgets.QMainWindow.__init__(self) smgr.register(self) @@ -65,7 +65,7 @@ class Browser(QtWidgets.QMainWindow): self.setUnifiedTitleAndToolBarOnMac(True) self.experiments = experiments.ExperimentsArea( - browse_root, datasets_sub) + browse_root, dataset_sub) smgr.register(self.experiments) self.experiments.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAsNeeded) @@ -73,7 +73,7 @@ class Browser(QtWidgets.QMainWindow): QtCore.Qt.ScrollBarAsNeeded) self.setCentralWidget(self.experiments) - self.files = files.FilesDock(datasets_sub, browse_root) + self.files = files.FilesDock(dataset_sub, browse_root) smgr.register(self.files) self.files.dataset_activated.connect( @@ -81,12 +81,12 @@ class Browser(QtWidgets.QMainWindow): self.files.dataset_changed.connect( self.experiments.dataset_changed) - self.applets = applets.AppletsDock(self, datasets_sub, loop=loop) + self.applets = applets.AppletsDock(self, dataset_sub, loop=loop) smgr.register(self.applets) atexit_register_coroutine(self.applets.stop, loop=loop) self.datasets = datasets.DatasetsDock( - datasets_sub, master_host, master_port) + dataset_sub, master_host, master_port) smgr.register(self.datasets) self.files.metadata_changed.connect(self.datasets.metadata_changed) @@ -146,12 +146,12 @@ def main(): asyncio.set_event_loop(loop) atexit.register(loop.close) - datasets_sub = models.LocalModelManager(datasets.Model) - datasets_sub.init({}) + dataset_sub = models.LocalModelManager(datasets.Model) + dataset_sub.init({}) smgr = state.StateManager(args.db_file) - browser = Browser(smgr, datasets_sub, args.browse_root, + browser = Browser(smgr, dataset_sub, args.browse_root, args.server, args.port, loop=loop) widget_log_handler.callback = browser.log.model.append diff --git a/artiq/gui/applets.py b/artiq/gui/applets.py index 275e61ba7..0e65a2ee3 100644 --- a/artiq/gui/applets.py +++ b/artiq/gui/applets.py @@ -21,9 +21,9 @@ logger = logging.getLogger(__name__) class AppletIPCServer(AsyncioParentComm): - def __init__(self, datasets_sub): + def __init__(self, dataset_sub): AsyncioParentComm.__init__(self) - self.datasets_sub = datasets_sub + self.dataset_sub = dataset_sub self.datasets = set() self.dataset_prefixes = [] @@ -60,7 +60,7 @@ class AppletIPCServer(AsyncioParentComm): self.write_pyon({"action": "mod", "mod": mod}) async def serve(self, embed_cb, fix_initial_size_cb): - self.datasets_sub.notify_cbs.append(self._on_mod) + self.dataset_sub.notify_cbs.append(self._on_mod) try: while True: obj = await self.read_pyon() @@ -74,9 +74,9 @@ class AppletIPCServer(AsyncioParentComm): elif action == "subscribe": self.datasets = obj["datasets"] self.dataset_prefixes = obj["dataset_prefixes"] - if self.datasets_sub.model is not None: + if self.dataset_sub.model is not None: mod = self._synthesize_init( - self.datasets_sub.model.backing_store) + self.dataset_sub.model.backing_store) self.write_pyon({"action": "mod", "mod": mod}) else: raise ValueError("unknown action in applet message") @@ -90,7 +90,7 @@ class AppletIPCServer(AsyncioParentComm): logger.error("error processing data from applet, " "server stopped", exc_info=True) finally: - self.datasets_sub.notify_cbs.remove(self._on_mod) + self.dataset_sub.notify_cbs.remove(self._on_mod) def start_server(self, embed_cb, fix_initial_size_cb, *, loop=None): self.server_task = asyncio.ensure_future( @@ -103,7 +103,7 @@ class AppletIPCServer(AsyncioParentComm): class _AppletDock(QDockWidgetCloseDetect): - def __init__(self, datasets_sub, uid, name, spec, extra_substitutes): + def __init__(self, dataset_sub, uid, name, spec, extra_substitutes): QDockWidgetCloseDetect.__init__(self, "Applet: " + name) self.setObjectName("applet" + str(uid)) @@ -111,7 +111,7 @@ class _AppletDock(QDockWidgetCloseDetect): self.setMinimumSize(20*qfm.averageCharWidth(), 5*qfm.lineSpacing()) self.resize(40*qfm.averageCharWidth(), 10*qfm.lineSpacing()) - self.datasets_sub = datasets_sub + self.dataset_sub = dataset_sub self.applet_name = name self.spec = spec self.extra_substitutes = extra_substitutes @@ -130,7 +130,7 @@ class _AppletDock(QDockWidgetCloseDetect): return self.starting_stopping = True try: - self.ipc = AppletIPCServer(self.datasets_sub) + self.ipc = AppletIPCServer(self.dataset_sub) env = os.environ.copy() env["PYTHONUNBUFFERED"] = "1" env["ARTIQ_APPLET_EMBED"] = self.ipc.get_address() @@ -327,7 +327,7 @@ class _CompleterDelegate(QtWidgets.QStyledItemDelegate): class AppletsDock(QtWidgets.QDockWidget): - def __init__(self, main_window, datasets_sub, extra_substitutes={}, *, loop=None): + def __init__(self, main_window, dataset_sub, extra_substitutes={}, *, loop=None): """ :param extra_substitutes: Map of extra ``${strings}`` to substitute in applet commands to their respective values. @@ -338,7 +338,7 @@ class AppletsDock(QtWidgets.QDockWidget): QtWidgets.QDockWidget.DockWidgetFloatable) self.main_window = main_window - self.datasets_sub = datasets_sub + self.dataset_sub = dataset_sub self.extra_substitutes = extra_substitutes self.applet_uids = set() @@ -364,7 +364,7 @@ class AppletsDock(QtWidgets.QDockWidget): completer_delegate = _CompleterDelegate() self.table.setItemDelegateForColumn(1, completer_delegate) - datasets_sub.add_setmodel_callback(completer_delegate.set_model) + dataset_sub.add_setmodel_callback(completer_delegate.set_model) self.table.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) new_action = QtWidgets.QAction("New applet", self.table) @@ -440,7 +440,7 @@ class AppletsDock(QtWidgets.QDockWidget): self.table.itemChanged.connect(self.item_changed) def create(self, item, name, spec): - dock = _AppletDock(self.datasets_sub, item.applet_uid, name, spec, self.extra_substitutes) + dock = _AppletDock(self.dataset_sub, item.applet_uid, name, spec, self.extra_substitutes) self.main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock) dock.setFloating(True) asyncio.ensure_future(dock.start(), loop=self._loop)