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


Python Label.addStyleName方法代码示例

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


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

示例1: init

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import addStyleName [as 别名]
    def init(self):
        main = Window("CSS Tools Add-on Test")
        self.setMainWindow(main)

        testWindow = Window("Normal Window")
        testWindow.addComponent(Label("<p>This window is used as the component to measure.</p>", Label.CONTENT_XHTML))
        main.addWindow(testWindow)
        testWindow.center()

        title = Label("CSS Properties to Retrieve")
        title.addStyleName(Reindeer.LABEL_H2)
        main.addComponent(title)

        target = NativeSelect("Target Component")
        main.addComponent(target)

        get = Button("Refresh Properties", GetClickListener(self, target))
        main.addComponent(get)

        main.addComponent(self.buildLabels())

        target.addItem(main.getContent())
        target.setItemCaption(main.getContent(), "Root layout")
        target.addItem(testWindow)
        target.setItemCaption(testWindow, "Sub window")
        target.addItem(get)
        target.setItemCaption(get, "The '" + get.getCaption() + "' Button")
        target.setNullSelectionAllowed(False)
        target.select(testWindow)
开发者ID:rwl,项目名称:muntjac,代码行数:31,代码来源:test_application.py

示例2: __init__

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import addStyleName [as 别名]
    def __init__(self):
        super(SplitPanelPositioningExample, self).__init__()

        self.setStyleName('split-panel-positioning-example')
        self.setSpacing(True)

        controls = HorizontalLayout()
        controls.setSpacing(True)
        self.addComponent(controls)

        self._verticalSplitPanel = VerticalSplitPanel()
        self._verticalSplitPanel.setSplitPosition(100, ISizeable.UNITS_PIXELS)
        self._verticalSplitPanel.setLocked(True)
        self._verticalSplitPanel.setHeight('450px')
        self._verticalSplitPanel.setWidth('100%')
        self.addComponent(self._verticalSplitPanel)

        # Add some content to the top
        topArea = Label()
        topArea.setStyleName('top-area')
        topArea.addStyleName('measured-from-top')
        topArea.setSizeFull()
        self._verticalSplitPanel.addComponent(topArea)

        # Add a horizontal split panel in the bottom area
        self._horizontalSplitPanel = HorizontalSplitPanel()
        self._horizontalSplitPanel.setSplitPosition(30,
                ISizeable.UNITS_PERCENTAGE)
        self._horizontalSplitPanel.setSizeFull()
        self._horizontalSplitPanel.setLocked(True)
        self._verticalSplitPanel.addComponent(self._horizontalSplitPanel)

        # Add some content to the left and right sides of the vertical layout
        leftArea = Label()
        leftArea.setStyleName('left-area')
        leftArea.addStyleName('measured-from-left')
        leftArea.setSizeFull()
        self._horizontalSplitPanel.addComponent(leftArea)

        rightArea = Label()
        rightArea.setStyleName('right-area')
        rightArea.setSizeFull()
        self._horizontalSplitPanel.addComponent(rightArea)

        # Allow user to set the splitter positioning
        self._measurePositionFromLeft = OptionGroup('Horizontal split position',
                ['30% from left', '30% from right'])
        self._measurePositionFromLeft.setValue('30% from left')
        self._measurePositionFromLeft.setImmediate(True)

        l = LeftRightListener(self, leftArea, rightArea)
        self._measurePositionFromLeft.addListener(l, IValueChangeListener)
        controls.addComponent(self._measurePositionFromLeft)
        controls.setComponentAlignment(self._measurePositionFromLeft,
                Alignment.MIDDLE_CENTER)

        self._measurePositionFromTop = OptionGroup('Vertical split position',
                ['100px from top', '100px from bottom'])
        self._measurePositionFromTop.setValue('100px from top')
        self._measurePositionFromTop.setImmediate(True)

        l = TopBottomListener(self, leftArea, rightArea, topArea)
        self._measurePositionFromTop.addListener(l, IValueChangeListener)
        controls.addComponent(self._measurePositionFromTop)
        controls.setComponentAlignment(self._measurePositionFromTop,
                Alignment.MIDDLE_CENTER)
开发者ID:AvdN,项目名称:muntjac,代码行数:68,代码来源:SplitPanelPositioningExample.py

示例3: FeatureView

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import addStyleName [as 别名]
class FeatureView(HorizontalLayout):

    _MSG_SHOW_SRC = 'View Source'

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

        self._right = None
        self._left = None
        self._controls = None
        self._title = Label("", Label.CONTENT_XHTML)
        self._showSrc = None
        self._exampleCache = dict()
        self._currentFeature = None
        self._srcWindow = None

        self.setWidth('100%')
        self.setMargin(True)
        self.setSpacing(True)
        self.setStyleName('sample-view')

        self._left = VerticalLayout()
        self._left.setWidth('100%')
        self._left.setSpacing(True)
        self._left.setMargin(False)
        self.addComponent(self._left)
        self.setExpandRatio(self._left, 1)

        rightLayout = VerticalLayout()
        self._right = Panel(rightLayout)
        rightLayout.setMargin(True, False, False, False)
        self._right.setStyleName(Reindeer.PANEL_LIGHT)
        self._right.addStyleName('feature-info')
        self._right.setWidth('319px')
        self.addComponent(self._right)

        self._controls = HorizontalLayout()
        self._controls.setWidth('100%')
        self._controls.setStyleName('feature-controls')

        self._title.setStyleName('title')
        self._controls.addComponent(self._title)
        self._controls.setExpandRatio(self._title, 1)

        resetExample = NativeButton('Reset', ResetListener(self))
        resetExample.setStyleName(BaseTheme.BUTTON_LINK)
        resetExample.addStyleName('reset')
        resetExample.setDescription('Reset Sample')
        self._controls.addComponent(resetExample)
        self._showSrc = ActiveLink()
        self._showSrc.setDescription('Right / middle / ctrl / shift -click for browser window/tab')

        self._showSrc.addListener(ShowSrcListener(self), ILinkActivatedListener)
        self._showSrc.setCaption(self._MSG_SHOW_SRC)
        self._showSrc.addStyleName('showcode')
        self._showSrc.setTargetBorder(Link.TARGET_BORDER_NONE)
        self._controls.addComponent(self._showSrc)


    def showSource(self, source):
        if self._srcWindow is None:
            self._srcWindow = Window('Python source')
            self._srcWindow.getContent().setSizeUndefined()
            self._srcWindow.setWidth('70%')
            self._srcWindow.setHeight('60%')
            self._srcWindow.setPositionX(100)
            self._srcWindow.setPositionY(100)

        self._srcWindow.removeAllComponents()
        self._srcWindow.addComponent( CodeLabel(source) )

        if self._srcWindow.getParent() is None:
            self.getWindow().addWindow(self._srcWindow)


    def resetExample(self):
        if self._currentFeature is not None:
            w = self.getWindow()
            w.removeSubwindows()
            f = self._currentFeature
            self._currentFeature = None
            if f in self._exampleCache:
                del self._exampleCache[f]
            self.setFeature(f)


    def setFeature(self, feature):

        from muntjac.demo.sampler.SamplerApplication import SamplerApplication

        if feature != self._currentFeature:
            self._currentFeature = feature
            self._right.removeAllComponents()
            self._left.removeAllComponents()

            self._left.addComponent(self._controls)
            self._title.setValue('<span>' + feature.getName() + '</span>')
            if feature.getSinceVersion().isNew():
                self._title.addStyleName('new')
            else:
#.........这里部分代码省略.........
开发者ID:Lemoncandy,项目名称:muntjac,代码行数:103,代码来源:FeatureView.py


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