[GRASS-SVN] r34202 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Nov 9 06:57:30 EST 2008
Author: martinl
Date: 2008-11-09 06:57:30 -0500 (Sun, 09 Nov 2008)
New Revision: 34202
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/georect.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: georectify tool fixed (step 1)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/georect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/georect.py 2008-11-09 11:26:58 UTC (rev 34201)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/georect.py 2008-11-09 11:57:30 UTC (rev 34202)
@@ -817,7 +817,13 @@
mapWin.polypen = wx.Pen(colour=wxCol, width=wpx, style=wx.SOLID) # ?
coord = mapWin.Cell2Pixel((gcp[coordtype][0], gcp[coordtype][1]))
mapWin.DrawCross(pdc=mapWin.pdcTmp, coords=coord,
- size=5, text=('%s' % str(idx + 1), font, wxCol, 0.0))
+ size=5, text={ 'text' : '%s' % str(idx + 1),
+ 'font' : font,
+ 'color': wxCol,
+ 'coords': [coord[0] + 5,
+ coord[1] + 5,
+ 5,
+ 5]})
idx += 1
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2008-11-09 11:26:58 UTC (rev 34201)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2008-11-09 11:57:30 UTC (rev 34202)
@@ -418,7 +418,10 @@
# self.ovlcoords[drawid] = coords
elif pdctype == 'text': # draw text on top of map
- rotation = float(img['rotation'])
+ if img.has_key('rotation'):
+ rotation = float(img['rotation'])
+ else:
+ rotation = 0.0
w, h = self.GetFullTextExtent(img['text'])[0:2]
pdc.SetFont(img['font'])
pdc.SetTextForeground(img['color'])
@@ -442,7 +445,11 @@
@param textinfo text metadata (text, font, color, rotation)
@param coords reference point
"""
- rotation = float(textinfo['rotation'])
+ if textinfo.has_key('rotation'):
+ rotation = float(textinfo['rotation'])
+ else:
+ rotation = 0.0
+
coords = textinfo['coords']
Debug.msg (4, "BufferedWindow.TextBounds(): text=%s, rotation=%f" % \
@@ -673,11 +680,13 @@
#
# update layer dictionary if there has been a change in layers
- if self.tree.reorder == True:
+ if self.tree and self.tree.reorder == True:
self.tree.ReorderLayers()
# reset flag for auto-rendering
- self.tree.rerender = False
+ if self.tree:
+ self.tree.rerender = False
+
if render:
# update display size
self.Map.ChangeMapSize(self.GetClientSize())
@@ -2936,9 +2945,10 @@
def OnPointer(self, event):
"""Pointer button clicked"""
- if event:
- self.toolbars['map'].OnTool(event)
- self.toolbars['map'].action['desc'] = ''
+ if self.toolbars['map']:
+ if event:
+ self.toolbars['map'].OnTool(event)
+ self.toolbars['map'].action['desc'] = ''
self.MapWindow.mouse['use'] = "pointer"
self.MapWindow.mouse['box'] = "point"
@@ -2972,8 +2982,9 @@
Zoom in the map.
Set mouse cursor, zoombox attributes, and zoom direction
"""
- self.toolbars['map'].OnTool(event)
- self.toolbars['map'].action['desc'] = ''
+ if self.toolbars['map']:
+ self.toolbars['map'].OnTool(event)
+ self.toolbars['map'].action['desc'] = ''
self.MapWindow.mouse['use'] = "zoom"
self.MapWindow.mouse['box'] = "box"
@@ -2988,8 +2999,9 @@
Zoom out the map.
Set mouse cursor, zoombox attributes, and zoom direction
"""
- self.toolbars['map'].OnTool(event)
- self.toolbars['map'].action['desc'] = ''
+ if self.toolbars['map']:
+ self.toolbars['map'].OnTool(event)
+ self.toolbars['map'].action['desc'] = ''
self.MapWindow.mouse['use'] = "zoom"
self.MapWindow.mouse['box'] = "box"
@@ -3009,8 +3021,9 @@
"""
Panning, set mouse to drag
"""
- self.toolbars['map'].OnTool(event)
- self.toolbars['map'].action['desc'] = ''
+ if self.toolbars['map']:
+ self.toolbars['map'].OnTool(event)
+ self.toolbars['map'].action['desc'] = ''
self.MapWindow.mouse['use'] = "pan"
self.MapWindow.mouse['box'] = "pan"
@@ -3515,8 +3528,9 @@
def OnQuery(self, event):
"""Query tools menu"""
- self.toolbars['map'].OnTool(event)
- action = self.toolbars['map'].GetAction()
+ if self.toolbars['map']:
+ self.toolbars['map'].OnTool(event)
+ action = self.toolbars['map'].GetAction()
point = wx.GetMousePosition()
toolsmenu = wx.Menu()
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2008-11-09 11:26:58 UTC (rev 34201)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2008-11-09 11:57:30 UTC (rev 34202)
@@ -829,7 +829,8 @@
def OnCancel(self, event):
"""Cancel button pressed"""
self.MakeModal(False)
- if self.get_dcmd:
+ if self.get_dcmd and \
+ hasattr(self.parent, "GetPyData"):
# display decorations and
# pressing OK or cancel after setting layer properties
if self.task.name in ['d.barscale','d.legend','d.histogram'] \
More information about the grass-commit
mailing list