comparison browser_side/panels.py @ 43:a7ff1e6f1229

browser_side: prevent default for escape key (cancel HTTPRequest in FF)
author Goffi <goffi@goffi.org>
date Wed, 25 May 2011 14:21:48 +0200
parents 305e81c7a32c
children 153de5d461a4
comparison
equal deleted inserted replaced
42:71a9cc9b9d57 43:a7ff1e6f1229
26 from pyjamas.ui.VerticalPanel import VerticalPanel 26 from pyjamas.ui.VerticalPanel import VerticalPanel
27 from pyjamas.ui.HorizontalPanel import HorizontalPanel 27 from pyjamas.ui.HorizontalPanel import HorizontalPanel
28 from pyjamas.ui.ScrollPanel import ScrollPanel 28 from pyjamas.ui.ScrollPanel import ScrollPanel
29 from pyjamas.ui.TabPanel import TabPanel 29 from pyjamas.ui.TabPanel import TabPanel
30 from pyjamas.ui.HTMLPanel import HTMLPanel 30 from pyjamas.ui.HTMLPanel import HTMLPanel
31 from pyjamas.ui.PopupPanel import PopupPanel
32 from pyjamas.ui.Grid import Grid 31 from pyjamas.ui.Grid import Grid
33 from pyjamas.ui.AutoComplete import AutoCompleteTextBox 32 from pyjamas.ui.AutoComplete import AutoCompleteTextBox
34 from pyjamas.ui.MenuBar import MenuBar 33 from pyjamas.ui.MenuBar import MenuBar
35 from pyjamas.ui.MenuItem import MenuItem 34 from pyjamas.ui.MenuItem import MenuItem
36 from pyjamas.ui.Label import Label 35 from pyjamas.ui.Label import Label
49 from card_game import CardPanel 48 from card_game import CardPanel
50 from jid import JID 49 from jid import JID
51 from tools import html_sanitize 50 from tools import html_sanitize
52 from datetime import datetime 51 from datetime import datetime
53 from time import time 52 from time import time
54 from dialog import ContactsChooser 53 from dialog import ContactsChooser, PopupPanelWrapper
55 54
56 class MenuCmd: 55 class MenuCmd:
57 56
58 def __init__(self, object, handler): 57 def __init__(self, object, handler):
59 self._object = object 58 self._object = object
244 else: 243 else:
245 print "WARNING: undetermined target for this message" 244 print "WARNING: undetermined target for this message"
246 return 245 return
247 contents = HTML(msg) 246 contents = HTML(msg)
248 247
249 self._popup = PopupPanel(autoHide=False, modal=False) 248 self._popup = PopupPanelWrapper(autoHide=False, modal=False)
250 self._popup.target_data = target_data 249 self._popup.target_data = target_data
251 self._popup.add(contents) 250 self._popup.add(contents)
252 self._popup.setStyleName("warningPopup") 251 self._popup.setStyleName("warningPopup")
253 if style: 252 if style:
254 self._popup.addStyleName(style) 253 self._popup.addStyleName(style)
632 631
633 def __init__(self, host): 632 def __init__(self, host):
634 self.host=host 633 self.host=host
635 AbsolutePanel.__init__(self) 634 AbsolutePanel.__init__(self)
636 635
637 #self.setHorizontalAlignment(HasAlignment.ALIGN_LEFT)
638 #self.setVerticalAlignment(HasAlignment.ALIGN_TOP)
639
640 menu = Menu(host) 636 menu = Menu(host)
641 unibox_panel = UniBoxPanel(host) 637 unibox_panel = UniBoxPanel(host)
642 self.host.setUniBox(unibox_panel.unibox) 638 self.host.setUniBox(unibox_panel.unibox)
643 status = host.status_panel 639 status = host.status_panel
644 self.tab_panel = MainTabPanel(host) 640 self.tab_panel = MainTabPanel(host)
650 self.add(unibox_panel) 646 self.add(unibox_panel)
651 self.add(status) 647 self.add(status)
652 self.add(self.tab_panel) 648 self.add(self.tab_panel)
653 649
654 self.setWidth("100%") 650 self.setWidth("100%")
655 #self.setHeight("99%")
656 Window.addWindowResizeListener(self) 651 Window.addWindowResizeListener(self)
657 652
658 def onWindowResized(self, width, height): 653 def onWindowResized(self, width, height):
659 print "resizing: %s %s" % (width, height)
660 #self.setWidth("%s%s" % (width, "px"));
661 _elts = doc().getElementsByClassName('gwt-TabBar') 654 _elts = doc().getElementsByClassName('gwt-TabBar')
662 if not _elts.length: 655 if not _elts.length:
663 tab_bar_h = 0 656 tab_bar_h = 0
664 else: 657 else:
665 tab_bar_h = _elts.item(0).offsetHeight 658 tab_bar_h = _elts.item(0).offsetHeight