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


Python Label.getValue方法代码示例

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


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

示例1: LabelRichExample

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import getValue [as 别名]
class LabelRichExample(VerticalLayout, IClickListener):

    def __init__(self):
        super(LabelRichExample, self).__init__()

        self.setSpacing(True)

        self._editor = RichTextArea()
        self._richText = Label('<h1>Rich text example</h1>'
                '<p>The <b>quick</b> brown fox jumps <sup>over</sup> '
                'the <b>lazy</b> dog.</p>'
                '<p>This text can be edited with the <i>Edit</i> -button</p>')
        self._richText.setContentMode(Label.CONTENT_XHTML)
        self.addComponent(self._richText)

        self._b = Button('Edit')
        self._b.addListener(self, IClickListener)
        self.addComponent(self._b)

        self._editor.setWidth('100%')


    def buttonClick(self, event):
        if self.getComponentIterator().next() == self._richText:
            self._editor.setValue(self._richText.getValue())
            self.replaceComponent(self._richText, self._editor)
            self._b.setCaption('Apply')
        else:
            self._richText.setValue(self._editor.getValue())
            self.replaceComponent(self._editor, self._richText)
            self._b.setCaption('Edit')
开发者ID:AvdN,项目名称:muntjac,代码行数:33,代码来源:LabelRichExample.py

示例2: setFeatureContainer

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import getValue [as 别名]
    def setFeatureContainer(self, c):
        self._grid.removeAllComponents()
        features = c.getItemIds()
        rootSet = CssLayout()
        rootTitle = None
        highlightRow = CssLayout()
        highlightRow.setStyleName('highlight-row')
        sampleCount = 0
        for f in features:
            if isinstance(f, FeatureSet):
                if c.isRoot(f):
                    if rootTitle is not None:
                        rootTitle.setValue(('<em>' + str(sampleCount)
                                + ' samples</em>' + rootTitle.getValue()))
                        sampleCount = 0
                    desc = f.getDescription()
                    try:
                        idx = desc.index(".")
                    except ValueError:
                        idx = -1
                    rootTitle = Label("<h2>"
                            + f.getName()
                            + "</h2><span>"
                            + desc[:idx + 1]
                            + "</span>", Label.CONTENT_XHTML)
                    rootTitle.setSizeUndefined()
                    if f.getRelatedFeatures() is not None:
                        rootTitle.setValue('<em>'
                                + len(f.getRelatedFeatures())
                                + ' samples</em>'
                                + rootTitle.getValue())
                    rootSet = CssLayout()
                    rootSet.setStyleName('root')
                    rootTitle.setStyleName('root-section')
                    self._grid.addComponent(rootTitle)
                    self._grid.addComponent(rootSet)
            else:
                sampleCount += 1
                resId = '75-' + f.getIconName()
                res = self._app.getSampleIcon(resId)
                if rootSet.getParent() is None:
                    # This sample is directly inside a non root feature
                    # set, we present these with higher priority
                    if rootTitle is None:
                        parent = self._app._allFeatures.getParent(f)
                        rootTitle = Label("<h2>" + parent.getName()
                                + "</h2>", Label.CONTENT_XHTML)
                        rootTitle.setStyleName('root-section highlights-title')
                        rootTitle.setSizeUndefined()
                        self._grid.addComponent(rootTitle)
                        if parent.getDescription() is not None:
                            desc = Label(parent.getDescription(),
                                    Label.CONTENT_XHTML)
                            desc.setStyleName('highlights-description')
                            desc.setSizeUndefined()
                            self._grid.addComponent(desc)
                    # Two samples per row
                    if sampleCount % 2 == 1:
                        highlightRow = CssLayout()
                        highlightRow.setStyleName('highlight-row')
                        self._grid.addComponent(highlightRow)
                    l = CssLayout()
                    l.setStyleName('highlight')
                    er = ExternalResource('#' + f.getFragmentName())
                    sample = ActiveLink(f.getName(), er)
                    sample.setIcon(res)
#                    if f.getSinceVersion().isNew():
#                        sample.addStyleName('new')
                    l.addComponent(sample)
                    if (f.getDescription() is not None
                            and f.getDescription() != ''):
                        d = f.getDescription()
                        desc = Label(d[:d.index(".") + 1], Label.CONTENT_XHTML)
                        desc.setSizeUndefined()
                        l.addComponent(desc)
                    highlightRow.addComponent(l)
                else:
                    sample = ActiveLink(f.getName(),
                            ExternalResource('#' + f.getFragmentName()))
                    sample.setStyleName(BaseTheme.BUTTON_LINK)
                    sample.addStyleName('screenshot')
                    if (f.getDescription() is not None
                            and f.getDescription() != ''):
                        desc = f.getDescription()
                        try:
                            idx = desc.index('.')
                        except ValueError:
                            idx = -1
                        sample.setDescription(desc[:idx + 1])
#                    if f.getSinceVersion().isNew():
#                        sample.addStyleName('new')
                    sample.setIcon(res)
                    rootSet.addComponent(sample)
        if rootTitle is not None:
            rootTitle.setValue('<em>' + str(sampleCount) + ' samples</em>'
                    + rootTitle.getValue())
开发者ID:MatiasNAmendola,项目名称:muntjac,代码行数:98,代码来源:SamplerApplication.py


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