[GRASS-SVN] r49470 - in grass/trunk/gui/wxpython: core dbmgr gmodeler mapdisp modules psmap tools

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 1 17:49:18 EST 2011


Author: martinl
Date: 2011-12-01 14:49:18 -0800 (Thu, 01 Dec 2011)
New Revision: 49470

Modified:
   grass/trunk/gui/wxpython/core/debug.py
   grass/trunk/gui/wxpython/core/render.py
   grass/trunk/gui/wxpython/dbmgr/manager.py
   grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py
   grass/trunk/gui/wxpython/gmodeler/frame.py
   grass/trunk/gui/wxpython/mapdisp/main.py
   grass/trunk/gui/wxpython/modules/mcalc_builder.py
   grass/trunk/gui/wxpython/psmap/frame.py
   grass/trunk/gui/wxpython/tools/update_menudata.py
Log:
wxGUI: fix modules with `main` fn


Modified: grass/trunk/gui/wxpython/core/debug.py
===================================================================
--- grass/trunk/gui/wxpython/core/debug.py	2011-12-01 21:42:40 UTC (rev 49469)
+++ grass/trunk/gui/wxpython/core/debug.py	2011-12-01 22:49:18 UTC (rev 49470)
@@ -65,12 +65,3 @@
 
 # Debug instance
 Debug = DebugMsg()
-
-# testing
-if __name__ == "__main__":
-    from core import cmd as gcmd
-    gcmd.RunCommand('g.gisenv',
-                    set = 'DEBUG=3')
-                
-    for level in range (4):
-        Debug.msg (level, "message level=%d" % level)

Modified: grass/trunk/gui/wxpython/core/render.py
===================================================================
--- grass/trunk/gui/wxpython/core/render.py	2011-12-01 21:42:40 UTC (rev 49469)
+++ grass/trunk/gui/wxpython/core/render.py	2011-12-01 22:49:18 UTC (rev 49470)
@@ -1429,24 +1429,3 @@
         for layer in self.overlays:
             if force or layer.force_render:
                 layer.Render()
-                
-if __name__ == "__main__":
-    import gettext
-    gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
-    
-    Map = Map()
-    Map.GetRegion(update = True)
-    
-    Map.AddLayer(type = "raster",
-                 name = "elevation",
-                 command = ["d.rast", "map=elevation at PERMANENT"],
-                 l_opacity = .7)
-    
-    Map.AddLayer(type = "vector",
-                 name = "roadsmajor",
-                 command = ["d.vect", "map=roadsmajor at PERMANENT", "color=red", "width=3", "type=line"])
-    
-    image = Map.Render(force = True)
-    
-    if image:
-        grass.call(["display", image])

Modified: grass/trunk/gui/wxpython/dbmgr/manager.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/manager.py	2011-12-01 21:42:40 UTC (rev 49469)
+++ grass/trunk/gui/wxpython/dbmgr/manager.py	2011-12-01 22:49:18 UTC (rev 49470)
@@ -37,6 +37,8 @@
 import copy
 import types
 
+if __name__ == "__main__":
+    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
 from core import globalvar
 import wx
 import wx.lib.mixins.listctrl as listmix

Modified: grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py	2011-12-01 21:42:40 UTC (rev 49469)
+++ grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py	2011-12-01 22:49:18 UTC (rev 49470)
@@ -24,14 +24,16 @@
 import os
 import sys
 
+if __name__ == "__main__":
+    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
 from core import globalvar
 import wx
 
-import grass.script as grass
-
 from core.gcmd   import RunCommand, GError
 from dbmgr.vinfo import createDbInfoDesc, VectorDBInfo
 
+import grass.script as grass
+
 class SQLFrame(wx.Frame):
     """!SQL Frame class"""
     def __init__(self, parent, title, vectmap, id = wx.ID_ANY,

Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py	2011-12-01 21:42:40 UTC (rev 49469)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py	2011-12-01 22:49:18 UTC (rev 49470)
@@ -32,14 +32,14 @@
 import copy
 import re
 
+if __name__ == "__main__":
+    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
+from core                 import globalvar
 import wx
 from wx.lib import ogl
 import wx.lib.flatnotebook    as FN
 import wx.lib.mixins.listctrl as listmix
 
-if __name__ == "__main__":
-    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
-from core                 import globalvar
 from gui_core.widgets     import GNotebook
 from gui_core.goutput     import GMConsole
 from core.debug           import Debug

Modified: grass/trunk/gui/wxpython/mapdisp/main.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/main.py	2011-12-01 21:42:40 UTC (rev 49469)
+++ grass/trunk/gui/wxpython/mapdisp/main.py	2011-12-01 22:49:18 UTC (rev 49470)
@@ -24,10 +24,11 @@
 import os
 import sys
 
+if __name__ == "__main__":
+    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
+from core          import globalvar
 import wx
 
-sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
-from core          import globalvar
 from core.gcmd     import RunCommand
 from core.render   import Map
 from mapdisp.frame import MapFrame

Modified: grass/trunk/gui/wxpython/modules/mcalc_builder.py
===================================================================
--- grass/trunk/gui/wxpython/modules/mcalc_builder.py	2011-12-01 21:42:40 UTC (rev 49469)
+++ grass/trunk/gui/wxpython/modules/mcalc_builder.py	2011-12-01 22:49:18 UTC (rev 49470)
@@ -17,7 +17,10 @@
 """
 
 import os
+import sys
 
+if __name__ == "__main__":
+    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
 from core import globalvar
 import wx
 

Modified: grass/trunk/gui/wxpython/psmap/frame.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/frame.py	2011-12-01 21:42:40 UTC (rev 49469)
+++ grass/trunk/gui/wxpython/psmap/frame.py	2011-12-01 22:49:18 UTC (rev 49470)
@@ -26,6 +26,9 @@
 except ImportError:
     havePILImage = False
 
+if __name__ == "__main__":
+    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
+from core             import globalvar
 import wx
 
 try:
@@ -35,9 +38,6 @@
 
 import grass.script as grass
 
-if __name__ == "__main__":
-    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
-from core             import globalvar
 from gui_core.menu    import Menu
 from gui_core.goutput import CmdThread, EVT_CMD_DONE
 from psmap.toolbars   import PsMapToolbar

Modified: grass/trunk/gui/wxpython/tools/update_menudata.py
===================================================================
--- grass/trunk/gui/wxpython/tools/update_menudata.py	2011-12-01 21:42:40 UTC (rev 49469)
+++ grass/trunk/gui/wxpython/tools/update_menudata.py	2011-12-01 22:49:18 UTC (rev 49470)
@@ -30,7 +30,10 @@
 from grass.script import core as grass
 from grass.script import task as gtask
 
-from core.menudata import ManagerData
+if __name__ == "__main__":
+    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
+from lmgr.menudata  import ManagerData
+from core.globalvar import grassCmd
 
 def parseModules():
     """!Parse modules' interface"""
@@ -42,9 +45,9 @@
                 'g.parser',
                 'vcolors' ]
     
-    count = len(globalvar.grassCmd['all'])
+    count = len(grassCmd['all'])
     i = 0
-    for module in globalvar.grassCmd['all']:
+    for module in grassCmd['all']:
         i += 1
         if i % 10 == 0:
             grass.info('* %d/%d' % (i, count))
@@ -52,8 +55,8 @@
             continue
         try:
             interface = gtask.parse_interface(module)
-        except IOError, e:
-            grass.error(e)
+        except StandardError, e:
+            grass.error(module + ': ' + str(e))
             continue
         modules[interface.name] = { 'label'   : interface.label,
                                     'desc'    : interface.description,
@@ -170,9 +173,4 @@
     if os.getenv("GISBASE") is None:
         sys.exit("You must be in GRASS GIS to run this program.")
     
-    sys.path.append(os.path.join(os.getenv("GISBASE"), 'etc', 'wxpython', 'gui_modules'))
-    import menudata
-    import menuform
-    from core import globalvar
-    
     sys.exit(main())



More information about the grass-commit mailing list