-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Simple GUI interface enhancements #851
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
Conversation
('Pan', 'Pan axes with left mouse, zoom with right', 'move.ppm', 'pan'), | ||
('Zoom', 'Zoom to rectangle','zoom_to_rect.ppm', 'zoom'), | ||
(None, None, None, None), | ||
('Subplots', 'Configure subplots','subplots.png', 'configure_subplots'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inconsistency with the image file has not been carried through to this change request. Does anyone know of a good reason why it might have had a different extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might have actually been a recurring issue. There might be some mailing list threads about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find anything. I tried searching for:
The changeset which introduced it cee76c6 seems to suggest it was just an extension rather than a bug fix. Since I was able to test this on my machine & it is consistent with the other image files, I suggest that this was worth highlighting, but not likely to cause any issues.
Closes #830. |
I have now been able to test these changes with qt4agg, gtkagg and tkagg backends on a Linux (Ubuntu) install. |
On Mon, Apr 23, 2012 at 5:38 PM, Phil Elson
I really detest having these hot keys enabled by default, and I think So my preference would be to have all hot keys be opt-in, not opt out.
It would not be appropriate for 1.1.x under any circumstances; it is a Eric
|
Was 'q' already active on some backends? if not, then I think what we can do is keep this code, but set the default rcParam for quit to an empty list. This way, the mechanism is in-place rather than in some commented-out, hard-coded spots in some backends. Otherwise, I think just about everything else makes great sense. |
No its not active in any backend as far as I can see. I personally will be enabling this feature (as I suspect will the original requester @birkenfield ), so maybe its worth taking a straw poll on the mpl-users mailing-list? It would seem strange to me that all the other keyboard shortcuts are enabled by default, so maybe we could ask:
I don't really mind either way which way it goes, but I do think its worth thinking about consistency. |
Just as an update, I will be away from a computer for a couple of weeks and wont have access to contribute and/or make adjustments to the pull. Did anyone have any feeling as to whether asking the user community is the right thing to do? If it is not then I will remove the default "q" straight away so that this can be integrated onto master. |
+1 especially for the "q" short-cut. I would prefer if it is turned on by default as I'm used to gnuplots behavior and the missing short-cut bothers me most in mpl. Actually I tried to implement this a few weeks ago but I was not able to figure out how to destroy the figure. It's great that there even exists a PR for this! |
To contribute a (fresh) user's perspective here, I was pretty suprised/alarmed that I could not close the figure window with Ctrl-W on Ubuntu, and subsequently searched for a relevant bug report. Ctrl-W is the default shortcut for closing windows here, afaik. Ctrl-Q didn't work either. Alt-F4 worked, though, but this may be some Windows-compatibility thing recognized by Ubuntu? I think the window should respond to platform-default shortcuts, but I don't know how complicated it would be to implement this. Failing that, just 'q' would be fine, too. |
I think you touched on something important. FWIW, on my CentOS6 system with gnome 2 installed, Alt-F4 is the keyboard shortcut for closing a window (Ctrl-W and Ctrl-Q do nothing). The "close" event is largely a system-level idiom. 'q' is not a system default anywhere for closing a window. My opinion is now that 'q' should not be turned on as default. Maybe add a comment to the matplotlibrc.template that 'Alt-F4' should always work anyway? |
I have made some changes which might make the behaviour more palatable. I have removed the
At this point I would like us to find a common ground since clearly the "quick close keyboard shortcut that isn't @efiring & @WeatherGod does this go some way to improving the original proposal? |
http://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts |
Regarding key specifics: I strongly prefer that "escape" not be included as a default window closer. |
Thanks Eric, I found your example of why single keystrokes were irritating very useful. I have added a commit which removes the escape key shortcut, and works on improving some of the relevant documentation. Additionally, I have put in some TODOs on the backends that I am unable to run/test. My intentions are to implement the complex keystroke changes (i.e. deprecating I will need to get this, and another pull (#897), tested with a combination of backends and OSes and therefore will put a post on the devel mailing list asking for some help testing (or implementing the missing backend's) new features. Other than that, is the pull heading in the right direction? Are there code review type actions to be done before sending out the mpl-devel mailing list message? |
@@ -2262,8 +2264,13 @@ def key_press_handler(event, canvas, toolbar=None): | |||
|
|||
# toggle fullscreen mode (default key 'f') | |||
if event.key in fullscreen_keys: | |||
self.full_screen_toggle() | |||
fig_manager = Gcf.get_active() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use canvas.manager
as per #919.
Note to self: Consider addressing #215 in this PR. |
@jkseppan or other OSX developer: Would you mind having a look at this PR and running a couple of checks?
And check that when pressing Thanks, @efiring and/or @WeatherGod, are you happy with this change? |
I have been able to test this on both Linux (Gtk, Gtk3, wx, tk, pyqt4, pyside) and OSX (tk, gtk, pyside) and on each of the backends I get at least the desired |
Capability wise, this PR is now up to speed. Are there any further review actions/comments? |
…een" shortcut key which was broken.
…nal support will need to be added for qt, gtk and wx backends.
…ds I cannot test.
# to make a tkagg window pop up on top on osx, osascript can be used | ||
# this came from http://sourceforge.net/mailarchive/message.php?msg_id=23718545 | ||
cmd = ("""/usr/bin/osascript -e 'tell app "Finder" to set """ + \ | ||
"""frontmost of process "%s" to true'""") % \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and below, a couple matters of style:
First, please avoid backslash line continuations. Parentheses can be used instead.
Second, and less importantly, python has automatic string concatenation, so there is no need for the explicit addition when breaking a string across lines.
Tested on OS X 10.6.8, Python 2.7.2, TkAgg: window closes on ctrl+w (and on cmd+w, which is the more natural Mac binding), fullscreens on f, toolbar icons look fine and have tooltips. |
OS X 10.6.8, Python 2.7.3 installed via MacPorts: TkAgg: crashes (likely not related to this change - I suspect the MacPorts Tkinter installation, since it works fine with my python.org Python) OS X package management being what it is, I can't be sure that something I happen to have installed isn't interfering with some of the backends (though I'm using virtualenv to install packages under the MacPorts python). For proper testing, we should probably have a virtual machine image with all the correct dependencies installed, and a script that installs a git version of matplotlib from scratch. |
@efiring: I've removed some the two blocks that you highlighted as they don't belong in this PR. I will re-consider them for another pull request (once I have figured out how to implement it properly). I think this PR is in a state to merge now. Obviously, there is no way that we can test every combination of OS, Python version, backend etc., but any further issues that crop up we can deal with in future issues/PRs. Anyone disagree? |
Simple GUI interface enhancements
In this pull request, I have:
I am unable to test on all backends (and operating systems), so there is the possibility that I have missed something very obvious, hence I have based this against
master
rather than1.1.x
.