diff browser_side/menu.py @ 158:58442ed28f2b

browser side: basic disconnection management: hard reload is done on empty signal response
author Goffi <goffi@goffi.org>
date Sat, 05 Jan 2013 16:08:25 +0100
parents 7e87c87b7952
children 6ebf7f872a38
line wrap: on
line diff
--- a/browser_side/menu.py	Sat Jan 05 16:07:33 2013 +0100
+++ b/browser_side/menu.py	Sat Jan 05 16:08:25 2013 +0100
@@ -127,8 +127,7 @@
         _item_tpl = "<img src='media/icons/menu/%s_menu_red.png' />%s"
 
         menu_general = MenuBar(vertical=True)
-        menu_general.addItem("Social contract", MenuCmd(self, "onSocialContract"))
-        menu_general.addItem("About", MenuCmd(self, "onAbout"))
+        menu_general.addItem("Disconnect", MenuCmd(self, "onDisconnect"))
 
         menu_contacts = MenuBar(vertical=True)
         menu_contacts.addItem("add contact", MenuCmd(self, "onAddContact"))
@@ -170,6 +169,14 @@
         self.add(menubar)
 
     #General menu
+    def onDisconnect(self):
+        def confirm_cb(answer):
+            if answer:
+                print "déconnexion"
+                self.host.bridge.call('disconnect', None)
+        _dialog = dialog.ConfirmDialog(confirm_cb, text="Do you really want to disconnect ?")
+        _dialog.show()
+
     def onSocialContract(self):
         _frame = Frame('contrat_social.html')
         _frame.setStyleName('infoFrame')