diff options
author | Josh Blum | 2009-09-09 13:05:38 -0700 |
---|---|---|
committer | Josh Blum | 2009-09-09 13:05:38 -0700 |
commit | 7d4915f78da95b5da4a3525c392667cfd4ed04be (patch) | |
tree | eed0b8ba87b19f4e623ae9d59baac38889b147b9 /gr-wxgui | |
parent | 4b3c5eced9a5b03a0077b6f7897a2157fca9a8dd (diff) | |
download | gnuradio-7d4915f78da95b5da4a3525c392667cfd4ed04be.tar.gz gnuradio-7d4915f78da95b5da4a3525c392667cfd4ed04be.tar.bz2 gnuradio-7d4915f78da95b5da4a3525c392667cfd4ed04be.zip |
Round the slider's value, but not the internal representation.
Now, the slider can operate on any step size without killing the precision for other forms.
Diffstat (limited to 'gr-wxgui')
-rw-r--r-- | gr-wxgui/src/python/forms/converters.py | 3 | ||||
-rw-r--r-- | gr-wxgui/src/python/forms/forms.py | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/gr-wxgui/src/python/forms/converters.py b/gr-wxgui/src/python/forms/converters.py index 9f757aa84..3cc13466a 100644 --- a/gr-wxgui/src/python/forms/converters.py +++ b/gr-wxgui/src/python/forms/converters.py @@ -134,8 +134,7 @@ class slider_converter(abstract_converter): self._scaler = float(maximum - minimum)/num_steps self._cast = cast def external_to_internal(self, v): - #slider's internal representation is an integer - return int(round((v - self._offset)/self._scaler)) + return (v - self._offset)/self._scaler def internal_to_external(self, v): return self._cast(v*self._scaler + self._offset) def help(self): diff --git a/gr-wxgui/src/python/forms/forms.py b/gr-wxgui/src/python/forms/forms.py index c69315b03..c0f181b4d 100644 --- a/gr-wxgui/src/python/forms/forms.py +++ b/gr-wxgui/src/python/forms/forms.py @@ -37,6 +37,9 @@ The forms follow a layered model: Known problems: * An empty label in the radio box still consumes space. * The static text cannot resize the parent at runtime. + * Text box should indicate its that its edited but not committed. + * Colorize? + * Tab out to commit? """ EXT_KEY = 'external' @@ -176,7 +179,7 @@ class _slider_base(_form_base): self._add_widget(self._slider, label, flag=wx.EXPAND) def _handle(self, event): self[INT_KEY] = self._slider.GetValue() - def _update(self, value): self._slider.SetValue(value) + def _update(self, value): self._slider.SetValue(int(round(value))) ######################################################################## # Static Text Form |