Sfoglia il codice sorgente

wxGUI: fix escape button to close dialogs and fix keyboard shortcuts on Mac, see https://trac.osgeo.org/grass/ticket/797

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@68754 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 8 anni fa
parent
commit
fcf3fa7e0c
1 ha cambiato i file con 11 aggiunte e 3 eliminazioni
  1. 11 3
      gui/wxpython/gui_core/forms.py

+ 11 - 3
gui/wxpython/gui_core/forms.py

@@ -550,7 +550,11 @@ class TaskFrame(wx.Frame):
         # buttons
         # buttons
         btnsizer = wx.BoxSizer(orient=wx.HORIZONTAL)
         btnsizer = wx.BoxSizer(orient=wx.HORIZONTAL)
         # cancel
         # cancel
-        self.btn_cancel = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
+        if sys.platform == 'darwin':
+            # stock id automatically adds ctrl-c shortcut to close dialog
+            self.btn_cancel = wx.Button(parent=self.panel, label=_("Close"))
+        else:
+            self.btn_cancel = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
         self.btn_cancel.SetToolTipString(
         self.btn_cancel.SetToolTipString(
             _("Close this window without executing the command (Ctrl+Q)"))
             _("Close this window without executing the command (Ctrl+Q)"))
         btnsizer.Add(
         btnsizer.Add(
@@ -562,7 +566,7 @@ class TaskFrame(wx.Frame):
         # bind closing to ESC and CTRL+Q
         # bind closing to ESC and CTRL+Q
         self.Bind(wx.EVT_MENU, self.OnCancel, id=wx.ID_CLOSE)
         self.Bind(wx.EVT_MENU, self.OnCancel, id=wx.ID_CLOSE)
         accelTableList = [(wx.ACCEL_NORMAL, wx.WXK_ESCAPE, wx.ID_CLOSE)]
         accelTableList = [(wx.ACCEL_NORMAL, wx.WXK_ESCAPE, wx.ID_CLOSE)]
-        accelTableList = [(wx.ACCEL_CTRL, ord('Q'), wx.ID_CLOSE)]
+        accelTableList.append((wx.ACCEL_CTRL, ord('Q'), wx.ID_CLOSE))
         # TODO: bind Ctrl-t for tile windows here (trac #2004)
         # TODO: bind Ctrl-t for tile windows here (trac #2004)
 
 
         if self.get_dcmd is not None:  # A callback has been set up
         if self.get_dcmd is not None:  # A callback has been set up
@@ -596,7 +600,11 @@ class TaskFrame(wx.Frame):
             accelTableList.append((wx.ACCEL_CTRL, ord('R'), wx.ID_OK))
             accelTableList.append((wx.ACCEL_CTRL, ord('R'), wx.ID_OK))
 
 
         # copy
         # copy
-        self.btn_clipboard = wx.Button(parent=self.panel, id=wx.ID_COPY)
+        if sys.platform == 'darwin':
+            # stock id automatically adds ctrl-c shortcut to copy command
+            self.btn_clipboard = wx.Button(parent=self.panel, label=_("Copy"))
+        else:
+            self.btn_clipboard = wx.Button(parent=self.panel, id=wx.ID_COPY)
         self.btn_clipboard.SetToolTipString(
         self.btn_clipboard.SetToolTipString(
             _("Copy the current command string to the clipboard"))
             _("Copy the current command string to the clipboard"))
         btnsizer.Add(item=self.btn_clipboard, proportion=0,
         btnsizer.Add(item=self.btn_clipboard, proportion=0,