Преглед изворни кода

Fix wxGUI location wizard: Search in description with 0 hits (trac https://trac.osgeo.org/grass/ticket/554)
(merge from relbr64, https://trac.osgeo.org/grass/changeset/36775 & https://trac.osgeo.org/grass/changeset/36776)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@36778 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa пре 16 година
родитељ
комит
f8c5596f5b
1 измењених фајлова са 8 додато и 5 уклоњено
  1. 8 5
      gui/wxpython/gui_modules/location_wizard.py

+ 8 - 5
gui/wxpython/gui_modules/location_wizard.py

@@ -621,7 +621,7 @@ class ItemList(wx.ListCtrl,
         """
         """
         if str == '':
         if str == '':
             self.Populate(self.sourceData)
             self.Populate(self.sourceData)
-            return None
+            return []
 
 
         data = []
         data = []
         str = str.lower()
         str = str.lower()
@@ -633,12 +633,13 @@ class ItemList(wx.ListCtrl,
             except UnicodeDecodeError:
             except UnicodeDecodeError:
                 # osgeo4w problem (should be fixed)
                 # osgeo4w problem (should be fixed)
                 pass
                 pass
-        self.Populate(data)
         
         
         if len(data) > 0:
         if len(data) > 0:
+            self.Populate(data)
             return data[0]
             return data[0]
         else:
         else:
-            return None
+            self.Populate(self.sourceData)
+            return []
 
 
 class ProjTypePage(TitledPage):
 class ProjTypePage(TitledPage):
     """
     """
@@ -1351,10 +1352,11 @@ class EPSGPage(TitledPage):
             if not nextButton.IsEnabled():
             if not nextButton.IsEnabled():
                 nextButton.Enable(True)
                 nextButton.Enable(True)
         else:
         else:
+            self.epsgcode = None # not found
             if nextButton.IsEnabled():
             if nextButton.IsEnabled():
                 nextButton.Enable(False)
                 nextButton.Enable(False)
             self.epsgdesc = self.epsgparams = ''
             self.epsgdesc = self.epsgparams = ''
-
+        
     def OnSearch(self, event):
     def OnSearch(self, event):
         value =  self.searchb.GetValue()
         value =  self.searchb.GetValue()
         if self.epsglist.GetItemCount() == 0:
         if self.epsglist.GetItemCount() == 0:
@@ -1364,9 +1366,10 @@ class EPSGPage(TitledPage):
         try:
         try:
             self.epsgcode = self.epsglist.Search(index=1, str=value)[0]
             self.epsgcode = self.epsglist.Search(index=1, str=value)[0]
             self.tcode.SetValue(str(self.epsgcode))
             self.tcode.SetValue(str(self.epsgcode))
-        except IndexError:
+        except IndexError: # -> no item found
             self.epsgcode = None
             self.epsgcode = None
             self.tcode.SetValue('')
             self.tcode.SetValue('')
+            self.searchb.SetValue('')
 
 
         event.Skip()
         event.Skip()