Bläddra i källkod

wxGUI: use custom font dialog for output font on Mac, see https://trac.osgeo.org/grass/ticket/3046

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@68535 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 9 år sedan
förälder
incheckning
74bacaa3b4
1 ändrade filer med 20 tillägg och 1 borttagningar
  1. 20 1
      gui/wxpython/gui_core/preferences.py

+ 20 - 1
gui/wxpython/gui_core/preferences.py

@@ -729,7 +729,10 @@ class PreferencesDialog(PreferencesBaseDialog):
         panel.SetSizer(border)
         panel.SetSizer(border)
 
 
         # bindings
         # bindings
-        outfontButton.Bind(wx.EVT_BUTTON, self.OnSetOutputFont)
+        if sys.platform == 'darwin' and globalvar.CheckWxVersion([3]):
+            outfontButton.Bind(wx.EVT_BUTTON, self.OnSetOutputFontCustomDialog)
+        else:
+            outfontButton.Bind(wx.EVT_BUTTON, self.OnSetOutputFont)
 
 
         return panel
         return panel
 
 
@@ -1947,6 +1950,22 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         event.Skip()
         event.Skip()
 
 
+    def OnSetOutputFontCustomDialog(self, event):
+        """Set font for command console using the custom dialog
+           (native is crashing on Mac)"""
+        dlg = DefaultFontDialog(parent=self,
+                                title=_('Select default output font'),
+                                style=wx.DEFAULT_DIALOG_STYLE,
+                                type='outputfont')
+        if dlg.ShowModal() == wx.ID_OK:
+            # set output font and font size variables
+            if dlg.font:
+                self.settings.Set(group='appearance', value=dlg.font,
+                                  key='outputfont', subkey='type')
+                self.settings.Set(group='appearance', value=dlg.fontsize,
+                                  key='outputfont', subkey='size')
+        dlg.Destroy()
+
     def OnSetOutputFont(self, event):
     def OnSetOutputFont(self, event):
         """'Set output font' button pressed
         """'Set output font' button pressed
         """
         """