diff --git a/hotkey.py b/hotkey.py index 2c01c659..12db6bae 100644 --- a/hotkey.py +++ b/hotkey.py @@ -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 diff --git a/prefs.py b/prefs.py index 939061ec..8b51216b 100644 --- a/prefs.py +++ b/prefs.py @@ -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('', self.hotkeystart) self.hotkey_text.bind('', self.hotkeyend)