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


Python HTML.setWordWrap方法代码示例

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


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

示例1: MailDetail

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

示例2: insertTab

# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setWordWrap [as 别名]
    def insertTab(self, text, asHTML, beforeIndex=None):
        """ 1st arg can, instead of being 'text', be a widget
        """
        if beforeIndex is None:
            beforeIndex = asHTML
            asHTML = False

        if (beforeIndex < 0) or (beforeIndex > self.getTabCount()):
            #throw new IndexOutOfBoundsException();
            pass

        if isinstance(text, basestring):
            if asHTML:
                item = HTML(text)
            else:
                item = Label(text)
            item.setWordWrap(False)
        else:
            # passing in a widget, it's expected to have its own style
            item = text

        self.insertTabWidget(item, beforeIndex)
开发者ID:Afey,项目名称:pyjs,代码行数:24,代码来源:FlowTabBar.py

示例3: insertTab

# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import setWordWrap [as 别名]
    def insertTab(self, text, asHTML, beforeIndex=None):
        """ 1st arg can, instead of being 'text', be a widget.

            1st arg can also be None, which results in a blank
            space between tabs.  Use this to push subsequent
            tabs out to the right hand end of the TabBar.
            (the "blank" tab, by not being focussable, is not
            clickable).
        """
        if beforeIndex is None:
            beforeIndex = asHTML
            asHTML = False

        if (beforeIndex < 0) or (beforeIndex > self.getTabCount()):
            #throw new IndexOutOfBoundsException();
            pass

        if text is None:
            text = HTML("&nbsp;", True)
            text.setWidth("100%")
            text.setStyleName("gwt-TabBarRest")
            self.panel.insert(text, beforeIndex + 1)
            self.panel.setCellWidth(text, "100%")
            return

        istext = isinstance(text, basestring)

        if istext:
            if asHTML:
                item = HTML(text)
            else:
                item = Label(text)
            item.setWordWrap(False)
        else:
            # passing in a widget, it's expected to have its own style
            item = text

        self.insertTabWidget(item, beforeIndex)
开发者ID:anandology,项目名称:pyjamas,代码行数:40,代码来源:TabBar.py


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