comparison 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
comparison
equal deleted inserted replaced
157:b17ec3a6a112 158:58442ed28f2b
125 SimplePanel.__init__(self) 125 SimplePanel.__init__(self)
126 self.setStyleName('menuContainer') 126 self.setStyleName('menuContainer')
127 _item_tpl = "<img src='media/icons/menu/%s_menu_red.png' />%s" 127 _item_tpl = "<img src='media/icons/menu/%s_menu_red.png' />%s"
128 128
129 menu_general = MenuBar(vertical=True) 129 menu_general = MenuBar(vertical=True)
130 menu_general.addItem("Social contract", MenuCmd(self, "onSocialContract")) 130 menu_general.addItem("Disconnect", MenuCmd(self, "onDisconnect"))
131 menu_general.addItem("About", MenuCmd(self, "onAbout"))
132 131
133 menu_contacts = MenuBar(vertical=True) 132 menu_contacts = MenuBar(vertical=True)
134 menu_contacts.addItem("add contact", MenuCmd(self, "onAddContact")) 133 menu_contacts.addItem("add contact", MenuCmd(self, "onAddContact"))
135 menu_contacts.addItem("update contact", MenuCmd(self, "onUpdateContact")) 134 menu_contacts.addItem("update contact", MenuCmd(self, "onUpdateContact"))
136 menu_contacts.addItem("remove contact", MenuCmd(self, "onRemoveContact")) 135 menu_contacts.addItem("remove contact", MenuCmd(self, "onRemoveContact"))
168 menubar.addItem(MenuItem(_item_tpl % (_icon, _name), True, _menu)) 167 menubar.addItem(MenuItem(_item_tpl % (_icon, _name), True, _menu))
169 168
170 self.add(menubar) 169 self.add(menubar)
171 170
172 #General menu 171 #General menu
172 def onDisconnect(self):
173 def confirm_cb(answer):
174 if answer:
175 print "déconnexion"
176 self.host.bridge.call('disconnect', None)
177 _dialog = dialog.ConfirmDialog(confirm_cb, text="Do you really want to disconnect ?")
178 _dialog.show()
179
173 def onSocialContract(self): 180 def onSocialContract(self):
174 _frame = Frame('contrat_social.html') 181 _frame = Frame('contrat_social.html')
175 _frame.setStyleName('infoFrame') 182 _frame.setStyleName('infoFrame')
176 _dialog = dialog.GenericDialog("Contrat Social", _frame) 183 _dialog = dialog.GenericDialog("Contrat Social", _frame)
177 _dialog.setSize('80%', '80%') 184 _dialog.setSize('80%', '80%')