[GRASS-SVN] r35580 - in grass/branches/develbranch_6/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 24 15:41:40 EST 2009


Author: martinl
Date: 2009-01-24 15:41:40 -0500 (Sat, 24 Jan 2009)
New Revision: 35580

Modified:
   grass/branches/develbranch_6/gui/wxpython/gis_set.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
Log:
more MS Windows-related fixes
     (merge from relbr64, r35579)


Modified: grass/branches/develbranch_6/gui/wxpython/gis_set.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gis_set.py	2009-01-24 20:31:32 UTC (rev 35579)
+++ grass/branches/develbranch_6/gui/wxpython/gis_set.py	2009-01-24 20:41:40 UTC (rev 35580)
@@ -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/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2009-01-24 20:31:32 UTC (rev 35579)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2009-01-24 20:41:40 UTC (rev 35580)
@@ -283,7 +283,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":
             if self.gismanager:
@@ -302,8 +303,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
@@ -319,8 +320,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
@@ -404,8 +404,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/develbranch_6/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2009-01-24 20:31:32 UTC (rev 35579)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2009-01-24 20:41:40 UTC (rev 35580)
@@ -23,6 +23,7 @@
 
 import wx
 import os, sys
+import platform
 
 import grass
 
@@ -133,6 +134,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
@@ -153,7 +163,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)
 
@@ -163,13 +173,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"""
 
@@ -472,6 +484,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