[GRASS-SVN] r57235 - in grass/trunk/gui/wxpython: gcp mapdisp
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jul 20 12:29:58 PDT 2013
Author: wenzeslaus
Date: 2013-07-20 12:29:57 -0700 (Sat, 20 Jul 2013)
New Revision: 57235
Added:
grass/trunk/gui/wxpython/gcp/statusbar.py
Modified:
grass/trunk/gui/wxpython/gcp/mapdisplay.py
grass/trunk/gui/wxpython/mapdisp/statusbar.py
Log:
wxGUI/gcp: moving gcp statusbar items to gcp directory
Modified: grass/trunk/gui/wxpython/gcp/mapdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/mapdisplay.py 2013-07-20 18:41:49 UTC (rev 57234)
+++ grass/trunk/gui/wxpython/gcp/mapdisplay.py 2013-07-20 19:29:57 UTC (rev 57235)
@@ -34,6 +34,7 @@
from mapdisp.mapwindow import BufferedWindow
import mapdisp.statusbar as sb
+import gcp.statusbar as sbgcp
# for standalone app
cmdfilename = None
@@ -88,8 +89,8 @@
sb.SbDisplayGeometry,
sb.SbMapScale,
sb.SbProjection,
- sb.SbGoToGCP,
- sb.SbRMSError]
+ sbgcp.SbGoToGCP,
+ sbgcp.SbRMSError]
# create statusbar and its manager
Added: grass/trunk/gui/wxpython/gcp/statusbar.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/statusbar.py (rev 0)
+++ grass/trunk/gui/wxpython/gcp/statusbar.py 2013-07-20 19:29:57 UTC (rev 57235)
@@ -0,0 +1,125 @@
+"""!
+ at package gcp.statusbar
+
+ at brief Classes for statusbar management in GCP Manager
+
+Classes:
+ - statusbar::SbRMSError
+ - statusbar::SbGoToGCP
+
+(C) 2012-2013 by the GRASS Development Team
+
+This program is free software under the GNU General Public License
+(>=v2). Read the file COPYING that comes with GRASS for details.
+
+ at author Vaclav Petras <wenzeslaus gmail.com> (statusbar refactoring)
+ at author Anna Kratochvilova <kratochanna gmail.com> (statusbar refactoring)
+"""
+
+
+import wx
+
+from core.gcmd import GMessage
+from core.utils import _
+from mapdisp.statusbar import SbItem, SbTextItem
+
+
+class SbGoToGCP(SbItem):
+ """!SpinCtrl to select GCP to focus on
+
+ Requires MapFrame.GetSrcWindow, MapFrame.GetTgtWindow,
+ MapFrame.GetListCtrl, MapFrame.GetMapCoordList.
+ """
+ def __init__(self, mapframe, statusbar, position=0):
+ SbItem.__init__(self, mapframe, statusbar, position)
+ self.name = 'gotoGCP'
+ self.label = _("Go to GCP No.")
+
+ self.widget = wx.SpinCtrl(parent=self.statusbar, id=wx.ID_ANY,
+ value="", min=0)
+ self.widget.Hide()
+
+ self.widget.Bind(wx.EVT_TEXT_ENTER, self.OnGoToGCP)
+ self.widget.Bind(wx.EVT_SPINCTRL, self.OnGoToGCP)
+
+ def OnGoToGCP(self, event):
+ """!Zooms to given GCP."""
+ gcpNumber = self.GetValue()
+ mapCoords = self.mapFrame.GetMapCoordList()
+
+ # always false, spin checks it
+ if gcpNumber < 0 or gcpNumber > len(mapCoords):
+ GMessage(parent=self,
+ message="%s 1 - %s." % (_("Valid Range:"),
+ len(mapCoords)))
+ return
+
+ if gcpNumber == 0:
+ return
+
+ listCtrl = self.mapFrame.GetListCtrl()
+
+ listCtrl.selectedkey = gcpNumber
+ listCtrl.selected = listCtrl.FindItemData(-1, gcpNumber)
+ listCtrl.render = False
+ listCtrl.SetItemState(listCtrl.selected,
+ wx.LIST_STATE_SELECTED,
+ wx.LIST_STATE_SELECTED)
+ listCtrl.render = True
+
+ listCtrl.EnsureVisible(listCtrl.selected)
+
+ srcWin = self.mapFrame.GetSrcWindow()
+ tgtWin = self.mapFrame.GetTgtWindow()
+
+ # Source MapWindow:
+ begin = (mapCoords[gcpNumber][1], mapCoords[gcpNumber][2])
+ begin = srcWin.Cell2Pixel(begin)
+ end = begin
+ srcWin.Zoom(begin, end, 0)
+
+ # redraw map
+ srcWin.UpdateMap()
+
+ if self.mapFrame.GetShowTarget():
+ # Target MapWindow:
+ begin = (mapCoords[gcpNumber][3], mapCoords[gcpNumber][4])
+ begin = tgtWin.Cell2Pixel(begin)
+ end = begin
+ tgtWin.Zoom(begin, end, 0)
+
+ # redraw map
+ tgtWin.UpdateMap()
+
+ self.GetWidget().SetFocus()
+
+ def Update(self):
+ """Checks the number of items in the gcp list
+ and sets the spin limits accordingly."""
+ self.statusbar.SetStatusText("")
+ maximum = self.mapFrame.GetListCtrl().GetItemCount()
+ if maximum < 1:
+ maximum = 1
+ self.widget.SetRange(0, maximum)
+ self.Show()
+
+ # disable long help
+ self.mapFrame.StatusbarEnableLongHelp(False)
+
+
+class SbRMSError(SbTextItem):
+ """!Shows RMS error.
+
+ Requires MapFrame.GetFwdError, MapFrame.GetBkwError.
+ """
+ def __init__(self, mapframe, statusbar, position=0):
+ SbTextItem.__init__(self, mapframe, statusbar, position)
+ self.name = 'RMSError'
+ self.label = _("RMS error")
+
+ def Show(self):
+ """Shows the RMS errors."""
+ self.SetValue(_("Forward: %(forw)s, Backward: %(back)s") %
+ {'forw': self.mapFrame.GetFwdError(),
+ 'back': self.mapFrame.GetBkwError()})
+ SbTextItem.Show(self)
Modified: grass/trunk/gui/wxpython/mapdisp/statusbar.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/statusbar.py 2013-07-20 18:41:49 UTC (rev 57234)
+++ grass/trunk/gui/wxpython/mapdisp/statusbar.py 2013-07-20 19:29:57 UTC (rev 57235)
@@ -21,8 +21,6 @@
- statusbar::SbRegionExtent
- statusbar::SbCompRegionExtent
- statusbar::SbProgress
- - statusbar::SbRMSError
- - statusbar::SbGoToGCP
(C) 2006-2011 by the GRASS Development Team
@@ -1056,100 +1054,3 @@
def Update(self):
pass
-
-class SbGoToGCP(SbItem):
- """!SpinCtrl to select GCP to focus on
-
- Requires MapFrame.GetSrcWindow, MapFrame.GetTgtWindow, MapFrame.GetListCtrl,
- MapFrame.GetMapCoordList.
- """
-
- def __init__(self, mapframe, statusbar, position = 0):
- SbItem.__init__(self, mapframe, statusbar, position)
- self.name = 'gotoGCP'
- self.label = _("Go to GCP No.")
-
- self.widget = wx.SpinCtrl(parent = self.statusbar, id = wx.ID_ANY,
- value = "", min = 0)
- self.widget.Hide()
-
- self.widget.Bind(wx.EVT_TEXT_ENTER, self.OnGoToGCP)
- self.widget.Bind(wx.EVT_SPINCTRL, self.OnGoToGCP)
-
- def OnGoToGCP(self, event):
- """!Zooms to given GCP."""
- GCPNo = self.GetValue()
- mapCoords = self.mapFrame.GetMapCoordList()
-
- if GCPNo < 0 or GCPNo > len(mapCoords): # always false, spin checks it
- GMessage(parent=self,
- message="%s 1 - %s." % (_("Valid Range:"),
- len(mapCoords)))
- return
-
- if GCPNo == 0:
- return
-
- listCtrl = self.mapFrame.GetListCtrl()
-
- listCtrl.selectedkey = GCPNo
- listCtrl.selected = listCtrl.FindItemData(-1, GCPNo)
- listCtrl.render = False
- listCtrl.SetItemState(listCtrl.selected,
- wx.LIST_STATE_SELECTED,
- wx.LIST_STATE_SELECTED)
- listCtrl.render = True
-
- listCtrl.EnsureVisible(listCtrl.selected)
-
- srcWin = self.mapFrame.GetSrcWindow()
- tgtWin = self.mapFrame.GetTgtWindow()
-
- # Source MapWindow:
- begin = (mapCoords[GCPNo][1], mapCoords[GCPNo][2])
- begin = srcWin.Cell2Pixel(begin)
- end = begin
- srcWin.Zoom(begin, end, 0)
-
- # redraw map
- srcWin.UpdateMap()
-
- if self.mapFrame.GetShowTarget():
- # Target MapWindow:
- begin = (mapCoords[GCPNo][3], mapCoords[GCPNo][4])
- begin = tgtWin.Cell2Pixel(begin)
- end = begin
- tgtWin.Zoom(begin, end, 0)
-
- # redraw map
- tgtWin.UpdateMap()
-
- self.GetWidget().SetFocus()
-
- def Update(self):
- self.statusbar.SetStatusText("")
- max = self.mapFrame.GetListCtrl().GetItemCount()
- if max < 1:
- max = 1
- self.widget.SetRange(0, max)
- self.Show()
-
- # disable long help
- self.mapFrame.StatusbarEnableLongHelp(False)
-
-class SbRMSError(SbTextItem):
- """!Shows RMS error.
-
- Requires MapFrame.GetFwdError, MapFrame.GetBkwError.
- """
- def __init__(self, mapframe, statusbar, position = 0):
- SbTextItem.__init__(self, mapframe, statusbar, position)
- self.name = 'RMSError'
- self.label = _("RMS error")
-
- def Show(self):
- self.SetValue(_("Forward: %(forw)s, Backward: %(back)s") %
- { 'forw' : self.mapFrame.GetFwdError(),
- 'back' : self.mapFrame.GetBkwError() })
- SbTextItem.Show(self)
-
More information about the grass-commit
mailing list