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


Python ScrollPanel.setSize方法代码示例

本文整理汇总了Python中pyjamas.ui.ScrollPanel.ScrollPanel.setSize方法的典型用法代码示例。如果您正苦于以下问题:Python ScrollPanel.setSize方法的具体用法?Python ScrollPanel.setSize怎么用?Python ScrollPanel.setSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyjamas.ui.ScrollPanel.ScrollPanel的用法示例。


在下文中一共展示了ScrollPanel.setSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AdinfoIFACE

# 需要导入模块: from pyjamas.ui.ScrollPanel import ScrollPanel [as 别名]
# 或者: from pyjamas.ui.ScrollPanel.ScrollPanel import setSize [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 setSize [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

示例3: __init__

# 需要导入模块: from pyjamas.ui.ScrollPanel import ScrollPanel [as 别名]
# 或者: from pyjamas.ui.ScrollPanel.ScrollPanel import setSize [as 别名]
    def __init__(self):
        SimplePanel.__init__(self)

        panel = ScrollPanel()

        contents = HTML("<b>Tao Te Ching, Chapter One</b><p>" +
                        "The Way that can be told of is not an unvarying " +
                        "way;<p>The names that can be named are not " +
                        "unvarying names.<p>It was from the Nameless that " +
                        "Heaven and Earth sprang;<p>The named is but the " +
                        "mother that rears the ten thousand creatures, " +
                        "each after its kind.")

        panel.add(contents)
        panel.setSize("300px", "100px")
        self.add(panel)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:18,代码来源:scrollPanel.py

示例4: DataDictTree

# 需要导入模块: from pyjamas.ui.ScrollPanel import ScrollPanel [as 别名]
# 或者: from pyjamas.ui.ScrollPanel.ScrollPanel import setSize [as 别名]
class DataDictTree(Sink):
    pathdict = {}
    reduceFiles = None
    fTree = None
    
    def __init__(self, parent = None):
        Sink.__init__(self, parent)
        self.reduceFiles = []
        if True:
            HTTPRequest().asyncGet("datadir.xml", 
                                    DirDictLoader(self),
                                )
        dock = DockPanel(HorizontalAlignment=HasAlignment.ALIGN_LEFT, 
                            Spacing=10,
                             Size=("100%","100%"))
        self.dock = dock
        self.fProto = []

        self.fTree = Tree()
        self.treePanel = ScrollPanel()
        self.treePanel.setSize("100%", 
                                str(
                                 int(
                                  Window.getClientHeight()*.75
                                 )
                                )+"px")
        Window.addWindowResizeListener(self)
        
        self.treePanel.add(self.fTree)
        dock.add(self.treePanel, DockPanel.WEST)
        
        
        #self.treePanel.setBorderWidth(1)
        #self.treePanel.setWidth("100%")
        
        prPanel = self.createRightPanel()
        dock.add(prPanel,DockPanel.EAST)
        
        dock.setCellWidth(self.treePanel, "50%")
        dock.setCellWidth(prPanel, "50%")
        for i in range(len(self.fProto)):
            self.createItem(self.fProto[i])
            self.fTree.addItem(self.fProto[i].item)

        self.fTree.addTreeListener(self)
        self.initWidget(self.dock)
        
        if False: #self.parent.filexml != None:
            DirDictLoader(self).onCompletion(self.parent.filexml)

    def onWindowResized(self, width, height):
        self.treePanel.setSize("100%", 
                                str(
                                 int(
                                  height *.75
                                 )
                                )+"px")
    def onRecipeSelected(self, event):
        self.updateReduceCL()
    
    def onClearReduceFiles(self, event):
        self.reduceFiles.clear() 
        self.adInfo.setHTML("file info...") 
        self.updateReduceCL()
        
    def updateReduceCL(self):
        recipe = self.recipeList.getItemText(self.recipeList.getSelectedIndex())
        
        if recipe=="None":
            rstr = ""
        else:
            rstr = "-r "+recipe

        rfiles = []            
        for i in range(0, self.reduceFiles.getItemCount()):
            fname = self.reduceFiles.getItemText(i)
            rfiles.append(fname)
        filesstr = " ".join(rfiles)
        
                
        self.prepareReduce.setHTML('<b>reduce</b> %(recipe)s %(files)s' % 
                                        { "recipe":rstr, 
                                          "files":filesstr})

    def onTreeItemSelected(self, item):
        pathdict = self.pathdict
        
        tfile = item.getText()
        #check if already in
        if tfile in pathdict:
            ftype = pathdict[tfile]["filetype"]
            if ftype != "fileEntry":
                item.setState(True)
                return
        else:
            return
        for i in range(0, self.reduceFiles.getItemCount()):
            fname = self.reduceFiles.getItemText(i)
            if fname == tfile:
                return
#.........这里部分代码省略.........
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:103,代码来源:DataDictTree.py

示例5: onModuleLoad

# 需要导入模块: from pyjamas.ui.ScrollPanel import ScrollPanel [as 别名]
# 或者: from pyjamas.ui.ScrollPanel.ScrollPanel import setSize [as 别名]
    def onModuleLoad(self):
        """ Dynamically build our user interface when the web page is loaded.
        """
        self._root        = RootPanel()
        self._tree        = Tree()
        self._rightPanel  = SimplePanel()
        self._curContents = None

        intro = HTML('<h3>Welcome to the Pyjamas User Interface Showcase</h3>'+
                     '<p/>Please click on an item to start.')

        self._introPanel = VerticalPanel()
        self._introPanel.add(uiHelpers.indent(intro, left=20))

        self._demos = [] # List of all installed demos.  Each item in this list
                         # is a dictionary with the following entries:
                         #
                         #     'name'
                         #
                         #         The name for this demo.
                         #
                         #     'section'
                         #
                         #         The name of the section of the demo tree
                         #         this demo should be part of.
                         #
                         #     'doc'
                         #
                         #         The documentation for this demo.
                         #
                         #     'src'
                         #
                         #         The source code for this demo.
                         #
                         #     'example'
                         #
                         #         The Panel which holds the example output for
                         #         this demo.

        self.loadDemos()
        self.buildTree()

        self._tree.setSize("0%", "100%")

        divider = VerticalPanel()
        divider.setSize("1px", "100%")
        divider.setBorderWidth(1)

        scroller = ScrollPanel(self._rightPanel)
        scroller.setSize("100%", "100%")

        hPanel = HorizontalPanel()
        hPanel.setSpacing(4)

        hPanel.add(self._tree)
        hPanel.add(divider)
        hPanel.add(scroller)

        hPanel.setHeight("100%")
        self._root.add(hPanel)

        self._tree.addTreeListener(self)
        self.showDemo(None)
开发者ID:Afey,项目名称:pyjs,代码行数:65,代码来源:Showcase.py


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