本文整理汇总了Python中pyjamas.ui.ScrollPanel.ScrollPanel.setScrollPosition方法的典型用法代码示例。如果您正苦于以下问题:Python ScrollPanel.setScrollPosition方法的具体用法?Python ScrollPanel.setScrollPosition怎么用?Python ScrollPanel.setScrollPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.ScrollPanel.ScrollPanel
的用法示例。
在下文中一共展示了ScrollPanel.setScrollPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AdinfoIFACE
# 需要导入模块: from pyjamas.ui.ScrollPanel import ScrollPanel [as 别名]
# 或者: from pyjamas.ui.ScrollPanel.ScrollPanel import setScrollPosition [as 别名]
class AdinfoIFACE(PanelIFACE):
def __init__(self, parent = None):
PanelIFACE.__init__(self, parent)
self.panel = ScrollPanel()
adinfo = HTML("", Size=("100%", parent.getHeight()))
self.panel.setSize("100%", parent.getHeight())
self.panel.add(adinfo)
self.adInfo = parent.adInfo = adinfo
Window.addWindowResizeListener(self)
return
def onTreeItemSelected(self, item):
pathdict = self.pathdict
filename = item.getText()
#check if already in
if filename in pathdict:
if pathdict[filename]["filetype"] == "fileEntry":
url = "adinfo?filename=%s" % self.pathdict[item.getText()]["path"]
HTTPRequest().asyncGet(url,
ADInfoLoader(self),
)
else:
self.adInfo.setHTML("""
<b style="font-size:200%%">%s</b>""" % pathdict[filename]["filetype"])
def scroll(self, where):
self.panel.setScrollPosition(where)
def onWindowResized(self, width, height):
self.panel.setSize("100%", self.parent.getHeight())
self.adInfo.setSize("100%", self.parent.getHeight())
示例2: MailDetail
# 需要导入模块: from pyjamas.ui.ScrollPanel import ScrollPanel [as 别名]
# 或者: from pyjamas.ui.ScrollPanel.ScrollPanel import setScrollPosition [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)