本文整理汇总了Python中pyjamas.ui.HTML.HTML类的典型用法代码示例。如果您正苦于以下问题:Python HTML类的具体用法?Python HTML怎么用?Python HTML使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GettextExample
class GettextExample(object):
def __init__(self):
self.b = Button(_("Click me"), self.greet, StyleName='teststyle')
self.h = HTML(_("<b>Hello World</b> (html)"), StyleName='teststyle')
self.l = Label(_("Hello World (label)"), StyleName='teststyle')
self.base = HTML(_("Hello from %s") % pygwt.getModuleBaseURL(),
StyleName='teststyle')
RootPanel().add(self.b)
RootPanel().add(self.h)
RootPanel().add(self.l)
RootPanel().add(self.base)
def change_texts(self, text):
self.b.setText(_("Click me"))
self.h.setHTML(_("<b>Hello World</b> (html)"))
self.l.setText(_("Hello World (label)"))
text = [_("Hello from %s") % pygwt.getModuleBaseURL()]
for i in range(4):
text.append(ngettext('%(num)d single', '%(num)d plural', i) % dict(num=i))
text = '<br />'.join(text)
self.base.setHTML(text)
def greet(self, fred):
fred.setText(_("No, really click me!"))
Window.alert(_("Hello, there!"))
i18n.load(lang=lang[0], onCompletion=self.change_texts)
lang.append(lang.pop(0))
示例2: YChanger
class YChanger (HorizontalPanel):
def __init__(self, chart):
self.chart = chart
HorizontalPanel.__init__(self)
# y-changing, x,y coordinate displaying, widget
self.incrementY = Button("Increment Y")
self.coordinates = HTML(""); # x,y of selected point
self.decrementY = Button("Decrement Y")
self.incrementY.addClickListener(self)
self.decrementY.addClickListener(self)
self.add(self.incrementY)
self.add(self.coordinates)
self.add(self.decrementY)
def onClick(self, sender):
if sender == self.incrementY:
self.chart.getTouchedPoint().setY(
self.chart.getTouchedPoint().getY() + 1)
else:
self.chart.getTouchedPoint().setY(
self.chart.getTouchedPoint().getY() - 1)
self.chart.update()
# The 2 HoverUpdateable interface methods:
def hoverCleanup(self, hoveredAwayFrom):
pass
def hoverUpdate(self, hoveredOver):
# update (x,y) display when they click point
self.coordinates.setHTML(hoveredOver.getHovertext())
示例3: __init__
def __init__(self, grid_size):
Grid.__init__(self)
# populate the grid with some stuff
#
self.resize(grid_size, grid_size)
self.setBorderWidth(2)
self.setCellPadding(4)
self.setCellSpacing(1)
self.setStyleName("gameboard") # just doesn't work
# Set up game board
#
# Note that must iterate over indices, rather than Cell
# instances, until the table positions are set up here
#
index = 0 # debug
for i in range(grid_size):
for j in range(grid_size):
cell = HTML(SPACE)
# cell.setVisible(False) # causes to ignore click events
cell.position = (i, j) # might be handy at some point
index+=1; cell.index = index # debug
# cell.setStyleName("cell_O")
cell.addClickListener(getattr(self, "onCellClicked"))
self.setWidget(i, j, cell)
示例4: addContact
def addContact(self, contact):
link = HTML("<a href='javascript:;'>" + contact.name + "</a>")
self.panel.add(link)
# Add a click listener that displays a ContactPopup when it is clicked.
listener = ContactListener(contact, link)
link.addClickListener(listener)
示例5: DisplayPanel
class DisplayPanel(Composite):
def __init__(self, owner):
Composite.__init__(self)
self.owner = owner
self.bar = DockPanel()
self.timer_msg = HTML(" timer: ")
self.timer = TimeDisplay()
self.timer_panel = HorizontalPanel()
self.timer_panel.add(self.timer_msg)
self.timer_panel.add(self.timer)
self.counter_msg = HTML(" total moves: ")
self.counter = HTML("0")
self.counter_panel = HorizontalPanel()
self.counter_panel.add(self.counter_msg)
self.counter_panel.add(self.counter)
self.initWidget(self.bar)
self.bar.add(self.timer_panel, DockPanel.WEST)
self.bar.add(self.counter_panel, DockPanel.EAST)
self.setStyleName("Puzzle-DisplayPanel")
def incrCount(self):
count = self.counter.getText()
count = int(count) + 1
self.counter.setText(count)
def reset(self):
self.timer.setDisplay(0, 0, 0)
self.counter.setText("0")
示例6: __init__
def __init__(self):
Composite.__init__(self)
self.signOutLink = HTML("<a href='javascript:;'>Sign Out</a>")
self.aboutLink = HTML("<a href='javascript:;'>About</a>")
outer = HorizontalPanel()
inner = VerticalPanel()
outer.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
inner.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
links = HorizontalPanel()
links.setSpacing(4)
links.add(self.signOutLink)
links.add(self.aboutLink)
outer.add(inner)
inner.add(HTML("<b>Welcome back, [email protected]</b>"))
inner.add(links)
self.signOutLink.addClickListener(self)
self.aboutLink.addClickListener(self)
self.initWidget(outer)
inner.setStyleName("mail-TopPanel")
links.setStyleName("mail-TopPanelLinks")
示例7: onModuleLoad
def onModuleLoad(self):
dock = DockPanel(Width="100%")
self.header = HTML(Width="100%", Height="220px")
self.footer = HTML(Width="100%")
self.sidebar = HTML(Width="200px", Height="100%", StyleName="sidebar")
self.fTabs = DecoratedTabPanel(Size=("100%", "100%"), StyleName="tabs")
#dp = DecoratorTitledPanel("Tabs", "bluetitle", "bluetitleicon",
# ["bluetop", "bluetop2", "bluemiddle", "bluebottom"])
#dp.add(self.fTabs)
dock.add(self.header, DockPanel.NORTH)
dock.add(self.footer, DockPanel.SOUTH)
dock.add(self.sidebar, DockPanel.EAST)
dock.add(self.fTabs, DockPanel.CENTER)
dock.setCellVerticalAlignment(self.fTabs, HasAlignment.ALIGN_TOP)
#dock.setCellHorizontalAlignment(self.fTabs, HasAlignment.ALIGN_CENTER)
dock.setCellWidth(self.header, "100%")
dock.setCellHeight(self.header, "220px")
dock.setCellWidth(self.footer, "100%")
dock.setCellWidth(self.sidebar, "200px")
RootPanel().add(dock)
self.dock = dock
self.loadPageList()
Window.addWindowResizeListener(self)
DeferredCommand.add(self)
示例8: __init__
def __init__(self, userListPanel, tabPanel, topPanel):
VerticalPanel.__init__(self, StyleName='large-avatar-panel')
self.userListPanel = userListPanel
self.tabPanel = tabPanel
self.topPanel = topPanel
upperPanel = HorizontalPanel(StyleName='large-avatar-upper-panel',
Spacing=8)
self.image = Image(StyleName='large-avatar')
self.upperText = HTML(StyleName='large-avatar-upper-text')
upperPanel.add(self.image)
upperPanel.add(self.upperText)
self.add(upperPanel)
self.lowerText = HTML(StyleName='large-avatar-lower-text')
self.add(self.lowerText)
self.followButton = None
self.user = None
insertPanel = HorizontalPanel(Spacing=3)
insertPanel.add(Label('Use name: '))
if tabPanel.tabName == 'simple':
b1 = Button('upper', SimpleInserter(self, 'upper'))
b2 = Button('lower', SimpleInserter(self, 'lower'))
insertPanel.add(b1)
insertPanel.add(b2)
else:
b1 = Button('or', QueryInserter(self, 'or'))
b2 = Button('and', QueryInserter(self, 'and'))
b3 = Button('except', QueryInserter(self, 'except'))
insertPanel.add(b1)
insertPanel.add(b2)
insertPanel.add(b3)
self.add(insertPanel)
示例9: __init__
def __init__(self, txt, **kwargs):
txt = HTML(txt)
txt.addClickListener(self)
PopupPanel.__init__(self, autoHide=True, StyleName="showcase-popup",
**kwargs)
self.add(txt)
self.show()
示例10: __init__
def __init__(self):
PopupPanel.__init__(self, True)
contents = HTML("Click anywhere outside this popup to make it disappear.")
contents.setWidth("128px")
self.setWidget(contents)
self.setStyleName("ks-popups-Popup")
示例11: __init__
def __init__(self, hrs=0, mins=0, secs=0):
self.isActive = False
self.hrs = hrs
self.mins = mins
self.secs = secs
HTML.__init__(self)
self.setDisplay(self.hrs, self.mins, self.secs)
self.onTimer()
示例12: onCompletion
def onCompletion(self, response):
'''This method is called when asyncGet returns. If we know parameters of the
repsponse we may process differently for various cases. For example we may setup
data in the form if we call it from Populate Form button.
'''
self.view.root.remove(self.view.panel)
html = HTML()
html.setHTML(response)
self.view.root.add(html)
示例13: start
def start(sender):
Window.alert("Hello, GAMERS!")
hw = HTML("<img src='http://github.com/jrabbit/Defenditt/raw/master/public/media/instructions%20screen.png' alt='instructions'/>")
hw.setID('instructions')
RootPanel().add(hw)
JS("""
parent.top.document.getElementById("splash").style.display = "none";
parent.top.document.getElementById("startbutton").style.display = "none";
parent.top.document.getElementById("startbutton").style.height = 0;
""")
示例14: __init__
def __init__(self, tags = None, width = 300, selected = None, myid = 'select2example'):
#log.info("tags='%s' width='%s' selected='%s'", tags, width, selected)
self.myid = myid
self.tags = tags
# This markup is used by select2 to configure the component
html = '<p><input type="hidden" id="%s" style="width:%dpx"/></p>' % (myid, width)
html += '<div id="%s-show"></div>' % (myid)
self.selected = selected
log.info("html = '%s'", html)
HTML.__init__(self, html)
示例15: __init__
def __init__(self):
self.calsPanel = VerticalPanel(Size=("50%", ""))
self.info = HTML("", Width="100%")
self.calsPanel.add(self.info)
self.localcalreport = HTML("", True, )
self.globalcalreport = HTML("", True, )
self.calsPanel.add(self.localcalreport)
self.calsPanel.add(self.globalcalreport)
self.panel = self.calsPanel