Mercurial > libervia-web
comparison browser_side/dialog.py @ 92:dd54bc13ac81
browser side: widgets' width and height can now be fixed + tarot game position fix
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 28 Jun 2011 03:43:48 +0200 |
parents | 9729ed7171a6 |
children | 907a72e79b3e |
comparison
equal
deleted
inserted
replaced
91:5f845345176e | 92:dd54bc13ac81 |
---|---|
283 self.valueChangedListener.remove(listener) | 283 self.valueChangedListener.remove(listener) |
284 | 284 |
285 def _callListeners(self): | 285 def _callListeners(self): |
286 for listener in self.valueChangedListener: | 286 for listener in self.valueChangedListener: |
287 listener(self.value) | 287 listener(self.value) |
288 | |
289 def setValue(self, value): | |
290 """Change the value and fire valueChange listeners""" | |
291 self.value = value | |
292 self._callListeners() | |
288 | 293 |
289 def onMinus(self, sender): | 294 def onMinus(self, sender): |
290 self.value=max(0,self.value-1) | 295 self.value=max(0,self.value-1) |
291 self.box.setText(str(self.value)) | 296 self.box.setText(str(self.value)) |
292 self._callListeners() | 297 self._callListeners() |
299 self._callListeners() | 304 self._callListeners() |
300 | 305 |
301 def onInput(self, sender): | 306 def onInput(self, sender): |
302 """Accept only valid integer && normalize print (no leading 0)""" | 307 """Accept only valid integer && normalize print (no leading 0)""" |
303 try: | 308 try: |
304 self.value = int(self.box.getText()) | 309 self.value = int(self.box.getText()) if self.bot.getText() else 0 |
305 except ValueError: | 310 except ValueError: |
306 pass | 311 pass |
307 if self.value_max: | 312 if self.value_max: |
308 self.value = min(self.value,value_max) | 313 self.value = min(self.value,value_max) |
309 self.box.setText(str(self.value)) | 314 self.box.setText(str(self.value)) |