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

Improvements to widget properties #752

Merged
merged 6 commits into from
Oct 6, 2015

Conversation

astrofrog
Copy link
Member

Several changes in this pull request, following work on the 3-d viewer:

  • CurrentComboProperty has been renamed to CurrentComboDataProperty and CurrentComboTextProperty has been added, to differentiate between cases where the item should be selected based on the text vs data in the combo box (note that for backward-compatibility, CurrentComboProperty is set to CurrentComboDataProperty)
  • Adds the ability to define a mapping function for value-based properties, which can be useful for e.g. log-space sliders
  • Adds CurrentTabProperty. The tests have been expanded to cover all widget properties.
  • Significantly expands tests in test_widget_properties.py to test all functions/classes

@ChrisBeaumont - am I right in thinking that when one doesn't need an actual callback, but instead just needs the property to be set when called, then the widget properties should be used, whereas if an immediate callback is needed, the callback properties and connect functions should be used?

CurrentComboProperty has been renamed to CurrentComboDataProperty and CurrentComboTextProperty has been added, to differentiate between cases where the item should be selected based on the text vs data in the combo box. In addition, this adds the ability to define a mapping function for value-based properties. Finally, this adds CurrentTabProperty. The tests have been expanded to cover all widget properties.

class CurrentComboTextProperty(WidgetProperty):
"""
Wrapper around ComboBoxes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

differentiate docstrings here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@ChrisBeaumont
Copy link
Member

This looks good

am I right in thinking that when one doesn't need an actual callback, but instead just needs the property to be set when called, then the widget properties should be used, whereas if an immediate callback is needed, the callback properties and connect functions should be used?

That sounds right. I guess we could make it so that callbacks could more easily be attached to WidgetProperties directly (ie maybe WidgetProperty should inherit from CallbackProperty)

astrofrog added a commit that referenced this pull request Oct 6, 2015
@astrofrog astrofrog merged commit ada7fb6 into glue-viz:master Oct 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants