1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 08:17:13 +03:00

Fixes for function hotkeys on OSX.

This commit is contained in:
Jonathan Harris 2015-09-12 16:58:22 +01:00
parent 536f4ccdab
commit 7f08a6ff9f
2 changed files with 4 additions and 4 deletions

View File

@ -142,7 +142,7 @@ if platform == 'darwin':
if keycode == 0x1b: # Esc = retain previous
self.acquire_state = HotkeyMgr.ACQUIRE_INACTIVE
return False
elif keycode in [0x7f, NSDeleteFunctionKey, NSClearLineFunctionKey]: # BkSp, Del, Clear = clear hotkey
elif keycode in [0x7f, ord(NSDeleteFunctionKey), ord(NSClearLineFunctionKey)]: # BkSp, Del, Clear = clear hotkey
self.acquire_state = HotkeyMgr.ACQUIRE_INACTIVE
return None
elif keycode in [0x13, 0x20, 0x2d] or 0x61 <= keycode <= 0x7a: # don't allow keys needed for typing in System Map
@ -161,8 +161,8 @@ if platform == 'darwin':
if (modifiers & NSNumericPadKeyMask) and keycode <= 0x7f: text += u''
if not keycode:
pass
elif NSF1FunctionKey <= keycode <= NSF35FunctionKey:
text += 'F%d' % (keycode + 1 - NSF1FunctionKey)
elif ord(NSF1FunctionKey) <= keycode <= ord(NSF35FunctionKey):
text += 'F%d' % (keycode + 1 - ord(NSF1FunctionKey))
elif keycode in HotkeyMgr.DISPLAY: # specials
text += HotkeyMgr.DISPLAY[keycode]
elif keycode < 0x20: # control keys

View File

@ -132,7 +132,7 @@ class PreferencesDialog(tk.Toplevel):
ttk.Label(hotkeyframe, text = _('{APP} needs permission to use shortcuts').format(APP=applongname)).grid(row=0, columnspan=2, padx=5, pady=5, sticky=tk.W) # Shortcut settings prompt on OSX
ttk.Button(hotkeyframe, text = _('Open System Preferences'), command = self.enableshortcuts).grid(row=1, column=1, padx=5, pady=(0,5), sticky=tk.E) # Shortcut settings button on OSX
else:
self.hotkey_text = ttk.Entry(hotkeyframe, width=30, justify=tk.CENTER)
self.hotkey_text = ttk.Entry(hotkeyframe, width = (platform == 'darwin' and 20 or 30), justify=tk.CENTER)
self.hotkey_text.insert(0, self.hotkey_code and hotkeymgr.display(self.hotkey_code, self.hotkey_mods) or _('none')) # No hotkey/shortcut currently defined
self.hotkey_text.bind('<FocusIn>', self.hotkeystart)
self.hotkey_text.bind('<FocusOut>', self.hotkeyend)