Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In case of DictFeat, DriverTestWidget.update_on_change() has no effect #66

Open
thibaudruelle opened this issue Apr 20, 2016 · 0 comments

Comments

@thibaudruelle
Copy link

thibaudruelle commented Apr 20, 2016

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant