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: 26a6e8c5dee9
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: 6a972eb59132
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Jan 10, 2016

  1. Copy the full SHA
    e6e6b27 View commit details
  2. Copy the full SHA
    6a972eb View commit details
Showing with 5 additions and 326 deletions.
  1. +0 −1 artiq/frontend/artiq_gui.py
  2. +1 −94 artiq/gui/datasets.py
  3. +0 −217 artiq/gui/displays.py
  4. +2 −7 artiq/gui/log.py
  5. +2 −7 artiq/gui/shortcuts.py
1 change: 0 additions & 1 deletion artiq/frontend/artiq_gui.py
Original file line number Diff line number Diff line change
@@ -109,7 +109,6 @@ def main():
rpc_clients["experiment_db"])

d_datasets = datasets.DatasetsDock(win, dock_area, sub_clients["datasets"])
smgr.register(d_datasets)

appletmgr = applets.AppletManager(dock_area)
atexit_register_coroutine(appletmgr.stop)
95 changes: 1 addition & 94 deletions artiq/gui/datasets.py
Original file line number Diff line number Diff line change
@@ -9,12 +9,6 @@

from artiq.tools import short_format
from artiq.gui.models import DictSyncTreeSepModel
from artiq.gui.displays import *

try:
QSortFilterProxyModel = QtCore.QSortFilterProxyModel
except AttributeError:
QSortFilterProxyModel = QtGui.QSortFilterProxyModel


logger = logging.getLogger(__name__)
@@ -35,12 +29,6 @@ def convert(self, k, v, column):
raise ValueError


def _get_display_type_name(display_cls):
for name, (_, cls) in display_types.items():
if cls is display_cls:
return name


class DatasetsDock(dockarea.Dock):
def __init__(self, dialog_parent, dock_area, datasets_sub):
dockarea.Dock.__init__(self, "Datasets")
@@ -62,19 +50,6 @@ def __init__(self, dialog_parent, dock_area, datasets_sub):

self.table_model = Model(dict())
datasets_sub.add_setmodel_callback(self.set_model)
datasets_sub.notify_cbs.append(self.on_mod)

add_display_box = QtGui.QGroupBox("Add display")
grid.addWidget(add_display_box, 1, 1)
display_grid = QtGui.QGridLayout()
add_display_box.setLayout(display_grid)

for n, name in enumerate(display_types.keys()):
btn = QtGui.QPushButton(name)
display_grid.addWidget(btn, n, 0)
btn.clicked.connect(partial(self.create_dialog, name))

self.displays = dict()

def _search_datasets(self):
if hasattr(self, "table_model_filter"):
@@ -83,74 +58,6 @@ def _search_datasets(self):

def set_model(self, model):
self.table_model = model
self.table_model_filter = QSortFilterProxyModel()
self.table_model_filter = QtCore.QSortFilterProxyModel()
self.table_model_filter.setSourceModel(self.table_model)
self.table.setModel(self.table_model_filter)

def update_display_data(self, dsp):
filtered_data = {k: self.table_model.backing_store[k][1]
for k in dsp.data_sources()
if k in self.table_model.backing_store}
dsp.update_data(filtered_data)

def on_mod(self, mod):
if mod["action"] == "init":
for display in self.displays.values():
display.update_data(self.table_model.backing_store)
return

if mod["path"]:
source = mod["path"][0]
elif mod["action"] == "setitem":
source = mod["key"]
else:
return

for display in self.displays.values():
if source in display.data_sources():
self.update_display_data(display)

def create_dialog(self, ty):
dlg_class = display_types[ty][0]
dlg = dlg_class(self.dialog_parent, None, dict(),
sorted(self.table_model.backing_store.keys()),
partial(self.create_display, ty, None))
dlg.open()

def create_display(self, ty, prev_name, name, settings):
if prev_name is not None and prev_name in self.displays:
raise NotImplementedError
dsp_class = display_types[ty][1]
dsp = dsp_class(name, settings)
self.displays[name] = dsp
self.update_display_data(dsp)

def on_close():
del self.displays[name]
dsp.sigClosed.connect(on_close)
self.dock_area.floatDock(dsp)
return dsp

def save_state(self):
r = dict()
for name, display in self.displays.items():
r[name] = {
"ty": _get_display_type_name(type(display)),
"settings": display.settings,
"state": display.save_state()
}
return r

def restore_state(self, state):
for name, desc in state.items():
try:
dsp = self.create_display(desc["ty"], None, name,
desc["settings"])
except:
logger.warning("Failed to create display '%s'", name,
exc_info=True)
try:
dsp.restore_state(desc["state"])
except:
logger.warning("Failed to restore display state of '%s'",
name, exc_info=True)
217 changes: 0 additions & 217 deletions artiq/gui/displays.py

This file was deleted.

9 changes: 2 additions & 7 deletions artiq/gui/log.py
Original file line number Diff line number Diff line change
@@ -8,11 +8,6 @@

from artiq.gui.tools import log_level_to_name

try:
QSortFilterProxyModel = QtCore.QSortFilterProxyModel
except AttributeError:
QSortFilterProxyModel = QtGui.QSortFilterProxyModel


class Model(QtCore.QAbstractTableModel):
def __init__(self, init):
@@ -107,9 +102,9 @@ def data(self, index, role):
return v[3]


class _LogFilterProxyModel(QSortFilterProxyModel):
class _LogFilterProxyModel(QtCore.QSortFilterProxyModel):
def __init__(self, min_level, freetext):
QSortFilterProxyModel.__init__(self)
QtCore.QSortFilterProxyModel.__init__(self)
self.min_level = min_level
self.freetext = freetext

9 changes: 2 additions & 7 deletions artiq/gui/shortcuts.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import logging
from functools import partial

from quamash import QtGui, QtCore
from quamash import QtGui, QtCore, QtWidgets
from pyqtgraph import dockarea
try:
from quamash import QtWidgets
QShortcut = QtWidgets.QShortcut
except:
QShortcut = QtGui.QShortcut


logger = logging.getLogger(__name__)
@@ -66,7 +61,7 @@ def __init__(self, main_window, exp_manager):
"open": open,
"submit": submit
}
shortcut = QShortcut("F" + str(i+1), main_window)
shortcut = QtWidgets.QShortcut("F" + str(i+1), main_window)
shortcut.setContext(QtCore.Qt.ApplicationShortcut)
shortcut.activated.connect(partial(self._activated, i))