Lantz is an automation and instrumentation toolkit with a clean, well-designed and consistent interface. It provides a core of commonly used functionalities for building applications that communicate with scientific instruments allowing rapid application prototyping, development and testing. Lantz benefits from Python’s extensive library flexibility as a glue language to wrap existing drivers and DLLs.
Context: I ran start_test_app on an instance of a custom driver which contained a DictFeat and unchecked its "Update on change" checkbox. It had no effect on the behavior of the widget.
Probable origin: In case of a DictFeat, LabeledFeatWidget._widget is a DictFeatWidget, which doesn't have a value_to_feat method. As a result, when DriverTestWidget.update_on_change() runs widget._widget._update_on_change = new_state, the _update_on_change property of DictFeatWidget is updated instead of the _update_on_change property of DictFeatWidget._value_widget.
Probable fix: add an if isinstance(widget._widget, DictFeatWidget) statement to DriverTestWidget.update_on_change()
Proposed fix: rewrite DriverTestWidget.update_on_change() as
def update_on_change(self, new_state):
"""Set the 'update_on_change' flag to new_state in each writable widget
within this widget. If True, the driver will be updated after each change.
"""
for widget in self.writable_widgets:
if isinstance(widget._widget, DictFeatWidget):
widget._widget._value_widget._update_on_change = new_state
else:
widget._widget._update_on_change = new_state
Context: I ran
start_test_app
on an instance of a custom driver which contained aDictFeat
and unchecked its "Update on change" checkbox. It had no effect on the behavior of the widget.Probable origin: In case of a
DictFeat
,LabeledFeatWidget._widget
is aDictFeatWidget
, which doesn't have avalue_to_feat
method. As a result, whenDriverTestWidget.update_on_change()
runswidget._widget._update_on_change = new_state
, the_update_on_change
property ofDictFeatWidget
is updated instead of the_update_on_change property
ofDictFeatWidget._value_widget
.Probable fix: add an
if isinstance(widget._widget, DictFeatWidget)
statement toDriverTestWidget.update_on_change()
Proposed fix: rewrite
DriverTestWidget.update_on_change()
as