[GRASS-SVN] r39376 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 2 14:03:34 EDT 2009


Author: cmbarton
Date: 2009-10-02 14:03:34 -0400 (Fri, 02 Oct 2009)
New Revision: 39376

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/georect.py
Log:
Fixed several bugs in georectifier. Main one is that it wouldn't georectify because it wasn't running i.rectify in the source location. Also fixed some cosmetics and cleanup routines. 

Ability to create a group from within the georectifier wizard is still broken. I will create or update a ticket on this.

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/georect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/georect.py	2009-10-02 15:48:03 UTC (rev 39375)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/georect.py	2009-10-02 18:03:34 UTC (rev 39376)
@@ -209,7 +209,10 @@
             #
             # show new display & draw map
             #
+            self.xy_mapdisp.CenterOnScreen()
             self.xy_mapdisp.Show()
+            self.gcpmgr.Centre()
+            self.gcpmgr.Raise()
         else:
             self.Cleanup()
                             
@@ -275,6 +278,7 @@
     def Cleanup(self):
         """Return to current location and mapset"""
         self.SwitchEnv('original')
+                
         self.parent.georectifying = None
 
         if hasattr(self, "xy_mapdisp"):
@@ -282,7 +286,12 @@
             self.xy_mapdisp = None
 
         self.wizard.Destroy()
+        
+        # clear GCPs from target display
+        self.gcpmgr.ClearGCP(event=None)
+        self.parent.curr_page.maptree.mapdisplay.MapWindow.UpdateMap(render=False)
 
+
 class LocationPage(TitledPage):
     """
     Set map type (raster or vector) to georectify and
@@ -489,9 +498,11 @@
         
     def OnMkGroup(self, event):
         """Create new group in source location/mapset"""
+        self.parent.SwitchEnv('new')
         menuform.GUI().ParseCommand(['i.group'],
                                     completed=(self.GetOptData, None, ''),
                                     parentframe=self.parent.parent, modal=True)
+        self.parent.SwitchEnv('original')
 
     def OnVGroup(self, event):
         """Add vector maps to group"""
@@ -1040,6 +1051,8 @@
         """
         global maptype
         self.SaveGCPs(None)
+        cmd_stdout = ''
+        cmd_stderr = ''
         
         if self.CheckGCPcount(msg=True) == False:
             return
@@ -1051,9 +1064,31 @@
             if self.clip_to_region:
                 cmdlist.append('-c')
             
-            self.parent.goutput.RunCmd(cmdlist, compReg=False,
-                                       switchPage=True)
+            p = gcmd.Command(cmdlist, stdout=cmd_stdout, stderr=cmd_stderr)
+            output = p.ReadStdOutput()
+            error = p.ReadErrOutput()
             
+            # printing to console
+            for i in error: 
+                i = i.split(':')
+                if len(i) >1: 
+                    if i[0] == 'GRASS_INFO_PERCENT':
+                        print i[1]+'% completed'
+                    else:
+                        print i[1]
+            for i in output: 
+                i = i.split(':')
+                if len(i) >1: 
+                    if i[0] == 'GRASS_INFO_PERCENT':
+                        print i[1]+'% completed'
+                    else:
+                        print i[1]
+            
+            if p.returncode == 0:
+                wx.MessageBox('Maps in group %s georectified successfully' % self.xygroup)
+            else:
+                wx.MessageBox('ERROR...',error)
+
             time.sleep(.1)
             self.grwiz.SwitchEnv('original')
 
@@ -1373,6 +1408,7 @@
             coords.append(self.GetItem(index, i).GetText())
         
         dlg = EditGPC(parent=self, id=wx.ID_ANY, data=coords)
+
         if dlg.ShowModal() == wx.ID_OK:
             values = dlg.GetValues() # string
             



More information about the grass-commit mailing list