comparison frontends/primitivus/custom_widgets.py @ 117:1f0fd6f03e2b

misc fixes
author Goffi <goffi@goffi.org>
date Sat, 03 Jul 2010 12:01:01 +0800
parents 7c482ecac0ff
children 76055a209ed9
comparison
equal deleted inserted replaced
116:7c482ecac0ff 117:1f0fd6f03e2b
116 def deleteValue(self, value): 116 def deleteValue(self, value):
117 """Delete the first value equal to the param given""" 117 """Delete the first value equal to the param given"""
118 try: 118 try:
119 self.content.remove(value) 119 self.content.remove(value)
120 except ValueError: 120 except ValueError:
121 pass 121 raise ValuError("%s ==> %s" % (str(value),str(self.content)))
122 122
123 def getValue(self): 123 def getValue(self):
124 """Convenience method to get the value selected as a string in single mode, or None""" 124 """Convenience method to get the value selected as a string in single mode, or None"""
125 values = self.getValues() 125 values = self.getValues()
126 return values[0] if values else None 126 return values[0] if values else None
138 for widget in widgets: 138 for widget in widgets:
139 urwid.connect_signal(widget, 'change', self.__onStateChange) 139 urwid.connect_signal(widget, 'change', self.__onStateChange)
140 self.content[:] = widgets 140 self.content[:] = widgets
141 if self.single and new_values: 141 if self.single and new_values:
142 self.content[0].setState(True) 142 self.content[0].setState(True)
143 display_widget = urwid.BoxAdapter(self.list_box, min(len(new_values),5)) 143 display_widget = urwid.BoxAdapter(self.list_box, min(len(new_values),5) or 1)
144 urwid.WidgetWrap.__init__(self, display_widget) 144 urwid.WidgetWrap.__init__(self, display_widget)
145 145
146 def selectValue(self, value): 146 def selectValue(self, value):
147 self.unselectAll() 147 self.unselectAll()
148 idx = 0 148 idx = 0