comparison browser_side/panels.py @ 181:c0b78a3af06d

browser side: web widget first draft
author Goffi <goffi@goffi.org>
date Sun, 24 Feb 2013 18:15:38 +0100
parents 8475a29d7214
children 97d5e9de1106
comparison
equal deleted inserted replaced
180:ea6ae7c4b3f0 181:c0b78a3af06d
26 from pyjamas.ui.HorizontalPanel import HorizontalPanel 26 from pyjamas.ui.HorizontalPanel import HorizontalPanel
27 from pyjamas.ui.ScrollPanel import ScrollPanel 27 from pyjamas.ui.ScrollPanel import ScrollPanel
28 from pyjamas.ui.TabPanel import TabPanel 28 from pyjamas.ui.TabPanel import TabPanel
29 from pyjamas.ui.HTMLPanel import HTMLPanel 29 from pyjamas.ui.HTMLPanel import HTMLPanel
30 from pyjamas.ui.FlexTable import FlexTable 30 from pyjamas.ui.FlexTable import FlexTable
31 from pyjamas.ui.Grid import Grid 31 from pyjamas.ui.Frame import Frame
32 from pyjamas.ui.TextArea import TextArea 32 from pyjamas.ui.TextArea import TextArea
33 from pyjamas.ui.TextBox import TextBox
33 from pyjamas.ui.Label import Label 34 from pyjamas.ui.Label import Label
34 from pyjamas.ui.Button import Button 35 from pyjamas.ui.Button import Button
35 from pyjamas.ui.HTML import HTML 36 from pyjamas.ui.HTML import HTML
36 from pyjamas.ui.Image import Image 37 from pyjamas.ui.Image import Image
37 from pyjamas.ui.DropWidget import DropWidget 38 from pyjamas.ui.DropWidget import DropWidget
661 def __init__(self, nick): 662 def __init__(self, nick):
662 self.nick = nick 663 self.nick = nick
663 HTML.__init__(self, "<div class='occupant'>%s</div>" % html_sanitize(nick)) 664 HTML.__init__(self, "<div class='occupant'>%s</div>" % html_sanitize(nick))
664 665
665 def __str__(self): 666 def __str__(self):
666 return nick 667 return self.nick
667 668
668 class OccupantsList(AbsolutePanel): 669 class OccupantsList(AbsolutePanel):
669 """Panel user to show occupants of a room""" 670 """Panel user to show occupants of a room"""
670 671
671 def __init__(self): 672 def __init__(self):
816 if game_type=="Tarot": 817 if game_type=="Tarot":
817 return self.tarot_panel 818 return self.tarot_panel
818 elif game_type=="RadioCol": 819 elif game_type=="RadioCol":
819 return self.radiocol_panel 820 return self.radiocol_panel
820 821
822 class WebPanel(LiberviaWidget):
823 """ (mini)browser like widget """
824
825 def __init__(self, host, url=None):
826 """
827 @param host: SatWebFrontend instance
828 """
829 LiberviaWidget.__init__(self, host)
830 self._vpanel = VerticalPanel()
831 self._vpanel.setSize('100%', '20')
832 self._url = TextBox()
833 self._url.setText(url or "")
834 self._url.setWidth('100%')
835 hpanel = HorizontalPanel()
836 hpanel.add(self._url)
837 btn = Button("Go", self.onUrlClick)
838 hpanel.setCellWidth(self._url, "100%")
839 #self.setCellWidth(btn, "10%")
840 hpanel.add(self._url)
841 hpanel.add(btn)
842 self._vpanel.add(hpanel)
843 self._frame = Frame(url or "")
844 self._frame.setSize('100%', '100%')
845 self._vpanel.add(self._frame)
846 self.setWidget(self._vpanel)
847
848 def onUrlClick(self, sender):
849 self._frame.setUrl(self._url.getText())
850
821 class WidgetsPanel(ScrollPanelWrapper): 851 class WidgetsPanel(ScrollPanelWrapper):
822 852
823 def __init__(self, host): 853 def __init__(self, host):
824 ScrollPanelWrapper.__init__(self) 854 ScrollPanelWrapper.__init__(self)
825 self.setSize('100%', '100%') 855 self.setSize('100%', '100%')