[GRASS-SVN] r53601 - grass/trunk/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 28 12:01:19 PDT 2012


Author: martinl
Date: 2012-10-28 12:01:18 -0700 (Sun, 28 Oct 2012)
New Revision: 53601

Modified:
   grass/trunk/gui/wxpython/gui_core/gselect.py
Log:
wxGUI: list PG databases, try `db.databases` first


Modified: grass/trunk/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/gselect.py	2012-10-28 18:24:48 UTC (rev 53600)
+++ grass/trunk/gui/wxpython/gui_core/gselect.py	2012-10-28 19:01:18 UTC (rev 53601)
@@ -1763,7 +1763,12 @@
             if format == 'SQLite' or format == 'Rasterlite':
                 win = self.input['db-win']['file']
             elif format == 'PostgreSQL' or format == 'PostGIS WKT Raster driver':
-                if grass.find_program('psql', ['--help']):
+                # try to get list of PG databases
+                db = RunCommand('db.databases', quiet = True, read = True,
+                                driver = 'pg').splitlines()
+                if db is not None:
+                    win.SetItems(sorted(db))
+                elif grass.find_program('psql', ['--help']):
                     win = self.input['db-win']['choice']
                     if not win.GetItems():
                         p = grass.Popen(['psql', '-ltA'], stdout = grass.PIPE)



More information about the grass-commit mailing list