diff browser_side/base_widget.py @ 201:aa76793da353

server + browser: message warning level/sending refactoring: - widgets now manage themselves warning level - widgets now manage themselves text entered (if they are selectable, onTextEntered must be present) - Unibox now default to selected widget/status bar, except if a hook syntax is used (e.g. "@@: public microblog") - warning message is now GROUP (in blue with default theme) when sending a message to a MUC room (instead of green before) - "@.*: " syntaxes are now fully managed by browser, no more by server
author Goffi <goffi@goffi.org>
date Sun, 07 Apr 2013 22:33:55 +0200
parents ab239b3b67b3
children 3092f6b1710c
line wrap: on
line diff
--- a/browser_side/base_widget.py	Mon Mar 25 14:09:10 2013 +0100
+++ b/browser_side/base_widget.py	Sun Apr 07 22:33:55 2013 +0200
@@ -284,6 +284,22 @@
             self.addClickListener(self)
         self.__selectable = selectable
 
+    def getWarningData(self):
+        """ Return exposition warning level when this widget is selected and something is sent to it
+        This method should be overriden by children
+        @return: tuple (warning level type/HTML msg). Type can be one of:
+            - PUBLIC
+            - GROUP
+            - ONE2ONE
+            - MISC
+            - NONE
+        """
+        if not self.__selectable:
+            print "ERROR: getWarningLevel must not be called for an unselectable widget"
+            raise Exception
+        # TODO: cleaner warning types (more general constants)
+        return ("NONE", None)
+
     def setWidget(self, widget, scrollable=True):
         """Set the widget that will be in the body of the LiberviaWidget
         @param widget: widget to put in the body