From 5e094528c192b3d17e2816822d325e406588bbd4 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Thu, 12 May 2016 19:06:33 +0200 Subject: [PATCH] browser: toolbar, rm mdiarea tooltip (closes #433) --- artiq/browser/experiments.py | 5 ++--- artiq/frontend/artiq_browser.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/artiq/browser/experiments.py b/artiq/browser/experiments.py index c939c99fd..e6a4db792 100644 --- a/artiq/browser/experiments.py +++ b/artiq/browser/experiments.py @@ -348,7 +348,6 @@ class ExperimentsArea(QtWidgets.QMdiArea): self.pixmap = QtGui.QPixmap(os.path.join( artiq_dir, "gui", "logo20.svg")) self.current_dir = root - self.setToolTip("Click to open experiment") self.open_experiments = [] @@ -364,7 +363,7 @@ class ExperimentsArea(QtWidgets.QMdiArea): def mousePressEvent(self, ev): if ev.button() == QtCore.Qt.LeftButton: - asyncio.ensure_future(self._select_experiment_task()) + self.select_experiment() def paintEvent(self, event): QtWidgets.QMdiArea.paintEvent(self, event) @@ -389,7 +388,7 @@ class ExperimentsArea(QtWidgets.QMdiArea): ex_state["arguments"]) dock.restore_state(ex_state["dock"]) - def _select_experiment(self): + def select_experiment(self): asyncio.ensure_future(self._select_experiment_task()) async def _select_experiment_task(self): diff --git a/artiq/frontend/artiq_browser.py b/artiq/frontend/artiq_browser.py index 628f15f28..144104c4a 100755 --- a/artiq/frontend/artiq_browser.py +++ b/artiq/frontend/artiq_browser.py @@ -81,6 +81,7 @@ def main(): # initialize main window main_window = MainWindow() smgr.register(main_window) + main_window.setUnifiedTitleAndToolBarOnMac(True) status_bar = QtWidgets.QStatusBar() main_window.setStatusBar(status_bar) @@ -105,6 +106,17 @@ def main(): main_window.addDockWidget(QtCore.Qt.BottomDockWidgetArea, d_applets) main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, d_datasets) + toolbar = main_window.addToolBar("Experiment") + toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) + + open_action = QtWidgets.QAction("Open Experiment", main_window) + open_action.setIcon(app.style().standardIcon( + QtWidgets.QStyle.SP_DialogOpenButton)) + open_action.setShortcuts(QtGui.QKeySequence.Open) + open_action.setStatusTip("Open existing experiment from file") + open_action.triggered.connect(mdi_area.select_experiment) + toolbar.addAction(open_action) + # load/initialize state if os.name == "nt": # HACK: show the main window before creating applets.