当前位置: 首页>>代码示例>>Python>>正文


Python ScrollPanel.setScrollPosition方法代码示例

本文整理汇总了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())
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:36,代码来源:DataDictTree.py

示例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>&nbsp;" + item.sender)
        self.recipient.setHTML("<b>To:</b>&nbsp;[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)
开发者ID:Afey,项目名称:pyjs,代码行数:58,代码来源:MailDetail.py


注:本文中的pyjamas.ui.ScrollPanel.ScrollPanel.setScrollPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。