[GRASS-SVN] r54027 - grass/trunk/gui/wxpython/mapdisp

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 25 03:13:03 PST 2012


Author: annakrat
Date: 2012-11-25 03:13:03 -0800 (Sun, 25 Nov 2012)
New Revision: 54027

Modified:
   grass/trunk/gui/wxpython/mapdisp/frame.py
   grass/trunk/gui/wxpython/mapdisp/mapwindow.py
Log:
wxGUI/mapdisp: minor fixes, removed unused code

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2012-11-25 10:59:42 UTC (rev 54026)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2012-11-25 11:13:03 UTC (rev 54027)
@@ -39,7 +39,7 @@
 from vdigit.toolbars    import VDigitToolbar
 from mapdisp.toolbars   import MapToolbar, NvizIcons
 from mapdisp.gprint     import PrintOptions
-from core.gcmd          import GError, GMessage, RunCommand
+from core.gcmd          import GError, GMessage
 from dbmgr.dialogs      import DisplayAttributesDialog
 from core.utils         import ListOfCatsToRange, GetLayerNameFromCmd
 from gui_core.dialogs   import GetImageHandlers, ImageSizeDialog, DecorationDialog, TextLayerDialog
@@ -248,7 +248,7 @@
     def AddNviz(self):
         """!Add 3D view mode window
         """
-        from nviz.main import haveNviz, GLWindow
+        from nviz.main import haveNviz, GLWindow, errorMsg
         
         # check for GLCanvas and OpenGL
         if not haveNviz:
@@ -256,7 +256,7 @@
             GError(parent = self,
                    message = _("Unable to switch to 3D display mode.\nThe Nviz python extension "
                                "was not found or loaded properly.\n"
-                               "Switching back to 2D display mode.\n\nDetails: %s" % nviz.errorMsg))
+                               "Switching back to 2D display mode.\n\nDetails: %s" % errorMsg))
             return
         
         # disable 3D mode for other displays
@@ -589,7 +589,6 @@
         """
         Print options and output menu for map display
         """
-        point = wx.GetMousePosition()
         printmenu = wx.Menu()
         # Add items to the menu
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
@@ -640,7 +639,6 @@
         @param x,y coordinates
         @param layers selected tree item layers
         """
-        num = 0
         filteredLayers = []
         for layer in layers:
             ltype = self.tree.GetLayerInfo(layer, key = 'maplayer').GetType()
@@ -843,7 +841,6 @@
         """!Query tools menu"""
         if self.GetMapToolbar():
             self.SwitchTool(self.toolbars['map'], event)
-            action = self.toolbars['map'].GetAction()
         
         self.toolbars['map'].action['desc'] = 'queryMap'
         self.MapWindow.mouse['use'] = "query"
@@ -1075,7 +1072,7 @@
             raster.append(self.tree.GetLayerInfo(layer, key = 'maplayer').GetName())
 
         win = Histogram2Frame(parent = self, rasterList = raster)
-        win.CentreOnParent
+        win.CentreOnParent()
         win.Show()
         # Open raster select dialog to make sure that a raster (and the desired raster)
         # is selected to be histogrammed
@@ -1284,7 +1281,6 @@
     def OnZoomMenu(self, event):
         """!Popup Zoom menu
         """
-        point = wx.GetMousePosition()
         zoommenu = wx.Menu()
         
         for label, handler in ((_('Zoom to computational region'), self.OnZoomToWind),

Modified: grass/trunk/gui/wxpython/mapdisp/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/mapwindow.py	2012-11-25 10:59:42 UTC (rev 54026)
+++ grass/trunk/gui/wxpython/mapdisp/mapwindow.py	2012-11-25 11:13:03 UTC (rev 54027)
@@ -161,7 +161,7 @@
             if pdctype == 'image' and img:
                 drawid = self.imagedict[img]
             elif pdctype == 'clear':
-                drawid == None
+                drawid = None
             else:
                 drawid = wx.NewId()
         
@@ -582,7 +582,7 @@
         
         # was if self.Map.cmdfile and ...
         if self.IsAlwaysRenderEnabled() and self.img is None:
-                render = True
+            render = True
         
         #
         # initialize process bar (only on 'render')
@@ -1429,7 +1429,6 @@
             y = begin[1]
         else:
             y = end[1]
-        screenRect = wx.Rect(x, y, w, h)
         screenSize = self.GetClientSizeTuple()
         at = [(screenSize[1] - (y + h)) / float(screenSize[1]) * 100,
               (screenSize[1] - y) / float(screenSize[1]) * 100,
@@ -1579,8 +1578,6 @@
         @param ignoreNulls True to ignore null-values (valid only for rasters)
         @param render True to re-render display
         """
-        zoomreg = {}
-        
         if not layers:
             layers = self.GetSelectedLayer(multi = True)
         
@@ -1610,6 +1607,7 @@
         if not updated:
             self.Map.GetRegion(rast = rast,
                                vect = vect,
+                               zoom = ignoreNulls,
                                update = True)
         
         self.ZoomHistory(self.Map.region['n'], self.Map.region['s'],
@@ -1969,7 +1967,7 @@
                               
         @return (GraphicsSetItem) - added item reference
         """
-        item = GraphicsSetItem(coords = coords, penName = None, label = None, hide = False)
+        item = GraphicsSetItem(coords = coords, penName = penName, label = label, hide = hide)
         self.itemsList.append(item)
         
         return item
@@ -1984,7 +1982,7 @@
         """
         try:
             self.itemsList.remove(item)
-        except:
+        except ValueError:
             return False
         
         return True
@@ -2097,7 +2095,7 @@
         """ 
         try:
             return self.itemsList.index(item)
-        except:
+        except ValueError:
             return None
 
 class GraphicsSetItem:



More information about the grass-commit mailing list