From 2fb4c851e30d45393ad06358743d03a0c4c4018b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Thu, 21 Apr 2011 09:57:51 +0000 Subject: [PATCH] 4546 Numbers are always bound to Go menu (MacOS) svn: r17183 --- src/constfunc.py | 15 +++++++++++++++ src/gui/views/navigationview.py | 9 +++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/constfunc.py b/src/constfunc.py index e23a88c6b..cd10f2036 100644 --- a/src/constfunc.py +++ b/src/constfunc.py @@ -115,3 +115,18 @@ def has_display(): except: sys.argv = temp return False + +# A couple of places add menu accelerators using , which doesn't +# work with Gtk-quartz. is the usually correct replacement, but +# in one case the key is a number, and number is used by Spaces +# (a mac feature), so we'll use control instead. + +def mod_key(): + """ + Returns a string to pass to an accelerator map. + """ + + if is_quartz(): + return "" + + return "" diff --git a/src/gui/views/navigationview.py b/src/gui/views/navigationview.py index e85e2eb0c..27b9fd5be 100644 --- a/src/gui/views/navigationview.py +++ b/src/gui/views/navigationview.py @@ -49,6 +49,7 @@ import gtk from gui.views.pageview import PageView from gen.ggettext import sgettext as _ from Utils import navigation_label +from constfunc import mod_key DISABLED = -1 MRU_SIZE = 10 @@ -288,7 +289,7 @@ class NavigationView(PageView): self.fwd_action = gtk.ActionGroup(self.title + '/Forward') self.fwd_action.add_actions([ ('Forward', gtk.STOCK_GO_FORWARD, _("_Forward"), - "Right", _("Go to the next person in the history"), + "%sRight" % mod_key(), _("Go to the next person in the history"), self.fwd_clicked) ]) @@ -296,12 +297,12 @@ class NavigationView(PageView): self.back_action = gtk.ActionGroup(self.title + '/Backward') self.back_action.add_actions([ ('Back', gtk.STOCK_GO_BACK, _("_Back"), - "Left", _("Go to the previous person in the history"), + "%sLeft" % mod_key(), _("Go to the previous person in the history"), self.back_clicked) ]) self._add_action('HomePerson', gtk.STOCK_HOME, _("_Home"), - accel="Home", + accel="%sHome" % mod_key(), tip=_("Go to the default person"), callback=self.home) self.other_action = gtk.ActionGroup(self.title + '/PersonOther') @@ -440,7 +441,7 @@ class NavigationView(PageView): for index, handle in enumerate(mitems): name, obj = navigation_label(self.dbstate.db, nav_type, handle) data.append(('%s%02d'%(nav_type, index), None, name, - "%d" % index, None, + "%s%d" % (mod_key(), index), None, make_callback(hobj.push, handle))) self.mru_action = gtk.ActionGroup(nav_type)