Browse Source

wxGUI: fix and use fast v.category option

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@55942 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 12 years ago
parent
commit
ce2b50090d
2 changed files with 3 additions and 20 deletions
  1. 1 2
      gui/wxpython/core/utils.py
  2. 2 18
      gui/wxpython/gui_core/gselect.py

+ 1 - 2
gui/wxpython/core/utils.py

@@ -310,8 +310,7 @@ def GetVectorNumberOfLayers(vector):
                                getErrorMsg = True,
                                getErrorMsg = True,
                                read = True,
                                read = True,
                                input = fullname,
                                input = fullname,
-                               option = 'layers',
-                               sep = ';')
+                               option = 'layers')
     if ret != 0:
     if ret != 0:
         sys.stderr.write(_("Vector map <%(map)s>: %(msg)s\n") % { 'map' : fullname, 'msg' : msg })
         sys.stderr.write(_("Vector map <%(map)s>: %(msg)s\n") % { 'map' : fullname, 'msg' : msg })
         return layers
         return layers

+ 2 - 18
gui/wxpython/gui_core/gselect.py

@@ -58,6 +58,7 @@ from gui_core.widgets  import ManageSettingsWidget
 from core.gcmd     import RunCommand, GError, GMessage
 from core.gcmd     import RunCommand, GError, GMessage
 from core.utils    import GetListOfLocations, GetListOfMapsets, GetFormats
 from core.utils    import GetListOfLocations, GetListOfMapsets, GetFormats
 from core.utils    import GetSettingsPath, GetValidLayerName, ListSortLower
 from core.utils    import GetSettingsPath, GetValidLayerName, ListSortLower
+from core.utils    import GetVectorNumberOfLayers
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.debug    import Debug
 from core.debug    import Debug
 
 
@@ -815,24 +816,7 @@ class LayerSelect(wx.ComboBox):
             layers.append('-1')
             layers.append('-1')
 
 
         if vector:
         if vector:
-            ret = RunCommand('v.category',
-                             read = True,
-                             quiet = True,
-                             option = 'report',
-                             flags = 'g',
-                             input = vector)
-            if ret:
-                for line in ret.splitlines():
-                    if 'all' not in line:
-                        continue
-                    try:
-                        layer = line.split(' ')[0]
-                    except IndexError:
-                        continue
-                    # use this to get layer names
-                    # but only when all modules use Vect_get_field2()
-                    # which is not the case right now
-                    layers.append(layer)
+	    layers = GetVectorNumberOfLayers(vector)
 
 
         elif dsn:
         elif dsn:
             ret = RunCommand('v.in.ogr',
             ret = RunCommand('v.in.ogr',