[GRASS-SVN] r45403 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 14 10:21:52 EST 2011


Author: martinl
Date: 2011-02-14 07:21:52 -0800 (Mon, 14 Feb 2011)
New Revision: 45403

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: some minor vdigit fixes
(merge r45402 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py	2011-02-14 15:14:33 UTC (rev 45402)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py	2011-02-14 15:21:52 UTC (rev 45403)
@@ -116,7 +116,8 @@
             self.digit.GetDisplay().DrawMap()
         
         # translate tmp objects (pointer position)
-        if self.toolbar.GetAction() == 'moveLine':
+        if self.toolbar.GetAction() == 'moveLine' and \
+                hasattr(self, "moveInfo"):
             if self.moveInfo.has_key('beginDiff'):
                 # move line
                 for id in self.moveInfo['id']:
@@ -284,11 +285,11 @@
         """!Left mouse button pressed - vector digitizer move
         feature/vertex, edit linear feature
         """
-        self.moveInfo = {}
+        self.moveInfo = dict()
         # geographic coordinates of initial position (left-down)
         self.moveInfo['begin'] = None
         # list of ids to modify    
-        self.moveInfo['id'] = []
+        self.moveInfo['id'] = list()
         
         if self.toolbar.GetAction() in ["moveVertex", "editLine"]:
             # set pen
@@ -416,7 +417,6 @@
         if self.mouse["use"] != "pointer" or not self.toolbar:
             return
         
-        digitClass = self.parent.digit
         if (self.toolbar.GetAction() == "addLine" and \
                 self.toolbar.GetAction('type') in ["line", "boundary", "area"]) or \
                 self.toolbar.GetAction() == "editLine":
@@ -507,11 +507,9 @@
                 hasattr(self, "moveInfo"):
             self.OnLeftDownEditLine(event)
 
-        elif self.toolbar.GetAction() in ("moveLine", 
-                                          "moveVertex",
-                                          "editLine") and \
-                                          not hasattr(self, "moveInfo"):
-                                          self.OnLeftDownVDigitMoveLine(event)
+        elif self.toolbar.GetAction() in ("moveLine", "moveVertex", "editLine") and \
+                not hasattr(self, "moveInfo"):
+            self.OnLeftDownMoveLine(event)
         
         elif self.toolbar.GetAction() in ("displayAttrs"
                                           "displayCats"):
@@ -589,7 +587,7 @@
                     self.copyCatsIds = self.digit.GetDisplay().GetSelected()
         
         elif self.toolbar.GetAction() == "queryLine":
-            selected = digitClass.SelectLinesByQuery(bbox = (pos1, pos2))
+            selected = self.digit.SelectLinesByQuery(bbox = (pos1, pos2))
             nselected = len(selected)
             if nselected > 0:
                 self.digit.GetDisplay().SetSelected(selected)
@@ -612,8 +610,8 @@
                         nselected = 1
         
         if nselected > 0:
-            if self.toolbar.GetAction() in ("moveLine",
-                                            "moveVertex"):
+            if self.toolbar.GetAction() in ("moveLine", "moveVertex") and \
+                    hasattr(self, "moveInfo"):
                 # get pseudoDC id of objects which should be redrawn
                 if self.toolbar.GetAction() == "moveLine":
                     # -> move line
@@ -758,8 +756,8 @@
             self.UpdateMap(render = False)
         
     def OnLeftUp(self, event):
-        if hasattr(self, "infoMove"):
-            if len(digitClass.GetDisplay().GetSelected()) == 0:
+        if hasattr(self, "moveInfo"):
+            if len(self.digit.GetDisplay().GetSelected()) == 0:
                 self.moveInfo['begin'] = self.Pixel2Cell(self.mouse['begin']) # left down
             
             # eliminate initial mouse moving efect

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2011-02-14 15:14:33 UTC (rev 45402)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2011-02-14 15:21:52 UTC (rev 45403)
@@ -12,9 +12,9 @@
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
+ at author Martin Landa <landa.martin gmail.com>
 @author Michael Barton
 @author Jachym Cepicky
- at author Martin Landa <landa.martin gmail.com>
 """
 
 import os
@@ -474,7 +474,7 @@
                 # draw to the dc
                 self.pdc.DrawToDC(dc)
                 
-                if isinstace(self, VDigitWindow):
+                if hasattr(self, "digit"):
                     # decorate with GDDC (transparency)
                     try:
                         gcdc = wx.GCDC(dc)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2011-02-14 15:14:33 UTC (rev 45402)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2011-02-14 15:21:52 UTC (rev 45403)
@@ -31,7 +31,7 @@
  Or you set an alias or wrap the call up in a nice shell script, GUI
  environment ... please contribute your idea.
 
-Copyright(C) 2000-2010 by the GRASS Development Team
+Copyright(C) 2000-2011 by the GRASS Development Team
 This program is free software under the GPL(>=v2) Read the file
 COPYING coming with GRASS for details.
 
@@ -335,10 +335,11 @@
             self.request = callable(*args, **kwds)
 
             self.resultQ.put((requestId, self.request.run()))
-                        
-            event = wxUpdateDialog(data = self.request.data)
-            wx.PostEvent(self.parent, event)
-
+           
+            if self.request:
+                event = wxUpdateDialog(data = self.request.data)
+                wx.PostEvent(self.parent, event)
+        
 class grassTask:
     """!This class holds the structures needed for both filling by the
     parser and use by the interface constructor.



More information about the grass-commit mailing list