{"action":"created","issue":{"url":"https://api.github.com/repos/spyder-ide/spyder/issues/442","labels_url":"https://api.github.com/repos/spyder-ide/spyder/issues/442/labels{/name}","comments_url":"https://api.github.com/repos/spyder-ide/spyder/issues/442/comments","events_url":"https://api.github.com/repos/spyder-ide/spyder/issues/442/events","html_url":"https://github.com/spyder-ide/spyder/issues/442","id":57864992,"number":442,"title":"Bad key bindings on OS X","user":{"login":"spyder-issues-migrator","id":11021581,"avatar_url":"https://avatars.githubusercontent.com/u/11021581?v=3","gravatar_id":"","url":"https://api.github.com/users/spyder-issues-migrator","html_url":"https://github.com/spyder-issues-migrator","followers_url":"https://api.github.com/users/spyder-issues-migrator/followers","following_url":"https://api.github.com/users/spyder-issues-migrator/following{/other_user}","gists_url":"https://api.github.com/users/spyder-issues-migrator/gists{/gist_id}","starred_url":"https://api.github.com/users/spyder-issues-migrator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spyder-issues-migrator/subscriptions","organizations_url":"https://api.github.com/users/spyder-issues-migrator/orgs","repos_url":"https://api.github.com/users/spyder-issues-migrator/repos","events_url":"https://api.github.com/users/spyder-issues-migrator/events{/privacy}","received_events_url":"https://api.github.com/users/spyder-issues-migrator/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/2%E2%80%935%20stars","name":"2–5 stars","color":"FFFFFF"},{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/imported","name":"imported","color":"FFFFFF"},{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/Settings","name":"Settings","color":"FFFFFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-02-16T23:40:22Z","updated_at":"2015-02-16T23:40:25Z","closed_at":null,"body":"_From [christop...@gmail.com](https://code.google.com/u/105753816054647931594/) on 2010-11-08T18:23:47Z_\n\n\n\nWhat steps will reproduce the problem?\n\n 1. Type some thing in the code editor\r\n2. Try code completion with Ctrl+Space does nothing (but a beep)\r\n3. Try code completion with Cmd+Space opens Spotlight instead What is the expected output? What do you see instead? Key bindings are somewhat strange in OS X: Qt.ControlModifier refers to the OS X Command key. Control key is (according to Qt documentation) linked to Qt.MetaModifier. What version of the product are you using? On what operating system? spyder-2.0.0beta6\r\nOS X 10.6.4 \n\nPlease provide any additional information below\n\n. I tried the following hack without sucess (what else needs to be changed?):\r\n\r\n--- shortcuts.py~\t2010-11-05 03:50:02.000000000 +0100\r\n+++ shortcuts.py\t2010-11-08 22:26:36.000000000 +0100\r\n@@ -37,8 +37,13 @@\r\n \r\n \r\n class Key(object):\r\n-    MODIFIERS = {Qt.NoModifier: \"\", Qt.ShiftModifier: \"Shift\",\r\n-                 Qt.ControlModifier: \"Ctrl\", Qt.AltModifier: \"Alt\"}\r\n+    if sys.platform=='darwin':\r\n+        MODIFIERS = {Qt.NoModifier: \"\", Qt.ShiftModifier: \"Shift\",\r\n+                     Qt.ControlModifier: \"Cmd\", Qt.AltModifier: \"Alt\",\r\n+                     Qt.MetaModifier: \"Ctrl\"}\r\n+    else:\r\n+        MODIFIERS = {Qt.NoModifier: \"\", Qt.ShiftModifier: \"Shift\",\r\n+                     Qt.ControlModifier: \"Ctrl\", Qt.AltModifier: \"Alt\"}\n\n_Original issue: http://code.google.com/p/spyderlib/issues/detail?id=442_"},"comment":{"url":"https://api.github.com/repos/spyder-ide/spyder/issues/comments/74591438","html_url":"https://github.com/spyder-ide/spyder/issues/442#issuecomment-74591438","issue_url":"https://api.github.com/repos/spyder-ide/spyder/issues/442","id":74591438,"user":{"login":"spyder-issues-migrator","id":11021581,"avatar_url":"https://avatars.githubusercontent.com/u/11021581?v=3","gravatar_id":"","url":"https://api.github.com/users/spyder-issues-migrator","html_url":"https://github.com/spyder-issues-migrator","followers_url":"https://api.github.com/users/spyder-issues-migrator/followers","following_url":"https://api.github.com/users/spyder-issues-migrator/following{/other_user}","gists_url":"https://api.github.com/users/spyder-issues-migrator/gists{/gist_id}","starred_url":"https://api.github.com/users/spyder-issues-migrator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spyder-issues-migrator/subscriptions","organizations_url":"https://api.github.com/users/spyder-issues-migrator/orgs","repos_url":"https://api.github.com/users/spyder-issues-migrator/repos","events_url":"https://api.github.com/users/spyder-issues-migrator/events{/privacy}","received_events_url":"https://api.github.com/users/spyder-issues-migrator/received_events","type":"User","site_admin":false},"created_at":"2015-02-16T23:40:25Z","updated_at":"2015-02-16T23:40:25Z","body":"_From [christop...@gmail.com](https://code.google.com/u/105753816054647931594/) on 2012-02-09T08:53:05Z_\n\nHi again,\r\n\r\nmy current version of the patch looks like this (see below). \r\nCheers,\r\nChristoph \r\n\r\ndiff -r e1b051e6af44 -r 1221973bdd1a spyderlib/plugins/shortcuts.py\r\n--- a/spyderlib/plugins/shortcuts.py\tSat Jan 07 13:28:19 2012 +0100\r\n+++ b/spyderlib/plugins/shortcuts.py\tMon Jan 09 16:11:29 2012 +0100\r\n@@ -34,7 +34,21 @@\r\n \r\n class Key(object):\r\n     MODIFIERS = {Qt.NoModifier: \"\", Qt.ShiftModifier: \"Shift\",\r\n-                 Qt.ControlModifier: \"Ctrl\", Qt.AltModifier: \"Alt\"}\r\n+                 Qt.ControlModifier: \"Ctrl\", Qt.AltModifier: \"Alt\",\r\n+                 Qt.MetaModifier: \"Meta\"}\r\n+    if sys.platform == 'darwin':\r\n+        MODIFIERNAMES = {Qt.NoModifier: \"\", Qt.ShiftModifier: \"Shift\",\r\n+                 Qt.ControlModifier: \"Cmd\", Qt.AltModifier: \"Alt\",\r\n+                 Qt.MetaModifier: \"Ctrl\"}\r\n+    elif sys.platform == 'win32':\r\n+        MODIFIERNAMES = {Qt.NoModifier: \"\", Qt.ShiftModifier: \"Shift\",\r\n+                 Qt.ControlModifier: \"Ctrl\", Qt.AltModifier: \"Alt\",\r\n+                 Qt.MetaModifier: \"Win\"}\r\n+    else:\r\n+        MODIFIERNAMES = {Qt.NoModifier: \"\", Qt.ShiftModifier: \"Shift\",\r\n+                 Qt.ControlModifier: \"Ctrl\", Qt.AltModifier: \"Alt\",\r\n+                 Qt.MetaModifier: \"Meta\"}\r\n+        \r\n     KEYS = {}\r\n     for attr in KEYSTRINGS:\r\n         KEYS[getattr(Qt, \"Key_\"+attr)] = attr\r\n@@ -68,7 +82,12 @@\r\n         for k, v in Key.KEYS.iteritems():\r\n             if v.lower() == keystr.lower():\r\n                 return k\r\n\\-        \r\n+\r\n+    @-staticmethod\r\n+    def modifier_from_name(modname):\r\n+        for k, v in Key.MODIFIERNAMES.iteritems():\r\n+            if v.lower() == modname.lower():\r\n+                return k        \r\n \r\n def keystr2key(keystr):\r\n     keylist = keystr.split(\"+\")\r\n@@ -131,11 +150,11 @@\r\n             elif column == NAME:\r\n                 return to_qvariant(shortcut.name)\r\n             elif column == MOD1:\r\n-                return to_qvariant(Key.MODIFIERS[key.modifiers[0]])\r\n+                return to_qvariant(Key.MODIFIERNAMES[key.modifiers[0]])\r\n             elif column == MOD2:\r\n-                return to_qvariant(Key.MODIFIERS[key.modifiers[1]])\r\n+                return to_qvariant(Key.MODIFIERNAMES[key.modifiers[1]])\r\n             elif column == MOD3:\r\n-                return to_qvariant(Key.MODIFIERS[key.modifiers[2]])\r\n+                return to_qvariant(Key.MODIFIERNAMES[key.modifiers[2]])\r\n             elif column == KEY:\r\n                 return to_qvariant(Key.KEYS[key.key])\r\n         elif role == Qt.TextAlignmentRole:\r\n@@ -177,11 +196,11 @@\r\n             column = index.column()\r\n             text = from_qvariant(value, str)\r\n             if column == MOD1:\r\n-                key.modifiers[0] = Key.modifier_from_str(text)\r\n+                key.modifiers[0] = Key.modifier_from_name(text)\r\n             elif column == MOD2:\r\n-                key.modifiers[1] = Key.modifier_from_str(text)\r\n+                key.modifiers[1] = Key.modifier_from_name(text)\r\n             elif column == MOD3:\r\n-                key.modifiers[2] = Key.modifier_from_str(text)\r\n+                key.modifiers[2] = Key.modifier_from_name(text)\r\n             elif column == KEY:\r\n                 key.key = Key.key_from_str(text)\r\n             self.emit(SIGNAL(\"dataChanged(QModelIndex,QModelIndex)\"),\r\n@@ -193,7 +212,7 @@\r\n class ShortcutsDelegate(QItemDelegate):\r\n     def __init__(self, parent=None):\r\n         QItemDelegate.__init__(self, parent)\r\n-        self.modifiers = sorted(Key.MODIFIERS.values())\r\n+        self.modifiers = sorted(Key.MODIFIERNAMES.values())\r\n         self.mod = None\r\n         self.keys = sorted(Key.KEYS.values())\r\n         self.key = None"}}