Improve widget search clearing

This commit is contained in:
Cédric Krier committed 2008-06-28 20:37:00 +02:00
1 parent 698a92b7c3
commit 6395cbded3
4 files changed
+29 -14

No files matched your search

@@ -27,7 +27,13 @@ class CheckBox(Interface):
return []
def _value_set(self, value):
pass
if value == '':
self.widget.child.set_text('')
return
if value:
self.widget.child.set_text(_('Yes'))
else:
self.widget.child.set_text(_('No'))
value = property(_value_get, _value_set, None,
_('The content of the widget or ValueError if not valid'))
@@ -24,16 +24,19 @@ class Float(Integer):
return self._get_clause(value1, value2)
def _value_set(self, value):
self.entry1.set_text(locale.format('%.' + str(self.digits[1]) + 'f',
value or 0.0, True))
self.entry2.set_text(locale.format('%.' + str(self.digits[1]) + 'f',
value or 0.0, True))
if value == False:
text = ''
else:
text = locale.format('%.' + str(self.digits[1]) + 'f',
value or 0.0, True)
self.entry1.set_text(text)
self.entry2.set_text(text)
value = property(_value_get, _value_set, None,
_('The content of the widget or ValueError if not valid'))
def clear(self):
self.value = 0.0
self.value = False
def sig_insert_text(self, widget, new_text, new_text_length, position):
value = widget.get_text()
@@ -55,14 +55,18 @@ class Integer(Interface):
return res
def _value_set(self, value):
self.entry1.set_text(locale.format('%d', value or 0, True))
self.entry2.set_text(locale.format('%d', value or 0, True))
if value == False:
text = ''
else:
text = locale.format('%d', value or 0, True)
self.entry1.set_text(text)
self.entry2.set_text(text)
value = property(_value_get, _value_set, None,
_('The content of the widget or ValueError if not valid'))
def clear(self):
self.value = 0
self.value = False
def sig_activate(self, fct):
self.entry1.connect_after('activate', fct)
@@ -62,13 +62,15 @@ class Selection(Interface):
def _value_set(self, value):
if value == False:
value = ''
for sel in self._selection:
if self._selection[sel] == value:
self.widget.child.set_text(sel)
self.widget.child.set_text('')
return
for long_text, sel_value in self._selection.items():
if sel_value == value:
self.widget.child.set_text(long_text)
break
def clear(self):
self.value = ''
self.value = False
value = property(_value_get, _value_set, None,
'The content of the widget or ValueError if not valid')