[GRASS-SVN] r30764 - grass/trunk/gui/wxpython
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 27 12:33:54 EDT 2008
Author: martinl
Date: 2008-03-27 12:33:54 -0400 (Thu, 27 Mar 2008)
New Revision: 30764
Modified:
grass/trunk/gui/wxpython/gis_set.py
Log:
wxGUI (welcome screen): fix entering GISDBASE manually
Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py 2008-03-27 16:11:18 UTC (rev 30763)
+++ grass/trunk/gui/wxpython/gis_set.py 2008-03-27 16:33:54 UTC (rev 30764)
@@ -131,7 +131,7 @@
# textinputs
self.tgisdbase = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY, value="", size=(300, -1),
- style=wx.TE_LEFT)
+ style=wx.TE_PROCESS_ENTER)
# Locations
self.lpanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
@@ -160,7 +160,7 @@
self.manageloc.Bind(wx.EVT_CHOICE, self.OnManageLoc)
self.lblocations.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelectLocation)
self.lbmapsets.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelectMapset)
- self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressedInDbase, self.tgisdbase)
+ self.tgisdbase.Bind(wx.EVT_TEXT_ENTER, self.OnSetDatabase)
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
def _set_properties(self):
@@ -526,6 +526,11 @@
self.lblocations.Clear()
self.lblocations.InsertItems(self.listOfLocations, 0)
+ if len(self.listOfLocations) > 0:
+ self.lblocations.SetSelection(0)
+ else:
+ self.lblocations.SetSelection(wx.NOT_FOUND)
+
return self.listOfLocations
def UpdateMapsets(self, location):
@@ -574,12 +579,9 @@
def OnSelectLocation(self, event):
"""Location selected"""
if event:
- try:
- self.lblocations.SetSelection(event.GetIndex())
- except AttributeError:
- self.lblocations.SetSelection(0)
+ self.lblocations.SetSelection(event.GetIndex())
- if self.lblocations.GetSelection() > -1:
+ if self.lblocations.GetSelection() != wx.NOT_FOUND:
self.UpdateMapsets(os.path.join(self.gisdbase,
self.listOfLocations[self.lblocations.GetSelection()]))
else:
@@ -594,9 +596,12 @@
self.lbmapsets.Clear()
self.lbmapsets.InsertItems(self.listOfMapsets, 0, disabled=disabled)
-
- self.lbmapsets.SetSelection(0)
+ if len(self.listOfMapsets) > 0:
+ self.lbmapsets.SetSelection(0)
+ else:
+ self.lbmapsets.SetSelection(wx.NOT_FOUND)
+
def OnSelectMapset(self, event):
"""Mapset selected"""
self.lbmapsets.SetSelection(event.GetIndex())
@@ -617,9 +622,11 @@
if self.listOfLocations != []:
self.lblocations.SetSelection(0)
+ else:
+ self.lblocations.SetSelection(wx.NOT_FOUND)
+
+ self.OnSelectLocation(None)
- self.OnSelectLocation(event)
-
def OnBrowse(self, event):
"""'Browse' button clicked"""
grassdata = None
@@ -633,13 +640,6 @@
self.OnSetDatabase(event)
- def OnKeyPressedInDbase(self,event):
- """GIS data directory changed"""
- if wx.WXK_RETURN == event.KeyCode:
- self.OnSetDatabase(event)
- else:
- event.Skip()
-
def OnCreateMapset(self,event):
"""Create new mapset"""
self.gisdbase = self.tgisdbase.GetValue()
More information about the grass-commit
mailing list