[prev in list] [next in list] [prev in thread] [next in thread]
List: grass-commit
Subject: [GRASS-SVN] r69595 - in grass/branches/releasebranch_7_0/gui/wxpython: core vdigit
From: svn_grass () osgeo ! org
Date: 2016-09-28 2:56:28
Message-ID: 20160928025628.51F0C39041A () trac ! osgeo ! org
[Download RAW message or body]
Author: annakrat
Date: 2016-09-27 19:56:28 -0700 (Tue, 27 Sep 2016)
New Revision: 69595
Modified:
grass/branches/releasebranch_7_0/gui/wxpython/core/settings.py
grass/branches/releasebranch_7_0/gui/wxpython/vdigit/preferences.py
grass/branches/releasebranch_7_0/gui/wxpython/vdigit/wxdisplay.py
Log:
GUI/vdigit: fix snapping units, see #2848 (merge from trunk r69578, r69579, r69580)
Modified: grass/branches/releasebranch_7_0/gui/wxpython/core/settings.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/core/settings.py 2016-09-28 \
02:43:08 UTC (rev 69594)
+++ grass/branches/releasebranch_7_0/gui/wxpython/core/settings.py 2016-09-28 \
02:56:28 UTC (rev 69595) @@ -387,13 +387,14 @@
'units' : 'screen pixels'
},
# snapping
- 'snapping' : {
- 'value' : 10,
- 'units' : 'screen pixels'
- },
- 'snapToVertex' : {
- 'enabled' : True
- },
+ 'snapping': {
+ 'value': 10,
+ 'unit': 0, # new
+ 'units': 'screen pixels' # old for backwards comp.
+ },
+ 'snapToVertex': {
+ 'enabled': True
+ },
# digitize new record
'addRecord' : {
'enabled' : True
Modified: grass/branches/releasebranch_7_0/gui/wxpython/vdigit/preferences.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/vdigit/preferences.py 2016-09-28 \
02:43:08 UTC (rev 69594)
+++ grass/branches/releasebranch_7_0/gui/wxpython/vdigit/preferences.py 2016-09-28 \
02:56:28 UTC (rev 69595) @@ -163,9 +163,14 @@
min = -1, max = 1e6)
self.snappingValue.Bind(wx.EVT_SPINCTRL, self.OnChangeSnappingValue)
self.snappingValue.Bind(wx.EVT_TEXT, self.OnChangeSnappingValue)
- self.snappingUnit = wx.Choice(parent = panel, id = wx.ID_ANY, size = (125, \
-1),
- choices = [_("screen pixels"), _("map \
units")])
- self.snappingUnit.SetStringSelection(UserSettings.Get(group = 'vdigit', key \
= "snapping", subkey = 'units')) + self.snappingUnit = wx.Choice(parent=panel, \
id=wx.ID_ANY, size=( + 125, -1), choices=[_("screen pixels"), _("map \
units")]) + try:
+ self.snappingUnit.SetSelection(UserSettings.Get(group='vdigit',
+ key="snapping",
+ subkey='unit'))
+ except:
+ self.snappingUnit.SetSelection(0)
self.snappingUnit.Bind(wx.EVT_CHOICE, self.OnChangeSnappingUnits)
flexSizer.Add(text, proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL)
flexSizer.Add(self.snappingValue, proportion = 0, flag = wx.ALIGN_CENTER | \
wx.FIXED_MINSIZE) @@ -609,7 +614,7 @@
res = (region['nsres'] + region['ewres']) / 2.
threshold = self.digit.GetDisplay().GetThreshold(value = res)
else:
- if self.snappingUnit.GetStringSelection() == "map units":
+ if self.snappingUnit.GetSelection() == 1: # map units
threshold = value
else:
threshold = self.digit.GetDisplay().GetThreshold(value = value)
@@ -632,10 +637,10 @@
"""Snapping units change -> update static text
"""
value = self.snappingValue.GetValue()
- units = self.snappingUnit.GetStringSelection()
+ units = self.snappingUnit.GetSelection()
threshold = self.digit.GetDisplay().GetThreshold(value = value, units = \
units)
- if units == "map units":
+ if units == 1: # map units
self.snappingInfo.SetLabel(_("Snapping threshold is %(value).1f \
%(units)s") % {'value' : value,
'units' : self.mapUnits})
@@ -721,13 +726,13 @@
value = int(self.lineWidthValue.GetValue()))
# snapping
- UserSettings.Set(group = 'vdigit', key = "snapping", subkey = 'value',
- value = int(self.snappingValue.GetValue()))
- UserSettings.Set(group = 'vdigit', key = "snapping", subkey = 'units',
- value = self.snappingUnit.GetStringSelection())
- UserSettings.Set(group = 'vdigit', key = "snapToVertex", subkey = 'enabled',
- value = self.snapVertex.IsChecked())
-
+ UserSettings.Set(group='vdigit', key="snapping", subkey='value',
+ value=int(self.snappingValue.GetValue()))
+ UserSettings.Set(group='vdigit', key="snapping", subkey='unit',
+ value=self.snappingUnit.GetSelection())
+ UserSettings.Set(group='vdigit', key="snapToVertex", subkey='enabled',
+ value=self.snapVertex.IsChecked())
+
# digitize new feature
UserSettings.Set(group = 'vdigit', key = "addRecord", subkey = 'enabled',
value = self.addRecord.IsChecked())
Modified: grass/branches/releasebranch_7_0/gui/wxpython/vdigit/wxdisplay.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/vdigit/wxdisplay.py 2016-09-28 \
02:43:08 UTC (rev 69594)
+++ grass/branches/releasebranch_7_0/gui/wxpython/vdigit/wxdisplay.py 2016-09-28 \
02:56:28 UTC (rev 69595) @@ -1025,7 +1025,7 @@
:param type: snapping mode (node, vertex)
:param value: threshold to be set up
- :param units: units (map, screen)
+ :param units: units (0 for screen pixels, 1 for map units)
:return: threshold value
"""
@@ -1033,12 +1033,12 @@
value = UserSettings.Get(group = 'vdigit', key = type, subkey = 'value')
if units is None:
- units = UserSettings.Get(group = 'vdigit', key = type, subkey = 'units')
-
+ units = UserSettings.Get(group='vdigit', key=type, subkey='unit')
+
if value < 0:
value = (self.region['nsres'] + self.region['ewres']) / 2.0
- if units == "screen pixels":
+ if units == 0:
# pixel -> cell
res = max(self.region['nsres'], self.region['ewres'])
return value * res
_______________________________________________
grass-commit mailing list
grass-commit@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic