本文整理汇总了Python中pyjamas.ui.ScrollPanel.ScrollPanel.getAbsoluteTop方法的典型用法代码示例。如果您正苦于以下问题:Python ScrollPanel.getAbsoluteTop方法的具体用法?Python ScrollPanel.getAbsoluteTop怎么用?Python ScrollPanel.getAbsoluteTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.ScrollPanel.ScrollPanel
的用法示例。
在下文中一共展示了ScrollPanel.getAbsoluteTop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MailDetail
# 需要导入模块: from pyjamas.ui.ScrollPanel import ScrollPanel [as 别名]
# 或者: from pyjamas.ui.ScrollPanel.ScrollPanel import getAbsoluteTop [as 别名]
class MailDetail(Composite):
def __init__(self):
Composite.__init__(self)
panel = VerticalPanel()
headerPanel = VerticalPanel()
self.subject = HTML()
self.sender = HTML()
self.recipient = HTML()
self.body = HTML()
self.scroller = ScrollPanel(self.body)
self.body.setWordWrap(True)
headerPanel.add(self.subject)
headerPanel.add(self.sender)
headerPanel.add(self.recipient)
headerPanel.setWidth("100%")
innerPanel = DockPanel()
innerPanel.add(headerPanel, DockPanel.NORTH)
innerPanel.add(self.scroller, DockPanel.CENTER)
innerPanel.setCellHeight(self.scroller, "100%")
panel.add(innerPanel)
innerPanel.setSize("100%", "100%")
self.scroller.setSize("100%", "100%")
self.initWidget(panel)
self.setStyleName("mail-Detail")
headerPanel.setStyleName("mail-DetailHeader")
innerPanel.setStyleName("mail-DetailInner")
self.subject.setStyleName("mail-DetailSubject")
self.sender.setStyleName("mail-DetailSender")
self.recipient.setStyleName("mail-DetailRecipient")
self.body.setStyleName("mail-DetailBody")
Logger("Mail detail", " ")
def setItem(self, item):
self.scroller.setScrollPosition(0)
self.scroller.setHorizontalScrollPosition(0)
self.subject.setHTML(item.subject)
self.sender.setHTML("<b>From:</b> " + item.sender)
self.recipient.setHTML("<b>To:</b> [email protected]")
self.body.setHTML(item.body)
def adjustSize(self, windowWidth, windowHeight):
scrollWidth = windowWidth - self.scroller.getAbsoluteLeft() - 9
if (scrollWidth < 1):
scrollWidth = 1
scrollHeight = windowHeight - self.scroller.getAbsoluteTop() - 9
if (scrollHeight < 1):
scrollHeight = 1
self.scroller.setSize("%dpx" % scrollWidth, "%dpx" % scrollHeight)