diff options
author | Josh Blum | 2009-09-09 13:57:38 -0700 |
---|---|---|
committer | Josh Blum | 2009-09-09 13:57:38 -0700 |
commit | 3b5fc17434361cb7698e9dd9b0f16e4fbdea7f78 (patch) | |
tree | fe4b80eac0fe3def62d5d3641b187acfc98f4cf4 /gr-wxgui/src/python/forms/forms.py | |
parent | 7d4915f78da95b5da4a3525c392667cfd4ed04be (diff) | |
download | gnuradio-3b5fc17434361cb7698e9dd9b0f16e4fbdea7f78.tar.gz gnuradio-3b5fc17434361cb7698e9dd9b0f16e4fbdea7f78.tar.bz2 gnuradio-3b5fc17434361cb7698e9dd9b0f16e4fbdea7f78.zip |
set text box bg color on change
Diffstat (limited to 'gr-wxgui/src/python/forms/forms.py')
-rw-r--r-- | gr-wxgui/src/python/forms/forms.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gr-wxgui/src/python/forms/forms.py b/gr-wxgui/src/python/forms/forms.py index c0f181b4d..8dc58367d 100644 --- a/gr-wxgui/src/python/forms/forms.py +++ b/gr-wxgui/src/python/forms/forms.py @@ -37,9 +37,6 @@ 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' @@ -227,11 +224,18 @@ class text_box(_form_base): def __init__(self, label='', width=-1, converter=converters.eval_converter(), **kwargs): _form_base.__init__(self, converter=converter, **kwargs) self._text_box = wx.TextCtrl(self._parent, size=wx.Size(width, -1), style=wx.TE_PROCESS_ENTER) + self._default_bg_colour = self._text_box.GetBackgroundColour() self._text_box.Bind(wx.EVT_TEXT_ENTER, self._handle) + self._text_box.Bind(wx.EVT_TEXT, self._update_color) self._add_widget(self._text_box, label) + def _update_color(self, *args): + if self._text_box.GetValue() == self[INT_KEY]: + self._text_box.SetBackgroundColour(self._default_bg_colour) + else: self._text_box.SetBackgroundColour('#EEDDDD') + def _handle(self, event): self[INT_KEY] = self._text_box.GetValue() - def _update(self, value): self._text_box.SetValue(value) + def _update(self, value): self._text_box.SetValue(value); self._update_color() ######################################################################## # Slider Form |