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: f602928e8964
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: 136d44d9db79
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Sep 1, 2015

  1. Copy the full SHA
    a059ebf View commit details
  2. Copy the full SHA
    6dba0e9 View commit details
  3. Copy the full SHA
    136d44d View commit details
Showing with 30 additions and 14 deletions.
  1. +23 −10 artiq/gui/moninj.py
  2. +1 −1 artiq/tools.py
  3. +6 −3 examples/master/ddb.pyon
33 changes: 23 additions & 10 deletions artiq/gui/moninj.py
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@


class _TTLWidget(QtGui.QFrame):
def __init__(self, send_to_device, channel, force_out, name):
def __init__(self, send_to_device, channel, force_out, title):
self.send_to_device = send_to_device
self.channel = channel
self.force_out = force_out
@@ -35,8 +35,9 @@ def __init__(self, send_to_device, channel, force_out, name):

grid = QtGui.QGridLayout()
self.setLayout(grid)
label = QtGui.QLabel(name)
label = QtGui.QLabel(title)
label.setAlignment(QtCore.Qt.AlignCenter)
label.setWordWrap(True)
grid.addWidget(label, 1, 1)

self._direction = QtGui.QLabel()
@@ -77,6 +78,12 @@ def __init__(self, send_to_device, channel, force_out, name):
self._value.addAction(self._forcein_action)
self._forcein_action.triggered.connect(lambda: self.set_mode("in"))

grid.setRowStretch(1, 1)
grid.setRowStretch(2, 0)
grid.setRowStretch(3, 0)
grid.setRowStretch(4, 0)
grid.setRowStretch(5, 1)

self.set_value(0, False, False)

def set_mode(self, mode):
@@ -112,11 +119,8 @@ def set_value(self, value, oe, override):


class _DDSWidget(QtGui.QFrame):
def __init__(self, send_to_device, channel, sysclk, name):
self.send_to_device = send_to_device
self.channel = channel
def __init__(self, sysclk, title):
self.sysclk = sysclk
self.name = name

QtGui.QFrame.__init__(self)

@@ -125,14 +129,20 @@ def __init__(self, send_to_device, channel, sysclk, name):

grid = QtGui.QGridLayout()
self.setLayout(grid)
label = QtGui.QLabel(name)
label = QtGui.QLabel(title)
label.setAlignment(QtCore.Qt.AlignCenter)
label.setWordWrap(True)
grid.addWidget(label, 1, 1)

self._value = QtGui.QLabel()
self._value.setAlignment(QtCore.Qt.AlignCenter)
self._value.setWordWrap(True)
grid.addWidget(self._value, 2, 1, 6, 1)

grid.setRowStretch(1, 1)
grid.setRowStretch(2, 0)
grid.setRowStretch(3, 1)

self.set_value(0)

def set_value(self, ftw):
@@ -160,18 +170,20 @@ def __setitem__(self, k, v):
return
try:
if v["type"] == "local":
title = k
if "comment" in v:
title += ": " + v["comment"]
if v["module"] == "artiq.coredevice.ttl":
channel = v["arguments"]["channel"]
force_out = v["class"] == "TTLOut"
self.ttl_widgets[channel] = _TTLWidget(
self.send_to_device, channel, force_out, k)
self.send_to_device, channel, force_out, title)
self.ttl_cb()
if (v["module"] == "artiq.coredevice.dds"
and v["class"] in {"AD9858", "AD9914"}):
channel = v["arguments"]["channel"]
sysclk = v["arguments"]["sysclk"]
self.dds_widgets[channel] = _DDSWidget(
self.send_to_device, channel, sysclk, k)
self.dds_widgets[channel] = _DDSWidget(sysclk, title)
self.dds_cb()
except KeyError:
pass
@@ -208,6 +220,7 @@ def layout_widgets(self, widgets):
w = self.grid.itemAt(0)
for i, (_, w) in enumerate(sorted(widgets, key=itemgetter(0))):
self.grid.addWidget(w, i // 4, i % 4)
self.grid.setColumnStretch(i % 4, 1)


class MonInj(TaskObject):
2 changes: 1 addition & 1 deletion artiq/tools.py
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ def get_experiment(module, experiment=None):
return getattr(module, experiment)

exps = [(k, v) for k, v in module.__dict__.items()
if is_experiment(v)]
if k[0] != "_" and is_experiment(v)]
if not exps:
raise ValueError("No experiments in module")
if len(exps) > 1:
9 changes: 6 additions & 3 deletions examples/master/ddb.pyon
Original file line number Diff line number Diff line change
@@ -29,13 +29,15 @@
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 2}
"arguments": {"channel": 2},
"comment": "This is a fairly long comment to test word wrapping in GUI."
},
"ttl1": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 3}
"arguments": {"channel": 3},
"comment": "Hello World"
},
"ttl2": {
"type": "local",
@@ -72,7 +74,8 @@
"type": "local",
"module": "artiq.coredevice.dds",
"class": "AD9858",
"arguments": {"sysclk": 1e9, "channel": 0}
"arguments": {"sysclk": 1e9, "channel": 0},
"comment": "Comments work in DDS panel as well"
},
"dds1": {
"type": "local",