comparison frontends/primitivus/custom_widgets.py @ 2:07b7dcd314ff

primitivus: basic contact list, connexion now work \o/
author Goffi <goffi@goffi.org>
date Thu, 01 Jul 2010 18:52:51 +0800
parents a5c9603dac37
children 6290022ae74d
comparison
equal deleted inserted replaced
1:a5c9603dac37 2:07b7dcd314ff
111 for widget in self.content: 111 for widget in self.content:
112 if widget.getState(): 112 if widget.getState():
113 widget.setState(False, invisible) 113 widget.setState(False, invisible)
114 widget._invalidate() 114 widget._invalidate()
115 115
116 def deleteValue(self, value):
117 """Delete the first value equal to the param given"""
118 try:
119 self.content.remove(value)
120 except ValueError:
121 pass
122
116 def getValue(self): 123 def getValue(self):
117 """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"""
118 values = self.getValues() 125 values = self.getValues()
119 return values[0] if values else None 126 return values[0] if values else None
120 127
124 if widget.getState(): 131 if widget.getState():
125 result.append(widget.getValue()) 132 result.append(widget.getValue())
126 return result 133 return result
127 134
128 def changeValues(self, new_values): 135 def changeValues(self, new_values):
136 """Change all value in one shot"""
129 widgets = [SelectableText(option, self.align) for option in new_values] 137 widgets = [SelectableText(option, self.align) for option in new_values]
130 for widget in widgets: 138 for widget in widgets:
131 urwid.connect_signal(widget, 'change', self.__onStateChange) 139 urwid.connect_signal(widget, 'change', self.__onStateChange)
132 self.content[:] = widgets 140 self.content[:] = widgets
133 if self.single and new_values: 141 if self.single and new_values: