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

keymap defaults aren't always lists #497

Closed
WeatherGod opened this issue Sep 29, 2011 · 5 comments
Closed

keymap defaults aren't always lists #497

WeatherGod opened this issue Sep 29, 2011 · 5 comments
Assignees
Milestone

Comments

@WeatherGod
Copy link
Member

If one does not set any keymap settings in an rcParams, then the default keymaps are used from rcsetup.defaultParams. The validation function "validate_stringlist" will always return a list, however, some of the default values are given as just a string, not a list of strings. These values never go through validate_stringlist, and therefore, never get turned into a list.

Do we want to force a validation run on the defaults upon loading mpl, or do we want to just simply fix those entries to be lists? Note that there may be issues with users who have come to expect some of these entries to be strings.

@efiring
Copy link
Member

efiring commented Oct 7, 2011

I think that having these keymaps set by default is a mistake; but more relevant to your question, here is another question: what is the problem with the present situation, which seems to accept either a string or a list of strings?

@WeatherGod
Copy link
Member Author

Consider the situation that I encountered. I wanted to remove some keys from the default keymap so that I could use them for myself in my own app. So my code originally looped through the keymaps and popped any keys I was using from the lists. But, if a keymap was a string, not a list of strings, then you obviously can't pop it.

Another situation would be some sort of check that some key was in a particular map:

> rcParam['keymap.foo']
'right'
> event.key
'h'
> event.key in rcParam['keymap.foo']
True

However, if rcParam['keymap.foo'] = ['right'], as it should be, then the above boolean would act as expected.

@efiring
Copy link
Member

efiring commented May 29, 2013

@WeatherGod, if you are motivated, a PR for 1.4.x that forces validation, together with whatever documentation is needed to make it clear that a keymap will end up always as a list of strings, seems reasonable to me. If your opinion has changed, then this can be closed.

@ghost ghost assigned WeatherGod May 29, 2013
@mdboom
Copy link
Member

mdboom commented Jan 27, 2014

@WeatherGod: Sorry to get to this so late, but I agree with @efiring: If it's feasible to validate all the entries and make things consistent, I think that would be nice. An easier as less likely to break things option might be to just change the defaults to be lists.

@tacaswell tacaswell modified the milestones: v1.4.x, v1.4.0 Mar 24, 2014
@tacaswell
Copy link
Member

This is addressed by #3564

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

5 participants