Bläddra i källkod

update example of wxpython gui

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54837 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi 12 år sedan
förälder
incheckning
53872783cc
2 ändrade filer med 23 tillägg och 22 borttagningar
  1. 12 10
      doc/gui/wxpython/example/README
  2. 11 12
      doc/gui/wxpython/example/frame.py

+ 12 - 10
doc/gui/wxpython/example/README

@@ -16,15 +16,22 @@ look at the source code to see how it works.
 Run Example Tool
 Run Example Tool
 ----------------
 ----------------
 To run Example Tool can run as a standalone application (in GRASS environment)
 To run Example Tool can run as a standalone application (in GRASS environment)
-or it can be launched from Layer Manager menu.
+or it can be launched from the console.
 
 
 1. Go to GRASS root directory
 1. Go to GRASS root directory
 
 
 2. Copy directory ./doc/gui/wxpython/example to ./gui/wxpython/example
 2. Copy directory ./doc/gui/wxpython/example to ./gui/wxpython/example
 
 
-3. Move file ./gui/wxpython/example/wxGUI.Example.html to ./gui/wxpython/docs/
+3. Now you should be able to run Example Tool as a standalone 
+application in GRASS environment. Start GRASS GIS and start application:
+
+    > python ./gui/wxpython/example/frame.py
 
 
-4. Edit ./gui/wxpython/Makefile:
+If you want to add Example Tool in the compilation.
+
+4. Move file ./gui/wxpython/example/wxGUI.Example.html to ./gui/wxpython/docs/
+
+5. Edit ./gui/wxpython/Makefile:
 
 
  SRCFILES := $(wildcard icons/*.* scripts/* xml/*) \
  SRCFILES := $(wildcard icons/*.* scripts/* xml/*) \
 -	$(wildcard core/* dbmgr/* gcp/* gmodeler/* ... \
 -	$(wildcard core/* dbmgr/* gcp/* gmodeler/* ... \
@@ -33,13 +40,8 @@ or it can be launched from Layer Manager menu.
 -PYDSTDIRS := $(patsubst %,$(ETCDIR)/%,core dbmgr gcp gmodeler ... \
 -PYDSTDIRS := $(patsubst %,$(ETCDIR)/%,core dbmgr gcp gmodeler ... \
 +PYDSTDIRS := $(patsubst %,$(ETCDIR)/%,core dbmgr example gcp gmodeler ... \
 +PYDSTDIRS := $(patsubst %,$(ETCDIR)/%,core dbmgr example gcp gmodeler ... \
 
 
-5. Run make (in ./gui/wxpython)
-
-6. Now you should be able to run Example Tool as a standalone 
-application in GRASS environment. Start GRASS GIS and start application:
-
-    > python ./gui/wxpython/example/frame.py
-
+6. Run make (in ./gui/wxpython)
+    
 If you want to access Example Tool from Layer Manager menu, there are
 If you want to access Example Tool from Layer Manager menu, there are
 a few more things to be done.
 a few more things to be done.
 
 

+ 11 - 12
doc/gui/wxpython/example/frame.py

@@ -22,14 +22,13 @@ import wx
 # this enables to run application standalone (> python example/frame.py )
 # this enables to run application standalone (> python example/frame.py )
 if __name__ == "__main__":
 if __name__ == "__main__":
     sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
     sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
-    
-from gui_core.mapdisp   import SingleMapFrame
-from gui_core.forms     import GUI
-from mapdisp.mapwindow  import BufferedWindow
-from mapdisp            import statusbar as sb
-from core.render        import Map
-from core.debug         import Debug
-from core.gcmd          import RunCommand
+
+from gui_core.mapdisp import SingleMapFrame
+from mapdisp.mapwindow import BufferedWindow
+from mapdisp import statusbar as sb
+from core.render import Map
+from core.debug import Debug
+from core.gcmd import RunCommand
 
 
 import grass.script as grass
 import grass.script as grass
 
 
@@ -117,7 +116,7 @@ class ExampleMapFrame(SingleMapFrame):
         
         
         
         
         # create map window
         # create map window
-        self.MapWindow = BufferedWindow(self, Map = self.GetMap(), frame = self)
+        self.MapWindow = BufferedWindow(self, Map = self.GetMap(), frame = self, giface = self)
         
         
         # create whatever you want, here it is a widget for displaying raster info
         # create whatever you want, here it is a widget for displaying raster info
         self.info = ExampleInfoTextManager(self)
         self.info = ExampleInfoTextManager(self)
@@ -262,9 +261,9 @@ class ExampleMapFrame(SingleMapFrame):
         self.GetMap().DeleteAllLayers()
         self.GetMap().DeleteAllLayers()
         cmdlist = ['d.rast', 'map=%s' % name]
         cmdlist = ['d.rast', 'map=%s' % name]
         # add layer to Map instance (core.render)
         # add layer to Map instance (core.render)
-        newLayer = self.GetMap().AddLayer(type = 'raster', command = cmdlist, l_active = True,
-                                          name = name, l_hidden = False, l_opacity = 1.0,
-                                          l_render = True)
+        newLayer = self.GetMap().AddLayer(ltype = 'raster', command = cmdlist, active = True,
+                                          name = name, hidden = False, opacity = 1.0,
+                                          render = True)
         self.GetWindow().ZoomToMap(layers = [newLayer,], render = True)
         self.GetWindow().ZoomToMap(layers = [newLayer,], render = True)
         self.currentRaster = name
         self.currentRaster = name