浏览代码

wxGUI/vdigit: use 'FloatSpin' widget, which allows you to set the decimal snapping threshold value (#1882)

* wxGUI/vdigit: use 'FloatSpin' widget, which allows you to set the decimal snapping threshold value

Allow setting decimal snapping treshold value (< 1.0) especially for LOCATION
with WGS84 coordinate system with degree map unit (1.0 degree is aproximatelly
111 km).

* Use 'FloatSpin' widget, which allows you to set the decimal query length value
Tomas Zigo 3 年之前
父节点
当前提交
ae6e9c4695
共有 1 个文件被更改,包括 16 次插入9 次删除
  1. 16 9
      gui/wxpython/vdigit/preferences.py

+ 16 - 9
gui/wxpython/vdigit/preferences.py

@@ -23,7 +23,7 @@ import wx.lib.colourselect as csel
 from gui_core.gselect import ColumnSelect
 from core.units import Units
 from core.settings import UserSettings
-from gui_core.wrap import Button, CheckBox, SpinCtrl, StaticBox, StaticText
+from gui_core.wrap import Button, CheckBox, FloatSpin, SpinCtrl, StaticBox, StaticText
 
 
 class VDigitSettingsDialog(wx.Dialog):
@@ -179,13 +179,14 @@ class VDigitSettingsDialog(wx.Dialog):
 
         # snapping
         text = StaticText(parent=panel, id=wx.ID_ANY, label=_("Snapping threshold"))
-        self.snappingValue = SpinCtrl(
+        self.snappingValue = FloatSpin(
             parent=panel,
             id=wx.ID_ANY,
             size=(75, -1),
-            initial=UserSettings.Get(group="vdigit", key="snapping", subkey="value"),
-            min=-1,
-            max=1e6,
+            value=UserSettings.Get(group="vdigit", key="snapping", subkey="value"),
+            min_val=-1,
+            max_val=1e6,
+            digits=7,
         )
         self.snappingValue.Bind(wx.EVT_SPINCTRL, self.OnChangeSnappingValue)
         self.snappingValue.Bind(wx.EVT_TEXT, self.OnChangeSnappingValue)
@@ -429,8 +430,14 @@ class VDigitSettingsDialog(wx.Dialog):
         self.queryLengthSL.SetSelection(
             UserSettings.Get(group="vdigit", key="queryLength", subkey="than-selection")
         )
-        self.queryLengthValue = SpinCtrl(
-            parent=panel, id=wx.ID_ANY, size=(100, -1), initial=1, min=0, max=1e6
+        self.queryLengthValue = FloatSpin(
+            parent=panel,
+            id=wx.ID_ANY,
+            size=(100, -1),
+            value=1,
+            min_val=0,
+            max_val=1e6,
+            digits=7,
         )
         self.queryLengthValue.SetValue(
             UserSettings.Get(group="vdigit", key="queryLength", subkey="thresh")
@@ -933,7 +940,7 @@ class VDigitSettingsDialog(wx.Dialog):
             group="vdigit",
             key="snapping",
             subkey="value",
-            value=int(self.snappingValue.GetValue()),
+            value=self.snappingValue.GetValue(),
         )
         UserSettings.Set(
             group="vdigit",
@@ -1032,7 +1039,7 @@ class VDigitSettingsDialog(wx.Dialog):
             group="vdigit",
             key="queryLength",
             subkey="thresh",
-            value=int(self.queryLengthValue.GetValue()),
+            value=self.queryLengthValue.GetValue(),
         )
         UserSettings.Set(
             group="vdigit",