本文整理汇总了Python中muntjac.api.Label.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Python Label.setIcon方法的具体用法?Python Label.setIcon怎么用?Python Label.setIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类muntjac.api.Label
的用法示例。
在下文中一共展示了Label.setIcon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: JSApiExample
# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setIcon [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))
示例2: __init__
# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setIcon [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)
示例3: setFeature
# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setIcon [as 别名]
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:
self._title.removeStyleName('new')
self._left.addComponent(self.getExampleFor(feature))
self._right.setCaption('Description and Resources')
# Do not show parent description if it's directly inside the root
alll = SamplerApplication.getAllFeatures()
parent = alll.getParent(feature)
isRoot = alll.getParent(parent) is None
desc = parent.getDescription()
hasParentDesc = False
if parent is not None and not isRoot:
parentLabel = Label(parent.getDescription())
if desc is not None and desc != '':
parentLabel.setContentMode(Label.CONTENT_XHTML)
self._right.addComponent(parentLabel)
hasParentDesc = True
desc = feature.getDescription()
if desc is not None and desc != '':
# Sample description uses additional decorations if a parent
# description is found
l = Label(("<div class=\"outer-deco\"><div class=\"deco\">"
"<span class=\"deco\"></span>")
+ desc + "</div></div>", Label.CONTENT_XHTML)
self._right.addComponent(l)
if hasParentDesc:
l.setStyleName('sample-description')
else:
l.setStyleName('description')
# open src in new window -link
self._showSrc.setTargetName(self._currentFeature.getFragmentName())
er = ExternalResource(self.getApplication().getURL()
+ 'src/' + self._currentFeature.getFragmentName())
self._showSrc.setResource(er)
resources = feature.getRelatedResources()
if resources is not None:
res = VerticalLayout()
self.caption = Label("<span>Additional Resources</span>",
Label.CONTENT_XHTML)
self.caption.setStyleName('section')
self.caption.setWidth('100%')
res.addComponent(self.caption)
res.setMargin(False, False, True, False)
for r in resources:
l = Link(r.getName(), r)
l.setIcon( ThemeResource('../runo/icons/16/note.png') )
res.addComponent(l)
self._right.addComponent(res)
apis = feature.getRelatedAPI()
if apis is not None:
api = VerticalLayout()
self.caption = Label("<span>API Documentation</span>",
Label.CONTENT_XHTML)
self.caption.setStyleName('section')
self.caption.setWidth('100%')
api.addComponent(self.caption)
api.setMargin(False, False, True, False)
for r in apis:
l = Link(r.getName(), r)
ic = ThemeResource('../runo/icons/16/document-txt.png')
l.setIcon(ic)
api.addComponent(l)
self._right.addComponent(api)
features = feature.getRelatedFeatures()
if features is not None:
rel = VerticalLayout()
self.caption = Label("<span>Related Samples</span>",
Label.CONTENT_XHTML)
self.caption.setStyleName('section')
self.caption.setWidth('100%')
rel.addComponent(self.caption)
rel.setMargin(False, False, True, False)
for c in features:
f = SamplerApplication.getFeatureFor(c)
if f is not None:
er = ExternalResource(self.getApplication().getURL()
+ '#' + f.getFragmentName())
al = ActiveLink(f.getName(), er)
if isinstance(f, FeatureSet):
ic = ThemeResource('../sampler/icons/category.gif')
#.........这里部分代码省略.........