diff browser_side/base_widget.py @ 309:05e264e96a1c

browser_side: make unibox optional
author souliane <souliane@mailoo.org>
date Sun, 29 Dec 2013 23:07:28 +0100
parents a6b3715f0bd6
children a0ded7df30f7
line wrap: on
line diff
--- a/browser_side/base_widget.py	Fri Dec 27 13:59:06 2013 +0100
+++ b/browser_side/base_widget.py	Sun Dec 29 23:07:28 2013 +0100
@@ -184,7 +184,13 @@
         self.addStyleName('widget')
         if self.__selectable:
             self.addClickListener(self)
-            self.addCloseListener(self.host.uni_box.onWidgetClosed)
+
+            def onClose(sender):
+                """Check dynamically if the unibox is enable or not"""
+                if self.host.uni_box:
+                    self.host.uni_box.onWidgetClosed(sender)
+
+            self.addCloseListener(onClose)
         self.host.registerWidget(self)
 
     def getDebugName(self):