Skip to content

Commit

Permalink
applets/TitleApplet: support hierarchical datasets in titles
Browse files Browse the repository at this point in the history
sbourdeauducq committed Apr 6, 2016
1 parent 356afb0 commit 364e3d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions artiq/applets/simple.py
Original file line number Diff line number Diff line change
@@ -236,7 +236,7 @@ def __init__(self, *args, **kwargs):
self.argparser.add_argument("--title", default=None,
help="set title (can be a Python format "
"string where field names are dataset "
"names)")
"names, replace '.' with '/')")

def args_init(self):
SimpleApplet.args_init(self)
@@ -248,12 +248,12 @@ def args_init(self):
break
if not format_field:
raise ValueError("Invalid title format string")
self.dataset_title.add(format_field)
self.dataset_title.add(format_field.replace("/", "."))
self.datasets |= self.dataset_title

def emit_data_changed(self, data, mod_buffer):
if self.args.title is not None:
title_values = {k: data.get(k, (False, None))[1]
title_values = {k.replace(".", "/"): data.get(k, (False, None))[1]
for k in self.dataset_title}
try:
title = self.args.title.format(**title_values)

0 comments on commit 364e3d4

Please sign in to comment.