Browse Source

wxGUI: fix https://trac.osgeo.org/grass/ticket/2001

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56690 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 12 years ago
parent
commit
4b50551ab7
1 changed files with 10 additions and 12 deletions
  1. 10 12
      gui/wxpython/gui_core/preferences.py

+ 10 - 12
gui/wxpython/gui_core/preferences.py

@@ -1383,31 +1383,29 @@ class PreferencesDialog(PreferencesBaseDialog):
         path = win.GetValue()
 
         self.epsgCodeDict = ReadEpsgCodes(path)
-        list = self.FindWindowById(self.winId['projection:statusbar:epsg'])
+        epsgCombo = self.FindWindowById(self.winId['projection:statusbar:epsg'])
         if type(self.epsgCodeDict) == type(''):
             wx.MessageBox(parent = self,
                           message = _("Unable to read EPSG codes: %s") % self.epsgCodeDict,
                           caption = _("Error"),  style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
             self.epsgCodeDict = dict()
-            list.SetItems([])
-            list.SetValue('')
+            epsgCombo.SetItems([])
+            epsgCombo.SetValue('')
             self.FindWindowById(self.winId['projection:statusbar:proj4']).SetValue('')
             return
         
         choices = map(str, self.epsgCodeDict.keys())
 
-        list.SetItems(choices)
-        try:
-            code = int(list.GetValue())
-        except ValueError:
-            code = -1
+        epsgCombo.SetItems(choices)
+        code = 4326 # default
         win = self.FindWindowById(self.winId['projection:statusbar:proj4'])
         if code in self.epsgCodeDict:
-            win.SetValue(self.epsgCodeDict[code][1])
+            epsgCombo.SetStringSelection(str(code))
+            win.SetValue(self.epsgCodeDict[code][1].replace('<>', '').strip())
         else:
-            list.SetSelection(0)
-            code = int(list.GetStringSelection())
-            win.SetValue(self.epsgCodeDict[code][1])
+            epsgCombo.SetSelection(0)
+            code = int(epsgCombo.GetStringSelection())
+            win.SetValue(self.epsgCodeDict[code][1].replace('<>', '').strip())
     
     def OnSetEpsgCode(self, event):
         """!EPSG code selected"""