[GRASS-SVN] r42076 - grass-addons/gui/wxpython/data_catalog

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 1 06:47:41 EDT 2010


Author: rashadkm
Date: 2010-05-01 06:47:40 -0400 (Sat, 01 May 2010)
New Revision: 42076

Modified:
   grass-addons/gui/wxpython/data_catalog/catalog.py
   grass-addons/gui/wxpython/data_catalog/mapdisplay.py
Log:
fixed coordinate view on map display

Modified: grass-addons/gui/wxpython/data_catalog/catalog.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/catalog.py	2010-05-01 10:26:57 UTC (rev 42075)
+++ grass-addons/gui/wxpython/data_catalog/catalog.py	2010-05-01 10:47:40 UTC (rev 42076)
@@ -36,7 +36,11 @@
 
 
 gbase = os.getenv("GISBASE") 
-pypath = os.path.join(gbase,'etc','gui','wxpython')
+grassversion = os.getenv("GRASS_VERSION")
+if grassversion == "7.0.svn":
+    pypath = os.path.join(gbase,'etc','gui','wxpython')
+else:
+    pypath = os.path.join(gbase,'etc','wxpython')
 sys.path.append(pypath)
 
 
@@ -56,7 +60,11 @@
 
 #To run DataCatalog from any directory set this pathname for access to gui_modules 
 gbase = os.getenv("GISBASE") 
-pypath = os.path.join(gbase,'etc','gui','wxpython','gui_modules')
+if grassversion == "7.0.svn":
+    pypath = os.path.join(gbase,'etc','gui','wxpython','gui_modules')
+else:
+    pypath = os.path.join(gbase,'etc','wxpython','gui_modules')
+
 sys.path.append(pypath)
 
 
@@ -87,8 +95,7 @@
 import gui_modules.workspace as workspace
 import gui_modules.colorrules as colorrules
 
-version = os.getenv("GRASS_VERSION")
-if version != "6.4.svn":
+if grassversion != "6.4.0svn":
     import gui_modules.menu as menu
     import gui_modules.gmodeler as gmodeler
 
@@ -175,8 +182,7 @@
         self.loclist.sort()
 
         #self.pg_panel4 = None
-        version = os.getenv("GRASS_VERSION")
-        if version != "6.4.svn":
+        if grassversion != "6.4.0svn":
             self.menubar = menu.Menu(parent = self, data = menudata.ManagerData())
         else:
             self.menubar, self.menudata = self.__createMenuBar()
@@ -251,8 +257,7 @@
         """!Creates menubar"""
 
         self.menubar = wx.MenuBar()
-        version = os.getenv("GRASS_VERSION")
-        if version == "6.5.svn":
+        if grassversion == "6.5.svn":
             self.menudata = menudata.ManagerData()
         else:
             self.menudata = menudata.Data()        
@@ -318,8 +323,7 @@
                 subMenu = self.__createMenu(eachItem[1])
                 menu.AppendMenu(wx.ID_ANY, label, subMenu)
             else:
-                version = os.getenv("GRASS_VERSION")
-                if version == "6.4.0svn":
+                if grassversion == "6.4.0svn":
                     self.__createMenuItem(menu, *eachItem)
                 else:
                     self.__createMenuItem7(menu, *eachItem)
@@ -1967,7 +1971,8 @@
         self.page = self.notebook.GetPage(self.notebook.GetSelection())
         self.page.Map.__init__()	
         self.page.Map.region = self.page.Map.GetRegion()
-        if version != "6.4.svn":
+        
+        if grassversion != "6.4.0svn":
             self.page.Map.projinfo = self.page.Map._projInfo()
         else:
             self.page.Map.projinfo = self.page.Map.ProjInfo()
@@ -2092,8 +2097,8 @@
         Update $HOME/.grassrc(6/7) and gisrc files
         """
         rc = os.getenv("GISRC")
-        version = os.getenv("GRASS_VERSION")
-        if version == "7.0.svn":
+        grassversion = os.getenv("GRASS_VERSION")
+        if grassversion == "7.0.svn":
             grassrc = os.path.join(os.getenv('HOME'), ".grassrc7.%s" % os.uname()[1])
             if not os.access(grassrc, os.R_OK):
                 grassrc = os.path.join(os.getenv('HOME'), ".grassrc7")

Modified: grass-addons/gui/wxpython/data_catalog/mapdisplay.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/mapdisplay.py	2010-05-01 10:26:57 UTC (rev 42075)
+++ grass-addons/gui/wxpython/data_catalog/mapdisplay.py	2010-05-01 10:47:40 UTC (rev 42076)
@@ -2337,6 +2337,8 @@
         else:
             self.statusbar = self.frame.GetStatusBar()
 
+
+
             
 
         self.statusbarWin = dict()
@@ -2679,6 +2681,8 @@
             #
             if self.tree:
                 self.tree.EnableItemType(type='3d-raster', enable=True)
+
+            self.toggleStatus.Enable(False)
             
             #
             # update status bar
@@ -2775,7 +2779,7 @@
         self.toolbars['map'].combo.SetValue (_("2D view"))
         self.toolbars['map'].Enable2D(True)
         self.statusbarWin['toggle'].Enable(True)
-
+        self.toggleStatus.Enable(True)
         self._mgr.Update()
 
     def __InitDisplay(self):
@@ -2816,6 +2820,12 @@
         
         event.Skip()
 
+    def OnToggleStatus(self, event):
+        """
+        Toggle status text
+        """
+        self.StatusbarUpdate()
+
     def OnMotion(self, event):
         """
         Mouse moved
@@ -2823,10 +2833,6 @@
         """
         # update statusbar if required
         if self.statusbarWin['toggle'].GetSelection() == 0: # Coordinates
-            precision = int(UserSettings.Get(group = 'projection', key = 'format',
-                                             subkey = 'precision'))
-            format = UserSettings.Get(group = 'projection', key = 'format',
-                                      subkey = 'll')
             e, n = self.MapWindow.Pixel2Cell(event.GetPositionTuple())
             if self.toolbars['vdigit'] and \
                     self.toolbars['vdigit'].GetAction() == 'addLine' and \
@@ -2840,43 +2846,17 @@
                     distance_tot += self.MapWindow.Distance(self.MapWindow.polycoords[idx-1],
                                                             self.MapWindow.polycoords[idx],
                                                             screen=False )[0]
-                self.statusbar.SetStatusText("%.*f, %.*f (seg: %.*f; tot: %.*f)" % \
-                                                 (precision, e, precision, n,
-                                                  precision, distance_seg,
-                                                  precision, distance_tot), 0)
+                self.statusbar.SetStatusText("%.2f, %.2f (seg: %.2f; tot: %.2f)" % \
+                                                 (e, n, distance_seg, distance_tot), 0)
             else:
-                if self.statusbarWin['projection'].IsChecked():
-                    if not UserSettings.Get(group='projection', key='statusbar', subkey='proj4'):
-                        self.statusbar.SetStatusText(_("Projection not defined (check the settings)"), 0)
-                    else:
-                        proj, coord  = utils.ReprojectCoordinates(coord = (e, n),
-                                                                  projOut = UserSettings.Get(group='projection',
-                                                                                             key='statusbar',
-                                                                                             subkey='proj4'),
-                                                                  flags = 'd')
-                    
-                        if coord:
-                            e, n = coord
-                            if proj in ('ll', 'latlong', 'longlat') and format == 'DMS':
-                                self.statusbar.SetStatusText("%s" % \
-                                                                 utils.Deg2DMS(e, n, precision = precision),
-                                                             0)
-                            else:
-                                self.statusbar.SetStatusText("%.*f; %.*f" % \
-                                                                 (precision, e, precision, n), 0)
-                        else:
-                            self.statusbar.SetStatusText(_("Error in projection (check the settings)"), 0)
+                if self.Map.projinfo['proj'] == 'll':
+                    self.statusbar.SetStatusText("%s" % utils.Deg2DMS(e, n), 0)
                 else:
-                    if self.Map.projinfo['proj'] == 'll' and format == 'DMS':
-                        self.statusbar.SetStatusText("%s" % \
-                                                         utils.Deg2DMS(e, n, precision = precision),
-                                                     0)
-                    else:
-                        self.statusbar.SetStatusText("%.*f; %.*f" % \
-                                                         (precision, e, precision, n), 0)
-                
+                    self.statusbar.SetStatusText("%.2f, %.2f" % (e, n), 0)
+        
         event.Skip()
 
+
     def OnDraw(self, event):
         """
         Re-display current map composition



More information about the grass-commit mailing list