-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix Object inspector message for OSX #2318
Conversation
Is the Also, since there seems to be a lot of places around where we check for the OS, maybe it would be good idea to create some helper functions in is_win()
is_linux()
is_mac() And adapt the code around spyder to make use of that (and of course add this to the docs 😸 ) |
The config is available as: In [9]: from spyderlib.config import CONF
In [10]: CONF.get('shortcuts', 'editor/inspect current object')
Out[10]: u'Ctrl+I' Unfortunately it gives me the default. I'm not sure of a better way. I do like the idea of the helper functions. |
Well
I do not see any
is this shortcut being altered somewhere else? |
ahh now I get it... this might require some tweaking to make it more appropriate I guess. The |
So maybe we can import from there? |
Right, it may be that if I stick it in the live code, it will grab the right version. I'll give in a shot. |
Nope, it did not work... |
Well, I think we need a few things...
Qt.ControlModifier: "Ctrl", Qt.AltModifier: "Alt",
Qt.MetaModifier: "Meta"}
if sys.platform == 'darwin':
MODIFIERNAMES = {Qt.NoModifier: "", Qt.ShiftModifier: "Shift",
Qt.ControlModifier: "Cmd", Qt.AltModifier: "Alt",
Qt.MetaModifier: "Ctrl"}
elif sys.platform == 'win32':
MODIFIERNAMES = {Qt.NoModifier: "", Qt.ShiftModifier: "Shift",
Qt.ControlModifier: "Ctrl", Qt.AltModifier: "Alt",
Qt.MetaModifier: "Win"}
else:
MODIFIERNAMES = {Qt.NoModifier: "", Qt.ShiftModifier: "Shift",
Qt.ControlModifier: "Ctrl", Qt.AltModifier: "Alt",
Qt.MetaModifier: "Meta"}
OR Maybe we should define these transformations directly inside the So instead of writing:
|
I guess the helper function would be the easiest to do. |
But now that I check... the # Ctrl key
CTRL = "Meta" if sys.platform == 'darwin' else "Ctrl"
...
'editor/code completion': CTRL+'+Space'` This is too messy! |
@goanpeca. it seems you don't understand how Qt works with shortcuts. I added the line you referred too # Ctrl key
CTRL = "Meta" if sys.platform == 'darwin' else "Ctrl" so that code completion in the Editor didn't get mapped to Of course, there are things like the message in the Object Inspector that pass overlooked (because that's text), but most of the time things work without problems. |
@@ -749,6 +749,8 @@ def show_intro_message(self): | |||
tutorial = _("tutorial") | |||
intro_message = intro_message % ("<b>Ctrl+I</b>", "<br><br>", |
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.
Why not add a block before this one with something like
if sys.platform == 'darwin':
shortcut = "<b>Cmd+I</b>"
else:
shortcut = "<b>Ctrl+I</b>"
and then change this line like this
intro_message = intro_message % (shortcut, "<br><br>", "<i>"+prefs+"</i>")
I think this approach is much cleaner than the proposed one.
@ccordoba12, I agree that the default on OSX is the Cmd key, but the Ctrl key is still used and the text is misleading. |
@goanpeca, there are few places where we check for the operating system type, and in those places we use the standard library (which is the standard way of doing it! :-) I don't understand what's the problem with that, really ;-) We don't need our own functions for that! It's like saying that we need to define our own functions to open files :-) The modifier names are changed by Qt internally everywhere (in menus, in tooltips, etc), except when they are text. Please run Spyder on a Mac to see it yourself :-) |
@blink1073, sure, I totally agree with you. I just overlooked that the shortcut was not pointing to What do you think about my suggestion? |
Please move this discussion to your own PR. We are just polluting @blink1073 PR with things that doesn't have to do with his contribution. |
How's that look @ccordoba12? |
Much better, thanks for doing the change. Merging :-) |
Fix Object inspector message for OSX
OS X uses
Cmd+I
as the default keyboard shortcut for the Object Inspector. This updates the help string to avoid confusion.Fixes #2317