소스 검색

wxGUI/mapdisp: minor fixes, removed unused code

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54027 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 12 년 전
부모
커밋
2465c7293f
2개의 변경된 파일10개의 추가작업 그리고 16개의 파일을 삭제
  1. 4 8
      gui/wxpython/mapdisp/frame.py
  2. 6 8
      gui/wxpython/mapdisp/mapwindow.py

+ 4 - 8
gui/wxpython/mapdisp/frame.py

@@ -39,7 +39,7 @@ from core.render        import EVT_UPDATE_PRGBAR
 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 @@ class MapFrame(SingleMapFrame):
     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 @@ class MapFrame(SingleMapFrame):
             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 @@ class MapFrame(SingleMapFrame):
         """
         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 @@ class MapFrame(SingleMapFrame):
         @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 @@ class MapFrame(SingleMapFrame):
         """!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 @@ class MapFrame(SingleMapFrame):
             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 @@ class MapFrame(SingleMapFrame):
     def OnZoomMenu(self, event):
         """!Popup Zoom menu
         """
-        point = wx.GetMousePosition()
         zoommenu = wx.Menu()
         
         for label, handler in ((_('Zoom to computational region'), self.OnZoomToWind),

+ 6 - 8
gui/wxpython/mapdisp/mapwindow.py

@@ -161,7 +161,7 @@ class BufferedWindow(MapWindow, wx.Window):
             if pdctype == 'image' and img:
                 drawid = self.imagedict[img]
             elif pdctype == 'clear':
-                drawid == None
+                drawid = None
             else:
                 drawid = wx.NewId()
         
@@ -582,7 +582,7 @@ class BufferedWindow(MapWindow, wx.Window):
         
         # 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 @@ class BufferedWindow(MapWindow, wx.Window):
             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 @@ class BufferedWindow(MapWindow, wx.Window):
         @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 @@ class BufferedWindow(MapWindow, wx.Window):
         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 @@ class GraphicsSet:
                               
         @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 @@ class GraphicsSet:
         """
         try:
             self.itemsList.remove(item)
-        except:
+        except ValueError:
             return False
         
         return True
@@ -2097,7 +2095,7 @@ class GraphicsSet:
         """ 
         try:
             return self.itemsList.index(item)
-        except:
+        except ValueError:
             return None
 
 class GraphicsSetItem: