[GRASS-SVN] r35579 - in grass/branches/releasebranch_6_4/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 24 15:31:32 EST 2009


Author: martinl
Date: 2009-01-24 15:31:32 -0500 (Sat, 24 Jan 2009)
New Revision: 35579

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbars.py
Log:
more MS Windows-related fixes


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py	2009-01-24 16:11:49 UTC (rev 35578)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py	2009-01-24 20:31:32 UTC (rev 35579)
@@ -25,6 +25,7 @@
 import glob
 import shutil
 import copy
+import platform
 
 ### i18N
 import gettext
@@ -778,8 +779,10 @@
         self.__LoadData(choices, disabled)
 
     def SetSelection(self, item):
-        if item != wx.NOT_FOUND:
+        if item != wx.NOT_FOUND and platform.system() != 'Windows':
+            ### Windows -> FIXME
             self.SetItemState(item, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
+	
         self.selected = item
         
     def GetSelection(self):

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py	2009-01-24 16:11:49 UTC (rev 35578)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py	2009-01-24 20:31:32 UTC (rev 35579)
@@ -2733,7 +2733,8 @@
                               LeftDockable(False).RightDockable(False).
                               BottomDockable(False).TopDockable(True).
                               CloseButton(False).Layer(2).
-                              BestSize((globalvar.MAP_WINDOW_SIZE[0]-15, -1)))
+                              BestSize((self.toolbars['map'].GetToolbar().GetSize())))
+	
         # vector digitizer
         elif name == "vdigit":
             self.toolbars['vdigit'] = toolbars.VDigitToolbar(parent=self, map=self.Map,
@@ -2748,8 +2749,8 @@
                                   LeftDockable(False).RightDockable(False).
                                   BottomDockable(False).TopDockable(True).
                                   CloseButton(False).Layer(2).
-                                  BestSize((globalvar.MAP_WINDOW_SIZE[0]-15, -1)))
-
+                                  BestSize((self.toolbars['vdigit'].GetToolbar().GetSize())))
+	
             # change mouse to draw digitized line
             self.MapWindow.mouse['box'] = "point"
             self.MapWindow.zoomtype = 0
@@ -2765,8 +2766,7 @@
                               ToolbarPane().Top().
                               LeftDockable(False).RightDockable(False).
                               BottomDockable(False).TopDockable(True).
-                              CloseButton(False).Layer(2).
-                              BestSize((globalvar.MAP_WINDOW_SIZE[0]-15, -1)))
+                              CloseButton(False).Layer(2))
         # nviz
         elif name == "nviz":
             import nviz
@@ -2849,8 +2849,7 @@
                               ToolbarPane().Top().Row(1).
                               LeftDockable(False).RightDockable(False).
                               BottomDockable(False).TopDockable(True).
-                              CloseButton(False).Layer(2).
-                              BestSize((globalvar.MAP_WINDOW_SIZE[0]-15, -1)))
+                              CloseButton(False).Layer(2))
             
             self.MapWindow = self.MapWindow3D
             self.SetStatusText("", 0)

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbars.py	2009-01-24 16:11:49 UTC (rev 35578)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbars.py	2009-01-24 20:31:32 UTC (rev 35579)
@@ -23,6 +23,7 @@
 
 import wx
 import os, sys
+import platform
 
 import globalvar
 import gcmd
@@ -132,6 +133,15 @@
         self.action = { 'id' : self.defaultAction['id'],
                         'desc' : self.defaultAction.get('desc', '') }
         
+    def FixSize(self, width):
+	"""Fix toolbar width on Windows
+        
+	@todo Determine why combobox causes problems here
+	"""
+        if platform.system() == 'Windows':
+            size = self._toolbar.GetBestSize()
+            self._toolbar.SetSize((size[0] + width, size[1]))
+        
 class MapToolbar(AbstractToolbar):
     """
     Main Map Display toolbar
@@ -152,7 +162,7 @@
         self.combo = wx.ComboBox(parent=self.toolbar, id=wx.ID_ANY, value=_('2D view'),
                                  choices=[_('2D view'), _('3D view'), _('Digitize')], 
                                  style=wx.CB_READONLY, size=(90, -1))
-
+        
         self.comboid = self.toolbar.AddControl(self.combo)
         self.mapdisplay.Bind(wx.EVT_COMBOBOX, self.OnSelectTool, self.comboid)
 
@@ -162,13 +172,15 @@
         # workaround for Mac bug. May be fixed by 2.8.8, but not before then.
         self.combo.Hide()
         self.combo.Show()
-
+        
         # default action
         self.action = { 'id' : self.pointer }
         self.defaultAction = { 'id' : self.pointer,
                                'bind' : self.mapdisplay.OnPointer }
         self.OnTool(None)
         
+        self.FixSize(width = 90)
+        
     def ToolbarData(self):
         """Toolbar data"""
 
@@ -471,6 +483,8 @@
         # toogle to pointer by default
         self.OnTool(None)
         
+        self.FixSize(width = 105)
+        
     def ToolbarData(self, row=None):
         """
         Toolbar data



More information about the grass-commit mailing list