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


Python Label.setCaption方法代码示例

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


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

示例1: JSApiExample

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

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

        self._toBeUpdatedFromThread = None
        self._startThread = None
        self._running = Label('')

        self.setSpacing(True)

        javascript = Label("<h3>Run Native JavaScript</h3>",
                Label.CONTENT_XHTML)
        self.addComponent(javascript)

        script = TextArea()
        script.setWidth('100%')
        script.setRows(3)
        script.setValue('alert(\"Hello Muntjac\");')
        self.addComponent(script)

        self.addComponent(Button('Run script', RunListener(self, script)))
        sync = Label("<h3>Force Server Syncronization</h3>",
                Label.CONTENT_XHTML)
        self.addComponent(sync)

        self.addComponent(Label('For advanced client side programmers '
                'Muntjac offers a simple method which can be used to force '
                'the client to synchronize with the server. This may be '
                'needed for example if another part of a mashup changes '
                'things on server.'))

        self._toBeUpdatedFromThread = Label("This Label component will be "
                "updated by a background thread. Click \"Start "
                "background thread\" button and start clicking "
                "on the link below to force "
                "synchronization.", Label.CONTENT_XHTML)
        self.addComponent(self._toBeUpdatedFromThread)

        # This label will be show for 10 seconds while the background process
        # is working
        self._running.setCaption('Background process is running for 10 '
                'seconds, click the link below')
        self._running.setIcon(
                ThemeResource('../base/common/img/ajax-loader-medium.gif'))

        # Clicking on this button will start a repeating thread that updates
        # the label value
        self._startThread = Button('Start background thread',
                StartListener(self))
        self.addComponent(self._startThread)

        # This link will make an Ajax request to the server that will respond
        # with UI changes that have happened since last request
        self.addComponent(Label("<a href=\"javascript:vaadin.forceSync();\">"
                "javascript: vaadin.forceSync();</a>", Label.CONTENT_XHTML))
开发者ID:Lemoncandy,项目名称:muntjac,代码行数:58,代码来源:JSApiExample.py

示例2: buildLabels

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setCaption [as 别名]
 def buildLabels(self):
     grid = GridLayout()
     grid.setSpacing(True)
     grid.setWidth("100%")
     grid.setColumns(6)
     for prop in CssProperty.values():
         l = Label("-")
         l.setSizeUndefined()
         l.setCaption(str(prop))
         self._props[prop] = l
         grid.addComponent(l)
     return grid
开发者ID:rwl,项目名称:muntjac,代码行数:14,代码来源:test_application.py

示例3: __init__

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

        self.setSpacing(True)

        # Button w/ icon
        button = Button('Save')
        button.setIcon(ThemeResource('../sampler/icons/action_save.gif'))
        self.addComponent(button)

        # Label
        l = Label('Icons are very handy')
        l.setCaption('Comment')
        l.setIcon(ThemeResource('../sampler/icons/comment_yellow.gif'))
        self.addComponent(l)

        # Panel w/ links
        p = Panel('Handy links')
        p.setIcon(ThemeResource('../sampler/icons/icon_info.gif'))
        self.addComponent(p)
        lnk = Link('http://vaadin.com',
                ExternalResource('http://www.vaadin.com'))
        lnk.setIcon(ThemeResource('../sampler/icons/icon_world.gif'))
        p.addComponent(lnk)
        lnk = Link('http://vaadin.com/learn',
                ExternalResource('http://www.vaadin.com/learn'))
        lnk.setIcon(ThemeResource('../sampler/icons/icon_world.gif'))
        p.addComponent(lnk)
        lnk = Link('http://dev.vaadin.com/',
                ExternalResource('http://dev.vaadin.com/'))
        lnk.setIcon(ThemeResource('../sampler/icons/icon_world.gif'))
        p.addComponent(lnk)
        lnk = Link('http://vaadin.com/forum',
                ExternalResource('http://vaadin.com/forum'))
        lnk.setIcon(ThemeResource('../sampler/icons/icon_world.gif'))
        p.addComponent(lnk)
开发者ID:AvdN,项目名称:muntjac,代码行数:38,代码来源:IconsExample.py

示例4: UploadWithProgressMonitoringExample

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

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

        self.setSpacing(True)

        self._state = Label()
        self._result = Label()
        self._fileName = Label()
        self._textualProgress = Label()
        self._pi = ProgressIndicator()
        self._counter = LineBreakCounter()
        self._upload = Upload(None, self._counter)

        self.addComponent(Label('Upload a file and we\'ll count the number '
                'of line break characters (\\n) found in it.'))

        # make analyzing start immediatedly when file is selected
        self._upload.setImmediate(True)
        self._upload.setButtonCaption('Upload File')
        self.addComponent(self._upload)

        handBrake = CheckBox('Simulate slow server')
        handBrake.setValue(True)
        self._counter.setSlow(True)
        handBrake.setDescription('Sleep for 100ms after each kilobyte to '
                'simulate slower processing/bandwidth. This is to show '
                'progress indicator even with rather small files.')
        handBrake.addListener(HandBrakeListener(self), button.IClickListener)

        cancelProcessing = Button('Cancel')
        cancelProcessing.addListener(CancelListener(self),
                button.IClickListener)
        cancelProcessing.setVisible(False)
        cancelProcessing.setStyleName('small')

        handBrake.setImmediate(True)
        self.addComponent(handBrake)

        p = Panel('Status')
        p.setSizeUndefined()

        l = FormLayout()
        l.setMargin(True)
        p.setContent(l)

        stateLayout = HorizontalLayout()
        stateLayout.setSpacing(True)
        stateLayout.addComponent(self._state)
        stateLayout.addComponent(cancelProcessing)
        stateLayout.setCaption('Current state')
        self._state.setValue('Idle')
        l.addComponent(stateLayout)

        self._fileName.setCaption('File name')
        l.addComponent(self._fileName)

        self._result.setCaption('Line breaks counted')
        l.addComponent(self._result)

        self._pi.setCaption('Progress')
        self._pi.setVisible(False)
        l.addComponent(self._pi)
        self._textualProgress.setVisible(False)
        l.addComponent(self._textualProgress)

        self.addComponent(p)

        self._upload.addListener(StartedListener(self),
                upload.IStartedListener)

        self._upload.addListener(ProgressListener(self),
                upload.IProgressListener)

        self._upload.addListener(SucceededListener(self),
                upload.ISucceededListener)

        self._upload.addListener(FailedListener(self),
                upload.IFailedListener)

        self._upload.addListener(FinishedListener(self),
                upload.IFinishedListener)
开发者ID:AvdN,项目名称:muntjac,代码行数:85,代码来源:UploadWithProgressMonitoringExample.py


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