forked from M-Labs/artiq
1
0
Fork 0

explorer: style (NFC)

This commit is contained in:
Simon Renblad 2024-04-10 12:28:50 +08:00 committed by Sébastien Bourdeauducq
parent 3ecd115252
commit 4f302ee675
1 changed files with 6 additions and 3 deletions

View File

@ -94,7 +94,7 @@ class _OpenFileDialog(QtWidgets.QDialog):
else: else:
break break
self.explorer.current_directory = \ self.explorer.current_directory = \
self.explorer.current_directory[:idx+1] self.explorer.current_directory[:idx + 1]
if self.explorer.current_directory == "/": if self.explorer.current_directory == "/":
self.explorer.current_directory = "" self.explorer.current_directory = ""
asyncio.ensure_future(self.refresh_view()) asyncio.ensure_future(self.refresh_view())
@ -103,6 +103,7 @@ class _OpenFileDialog(QtWidgets.QDialog):
asyncio.ensure_future(self.refresh_view()) asyncio.ensure_future(self.refresh_view())
else: else:
file = self.explorer.current_directory + selected file = self.explorer.current_directory + selected
async def open_task(): async def open_task():
try: try:
await self.exp_manager.open_file(file) await self.exp_manager.open_file(file)
@ -232,7 +233,7 @@ class ExplorerDock(QtWidgets.QDockWidget):
set_shortcut_menu = QtWidgets.QMenu() set_shortcut_menu = QtWidgets.QMenu()
for i in range(12): for i in range(12):
action = QtWidgets.QAction("F" + str(i+1), self.el) action = QtWidgets.QAction("F" + str(i + 1), self.el)
action.triggered.connect(partial(self.set_shortcut, i)) action.triggered.connect(partial(self.set_shortcut, i))
set_shortcut_menu.addAction(action) set_shortcut_menu.addAction(action)
@ -246,12 +247,14 @@ class ExplorerDock(QtWidgets.QDockWidget):
scan_repository_action = QtWidgets.QAction("Scan repository HEAD", scan_repository_action = QtWidgets.QAction("Scan repository HEAD",
self.el) self.el)
def scan_repository(): def scan_repository():
asyncio.ensure_future(experiment_db_ctl.scan_repository_async()) asyncio.ensure_future(experiment_db_ctl.scan_repository_async())
scan_repository_action.triggered.connect(scan_repository) scan_repository_action.triggered.connect(scan_repository)
self.el.addAction(scan_repository_action) self.el.addAction(scan_repository_action)
scan_ddb_action = QtWidgets.QAction("Scan device database", self.el) scan_ddb_action = QtWidgets.QAction("Scan device database", self.el)
def scan_ddb(): def scan_ddb():
asyncio.ensure_future(device_db_ctl.scan()) asyncio.ensure_future(device_db_ctl.scan())
scan_ddb_action.triggered.connect(scan_ddb) scan_ddb_action.triggered.connect(scan_ddb)
@ -292,7 +295,7 @@ class ExplorerDock(QtWidgets.QDockWidget):
if expname is not None: if expname is not None:
expurl = "repo:" + expname expurl = "repo:" + expname
self.d_shortcuts.set_shortcut(nr, expurl) self.d_shortcuts.set_shortcut(nr, expurl)
logger.info("Set shortcut F%d to '%s'", nr+1, expurl) logger.info("Set shortcut F%d to '%s'", nr + 1, expurl)
def update_scanning(self, scanning): def update_scanning(self, scanning):
if scanning: if scanning: