[GRASS-SVN] r68548 - grass/branches/releasebranch_7_2/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 31 18:18:19 PDT 2016


Author: annakrat
Date: 2016-05-31 18:18:19 -0700 (Tue, 31 May 2016)
New Revision: 68548

Modified:
   grass/branches/releasebranch_7_2/gui/wxpython/gui_core/preferences.py
Log:
wxGUI: fix font dialogs on Mac, see #3046, merged from trunk r68532, r68535, r68545

Modified: grass/branches/releasebranch_7_2/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/gui_core/preferences.py	2016-06-01 01:17:05 UTC (rev 68547)
+++ grass/branches/releasebranch_7_2/gui/wxpython/gui_core/preferences.py	2016-06-01 01:18:19 UTC (rev 68548)
@@ -729,7 +729,10 @@
         panel.SetSizer(border)
 
         # bindings
-        outfontButton.Bind(wx.EVT_BUTTON, self.OnSetOutputFont)
+        if sys.platform == 'darwin':
+            outfontButton.Bind(wx.EVT_BUTTON, self.OnSetOutputFontCustomDialog)
+        else:
+            outfontButton.Bind(wx.EVT_BUTTON, self.OnSetOutputFont)
 
         return panel
 
@@ -1947,6 +1950,22 @@
 
         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):
         """'Set output font' button pressed
         """
@@ -2060,7 +2079,7 @@
             id=wx.ID_ANY,
             pos=wx.DefaultPosition,
             choices=self.fontlist,
-            style=wx.LB_SINGLE | wx.LB_SORT)
+            style=wx.LB_SINGLE)
         self.Bind(wx.EVT_LISTBOX, self.EvtListBox, self.fontlb)
         self.Bind(wx.EVT_LISTBOX_DCLICK, self.EvtListBoxDClick, self.fontlb)
 



More information about the grass-commit mailing list