Mercurial > libervia-web
comparison src/browser/sat_browser/dialog.py @ 662:ebb602d8b3f2 frontends_multi_profiles
browser_side: replace all instances of 'str' with 'unicode'
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 03 Mar 2015 06:51:13 +0100 |
parents | 6d3142b782c3 |
children | a8fddccf5b84 |
comparison
equal
deleted
inserted
replaced
661:2664fe93ceb3 | 662:ebb602d8b3f2 |
---|---|
561 self.add(_label) | 561 self.add(_label) |
562 self.setCellWidth(_label, "100%") | 562 self.setCellWidth(_label, "100%") |
563 minus_button = Button("-", self.onMinus) | 563 minus_button = Button("-", self.onMinus) |
564 self.box = WheelTextBox() | 564 self.box = WheelTextBox() |
565 self.box.setVisibleLength(visible_len) | 565 self.box.setVisibleLength(visible_len) |
566 self.box.setText(str(value)) | 566 self.box.setText(unicode(value)) |
567 self.box.addInputListener(self) | 567 self.box.addInputListener(self) |
568 self.box.addMouseWheelListener(self) | 568 self.box.addMouseWheelListener(self) |
569 plus_button = Button("+", self.onPlus) | 569 plus_button = Button("+", self.onPlus) |
570 self.add(minus_button) | 570 self.add(minus_button) |
571 self.add(self.box) | 571 self.add(self.box) |
584 listener(self.value) | 584 listener(self.value) |
585 | 585 |
586 def setValue(self, value): | 586 def setValue(self, value): |
587 """Change the value and fire valueChange listeners""" | 587 """Change the value and fire valueChange listeners""" |
588 self.value = value | 588 self.value = value |
589 self.box.setText(str(value)) | 589 self.box.setText(unicode(value)) |
590 self._callListeners() | 590 self._callListeners() |
591 | 591 |
592 def onMinus(self, sender, step=1): | 592 def onMinus(self, sender, step=1): |
593 self.value = max(0, self.value - step) | 593 self.value = max(0, self.value - step) |
594 self.box.setText(str(self.value)) | 594 self.box.setText(unicode(self.value)) |
595 self._callListeners() | 595 self._callListeners() |
596 | 596 |
597 def onPlus(self, sender, step=1): | 597 def onPlus(self, sender, step=1): |
598 self.value += step | 598 self.value += step |
599 if self.value_max: | 599 if self.value_max: |
600 self.value = min(self.value, self.value_max) | 600 self.value = min(self.value, self.value_max) |
601 self.box.setText(str(self.value)) | 601 self.box.setText(unicode(self.value)) |
602 self._callListeners() | 602 self._callListeners() |
603 | 603 |
604 def onInput(self, sender): | 604 def onInput(self, sender): |
605 """Accept only valid integer && normalize print (no leading 0)""" | 605 """Accept only valid integer && normalize print (no leading 0)""" |
606 try: | 606 try: |
607 self.value = int(self.box.getText()) if self.box.getText() else 0 | 607 self.value = int(self.box.getText()) if self.box.getText() else 0 |
608 except ValueError: | 608 except ValueError: |
609 pass | 609 pass |
610 if self.value_max: | 610 if self.value_max: |
611 self.value = min(self.value, self.value_max) | 611 self.value = min(self.value, self.value_max) |
612 self.box.setText(str(self.value)) | 612 self.box.setText(unicode(self.value)) |
613 self._callListeners() | 613 self._callListeners() |
614 | 614 |
615 def onMouseWheel(self, sender, velocity): | 615 def onMouseWheel(self, sender, velocity): |
616 if velocity > 0: | 616 if velocity > 0: |
617 self.onMinus(sender, 10) | 617 self.onMinus(sender, 10) |