Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Reintroducing FloatSlider from legacy with an example. #226

Closed
wants to merge 4 commits into from

Conversation

cfarrow
Copy link
Contributor

@cfarrow cfarrow commented Dec 18, 2012

No description provided.

#: is restricted to 65535, while the default is 100.
precision = Range(value=100, low=1, high=MAX_SLIDER_VALUE)

#: Defines the number of steps that the slider will move when the
Copy link
Member

Choose a reason for hiding this comment

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

I do not think that single_step and page_step need to be redefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are redefined to put the upper bound at 'precision'.

@cfarrow
Copy link
Contributor Author

cfarrow commented Jan 2, 2013

Any other feedback? It would be convenient to have this in master.

@sccolbert
Copy link
Contributor

Im on holiday and haven't had a chance to look yet.
On Jan 2, 2013 10:39 AM, "Chris Farrow" [email protected] wrote:

Any other feedback? It would be convenient to have this in master.


Reply to this email directly or view it on GitHubhttps://github.com//pull/226#issuecomment-11818790.

@cfarrow
Copy link
Contributor Author

cfarrow commented Jan 2, 2013

Sorry about that. No problem. Happy new year!

@sccolbert
Copy link
Contributor

I'm wondering if it would just be easier to have an adapter bolted onto a Slider, rather than do the mapping on the backend... but maybe not, i'm not sure yet. I don't like that we have to duplicate so much code (like the property getters and setters) but that may just be a traits-ism.

#: user presses the page_up/page_down keys. The Default is 10. An
#: upper limit may be imposed on this value according to the limits
#: of the client widget.
page_step = Range(low='_one', high='precision', value=10)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about clipping to 'precision'. This implies that we will update page_step if precision becomes too small. However, the Range trait does not do any dependency analysis or notification, so the user would still get in trouble if they set the step then changed the precision. I'm not sure that protecting the user from themselves in this case is needed.

Copy link
Member

Choose a reason for hiding this comment

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

Whatever you like.

Copy link
Contributor

Choose a reason for hiding this comment

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

Surely you have an opinion :)

Copy link
Member

Choose a reason for hiding this comment

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

I really don't. If you think the Range is problematic, that's fine. Just get it done. It's unlikely anyone is going to change them in any case.

@cfarrow
Copy link
Contributor Author

cfarrow commented Jan 8, 2013

Putting the range transforms on the Slider would cut down on code duplication. It would also make it easier to build a logarithmic slider, for example. On the down side, this would complicate the Slider interface.

@sccolbert
Copy link
Contributor

Robert, what's your opinion of a generic slider transform, instead of a totally different slider?

@rkern
Copy link
Member

rkern commented Jan 8, 2013

Didn't work very well, so I wrote the FloatSlider. But if you have a better design, please propose it.

@sccolbert
Copy link
Contributor

This is what I had in mind with regards to the transform:
https://github.com/enthought/enaml/blob/feature-slider-update/examples/widgets/float_slider.enaml

This works, and it should be simple enough for someone to write a new transform for various ranges or scales.

Implementation:
https://github.com/enthought/enaml/blob/feature-slider-update/enaml/widgets/slider.py

@sccolbert
Copy link
Contributor

If you guys like this idea, I'll probably move the implementation into enaml.stdlib instead of the slider.py module.

@rkern
Copy link
Member

rkern commented Jan 14, 2013

Sure.

@sccolbert
Copy link
Contributor

Chris F., what are your thoughts?

@cfarrow
Copy link
Contributor Author

cfarrow commented Jan 14, 2013

This looks like a great solution to me. It complicates slightly what used to be FloatSlider, but that is acceptable.
Also, it will be easy to implement other transforms, which is something we need.

Thanks.

@sccolbert
Copy link
Contributor

Closing in favor of #237

@sccolbert sccolbert closed this Jan 15, 2013
@sccolbert sccolbert deleted the feature-float_slider branch January 15, 2013 14:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants