[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9793 - gnuradio/trunk/grc/src/grc_gnuradio/wxgui
From: |
jblum |
Subject: |
[Commit-gnuradio] r9793 - gnuradio/trunk/grc/src/grc_gnuradio/wxgui |
Date: |
Mon, 13 Oct 2008 23:16:46 -0600 (MDT) |
Author: jblum
Date: 2008-10-13 23:16:46 -0600 (Mon, 13 Oct 2008)
New Revision: 9793
Modified:
gnuradio/trunk/grc/src/grc_gnuradio/wxgui/callback_controls.py
Log:
text box control: string mode
Modified: gnuradio/trunk/grc/src/grc_gnuradio/wxgui/callback_controls.py
===================================================================
--- gnuradio/trunk/grc/src/grc_gnuradio/wxgui/callback_controls.py
2008-10-14 04:44:02 UTC (rev 9792)
+++ gnuradio/trunk/grc/src/grc_gnuradio/wxgui/callback_controls.py
2008-10-14 05:16:46 UTC (rev 9793)
@@ -263,6 +263,8 @@
for obj in (label_text, text_box): #fill the container with
label and text entry box
label_text_sizer.Add(obj, 0,
wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
self.Add(label_text_sizer, 0, wx.ALIGN_CENTER)
+ #set the value, detect string mode
+ self._string_mode = isinstance(value, str)
self.text_box.SetValue(str(value))
def get_value(self):
@@ -276,8 +278,13 @@
"""
An enter key was pressed. Read the text box, call the callback.
If the text cannot be evaluated, do not try callback.
+ Do not evaluate the text box value in string mode.
"""
- try: self._value = eval(self.text_box.GetValue())
- except: return
+ if self._string_mode: self._value = self.text_box.GetValue()
+ else:
+ try: self._value = eval(self.text_box.GetValue())
+ except Exception, e:
+ print >> sys.stderr, 'Error in evaluate value
from handle enter.\n', e
+ return
try: self.call()
except Exception, e: print >> sys.stderr, 'Error in exec
callback from handle enter.\n', e
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9793 - gnuradio/trunk/grc/src/grc_gnuradio/wxgui,
jblum <=