comparison browser_side/menu.py @ 181:c0b78a3af06d

browser side: web widget first draft
author Goffi <goffi@goffi.org>
date Sun, 24 Feb 2013 18:15:38 +0100
parents 9763dec220ed
children a50ce9c06e0e
comparison
equal deleted inserted replaced
180:ea6ae7c4b3f0 181:c0b78a3af06d
36 from pyjamas.ui.Frame import Frame 36 from pyjamas.ui.Frame import Frame
37 from pyjamas import Window 37 from pyjamas import Window
38 from jid import JID 38 from jid import JID
39 from tools import html_sanitize 39 from tools import html_sanitize
40 from xmlui import XMLUI 40 from xmlui import XMLUI
41 import panels
41 import dialog 42 import dialog
42 import re 43 import re
43 44
44 class MenuCmd: 45 class MenuCmd:
45 46
125 SimplePanel.__init__(self) 126 SimplePanel.__init__(self)
126 self.setStyleName('menuContainer') 127 self.setStyleName('menuContainer')
127 _item_tpl = "<img src='media/icons/menu/%s_menu_red.png' />%s" 128 _item_tpl = "<img src='media/icons/menu/%s_menu_red.png' />%s"
128 129
129 menu_general = MenuBar(vertical=True) 130 menu_general = MenuBar(vertical=True)
131 menu_general.addItem("Web widget", MenuCmd(self, "onWebWidget"))
130 menu_general.addItem("Disconnect", MenuCmd(self, "onDisconnect")) 132 menu_general.addItem("Disconnect", MenuCmd(self, "onDisconnect"))
131 133
132 menu_contacts = MenuBar(vertical=True) 134 menu_contacts = MenuBar(vertical=True)
133 menu_contacts.addItem("add contact", MenuCmd(self, "onAddContact")) 135 menu_contacts.addItem("add contact", MenuCmd(self, "onAddContact"))
134 menu_contacts.addItem("update contact", MenuCmd(self, "onUpdateContact")) 136 menu_contacts.addItem("update contact", MenuCmd(self, "onUpdateContact"))
167 menubar.addItem(MenuItem(_item_tpl % (_icon, _name), True, _menu)) 169 menubar.addItem(MenuItem(_item_tpl % (_icon, _name), True, _menu))
168 170
169 self.add(menubar) 171 self.add(menubar)
170 172
171 #General menu 173 #General menu
174 def onWebWidget(self):
175 web_panel = panels.WebPanel(self.host, "http://www.goffi.org")
176 self.host.addTab(web_panel, "Web widget")
177
178
172 def onDisconnect(self): 179 def onDisconnect(self):
173 def confirm_cb(answer): 180 def confirm_cb(answer):
174 if answer: 181 if answer:
175 print "déconnexion" 182 print "déconnexion"
176 self.host.bridge.call('disconnect', None) 183 self.host.bridge.call('disconnect', None)