changeset 564:fed185c95f1c

browser_side: add XMLUI "int" widget type + historyPrint uses the new param "Chat history limit"
author souliane <souliane@mailoo.org>
date Fri, 03 Oct 2014 12:33:03 +0200
parents d888bb2a23a9
children 0090285a5689
files src/browser/sat_browser/panels.py src/browser/sat_browser/xmlui.py
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/panels.py	Fri Oct 03 19:38:10 2014 +0200
+++ b/src/browser/sat_browser/panels.py	Fri Oct 03 12:33:03 2014 +0200
@@ -1252,7 +1252,7 @@
         self.occupants_list.addOccupant(new_nick)
         self.printInfo(_("%(old_nick)s is now known as %(new_nick)s") % {'old_nick': old_nick, 'new_nick': new_nick})
 
-    def historyPrint(self, size=20):
+    def historyPrint(self, size=C.HISTORY_LIMIT_DEFAULT):
         """Print the initial history"""
         def getHistoryCB(history):
             # display day change
--- a/src/browser/sat_browser/xmlui.py	Fri Oct 03 19:38:10 2014 +0200
+++ b/src/browser/sat_browser/xmlui.py	Fri Oct 03 12:33:03 2014 +0200
@@ -150,6 +150,23 @@
         self.addClickListener(callback)
 
 
+class IntWidget(xmlui.IntWidget, TextBox):
+
+    def __init__(self, _xmlui_parent, value, read_only=False):
+        TextBox.__init__(self)
+        self.setText(value)
+        self.setReadonly(read_only)
+
+    def _xmluiSetValue(self, value):
+        self.setText(value)
+
+    def _xmluiGetValue(self):
+        return self.getText()
+
+    def _xmluiOnChange(self, callback):
+        self.addChangeListener(callback)
+
+
 class ButtonWidget(xmlui.ButtonWidget, Button):
 
     def __init__(self, _xmlui_parent, value, click_callback):