Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 122ddc40aab6
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f0e25991fe3a
Choose a head ref
  • 5 commits
  • 3 files changed
  • 1 contributor

Commits on Feb 15, 2016

  1. Copy the full SHA
    b9bce92 View commit details
  2. gui: basic MDI area

    sbourdeauducq committed Feb 15, 2016
    Copy the full SHA
    aa5f6a5 View commit details
  3. Copy the full SHA
    5307661 View commit details
  4. Copy the full SHA
    8757419 View commit details
  5. Copy the full SHA
    f0e2599 View commit details
Showing with 38 additions and 19 deletions.
  1. +9 −5 artiq/frontend/artiq_gui.py
  2. +21 −11 artiq/gui/experiments.py
  3. +8 −3 artiq/gui/explorer.py
14 changes: 9 additions & 5 deletions artiq/frontend/artiq_gui.py
Original file line number Diff line number Diff line change
@@ -93,6 +93,10 @@ def main():
status_bar = QtWidgets.QStatusBar()
status_bar.showMessage("Connected to {}".format(args.server))
main_window.setStatusBar(status_bar)
mdi_area = QtWidgets.QMdiArea()
mdi_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
mdi_area.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
main_window.setCentralWidget(mdi_area)

# create UI components
expmgr = experiments.ExperimentManager(main_window,
@@ -103,10 +107,10 @@ def main():
smgr.register(expmgr)
d_shortcuts = shortcuts.ShortcutsDock(main_window, expmgr)
smgr.register(d_shortcuts)
d_explorer = explorer.Explorer(status_bar, expmgr, d_shortcuts,
sub_clients["explist"],
rpc_clients["schedule"],
rpc_clients["experiment_db"])
d_explorer = explorer.ExplorerDock(status_bar, expmgr, d_shortcuts,
sub_clients["explist"],
rpc_clients["schedule"],
rpc_clients["experiment_db"])

d_datasets = datasets.DatasetsDock(sub_clients["datasets"],
rpc_clients["dataset_db"])
@@ -127,7 +131,6 @@ def main():
smgr.register(logmgr)

# lay out docks
main_window.setCentralWidget(d_explorer)
if os.name != "nt":
main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, d_ttl_dds.dds_dock)
main_window.tabifyDockWidget(d_ttl_dds.dds_dock, d_ttl_dds.ttl_dock)
@@ -138,6 +141,7 @@ def main():
main_window.tabifyDockWidget(d_applets, d_datasets)
main_window.tabifyDockWidget(d_datasets, d_shortcuts)
main_window.addDockWidget(QtCore.Qt.BottomDockWidgetArea, d_schedule)
main_window.addDockWidget(QtCore.Qt.LeftDockWidgetArea, d_explorer)

# load/initialize state
smgr.load()
32 changes: 21 additions & 11 deletions artiq/gui/experiments.py
Original file line number Diff line number Diff line change
@@ -5,8 +5,7 @@

from PyQt5 import QtCore, QtGui, QtWidgets

from artiq.gui.tools import (LayoutWidget, log_level_to_name,
QDockWidgetCloseDetect)
from artiq.gui.tools import LayoutWidget, log_level_to_name
from artiq.gui.entries import argty_to_entry


@@ -132,11 +131,14 @@ def restore_state(self, state):
pass


class _ExperimentDock(QDockWidgetCloseDetect):
class _ExperimentDock(QtWidgets.QMdiSubWindow):
sigClosed = QtCore.pyqtSignal()

def __init__(self, manager, expurl):
name = "Exp: " + expurl
QDockWidgetCloseDetect.__init__(self, name)
self.setObjectName(name)
QtWidgets.QMdiSubWindow.__init__(self)
self.setWindowTitle(expurl)
self.setWindowIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_FileDialogContentsView))

self.layout = QtWidgets.QGridLayout()
top_widget = QtWidgets.QWidget()
@@ -294,11 +296,19 @@ async def _recompute_arguments_task(self):
self.argeditor = _ArgumentEditor(self.manager, self, self.expurl)
self.layout.addWidget(self.argeditor, 0, 0, 1, 5)

def closeEvent(self, event):
self.sigClosed.emit()
QtWidgets.QMdiSubWindow.closeEvent(self, event)

def save_state(self):
return self.argeditor.save_state()
return {
"args": self.argeditor.save_state(),
"geometry": bytes(self.saveGeometry())
}

def restore_state(self, state):
self.argeditor.restore_state(state)
self.argeditor.restore_state(state["args"])
self.restoreGeometry(QtCore.QByteArray(state["geometry"]))


class ExperimentManager:
@@ -389,12 +399,12 @@ def get_submission_arguments(self, expurl):
def open_experiment(self, expurl):
if expurl in self.open_experiments:
dock = self.open_experiments[expurl]
dock.setFloating(True)
self.main_window.centralWidget().setActiveSubWindow(dock)
return dock
dock = _ExperimentDock(self, expurl)
self.open_experiments[expurl] = dock
self.main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
dock.setFloating(True)
self.main_window.centralWidget().addSubWindow(dock)
dock.show()
dock.sigClosed.connect(partial(self.on_dock_closed, expurl))
return dock

11 changes: 8 additions & 3 deletions artiq/gui/explorer.py
Original file line number Diff line number Diff line change
@@ -115,13 +115,18 @@ def __init__(self, init):
DictSyncTreeSepModel.__init__(self, "/", ["Experiment"], init)


class Explorer(QtWidgets.QWidget):
class ExplorerDock(QtWidgets.QDockWidget):
def __init__(self, status_bar, exp_manager, d_shortcuts,
explist_sub, schedule_ctl, experiment_db_ctl):
QtWidgets.QWidget.__init__(self)
QtWidgets.QDockWidget.__init__(self, "Explorer")
self.setObjectName("Explorer")
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
QtWidgets.QDockWidget.DockWidgetFloatable)

layout = QtWidgets.QGridLayout()
self.setLayout(layout)
top_widget = QtWidgets.QWidget()
top_widget.setLayout(layout)
self.setWidget(top_widget)
layout.setSpacing(5)
layout.setContentsMargins(5, 5, 5, 5)