本文整理汇总了Python中r2.lib.wrapped.Styled类的典型用法代码示例。如果您正苦于以下问题:Python Styled类的具体用法?Python Styled怎么用?Python Styled使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Styled类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, options, default=None, title='', type="dropdown",
base_path='', separator='|', _id='', css_class=''):
self.options = options
self.default = default
self.title = title
self.base_path = base_path
self.separator = separator
# add the menu style, but preserve existing css_class parameter
style, base_css_class = menu_style(type)
css_class = base_css_class + ((' ' + css_class) if css_class else '')
# since the menu contains the path info, it's buttons need a
# configuration pass to get them pointing to the proper urls
for opt in self.options:
opt.build(self.base_path)
# add "choice" css class to each button
if opt.css_class:
opt.css_class += " choice"
else:
opt.css_class = "choice"
self.selected = self.find_selected()
Styled.__init__(self, style, _id=_id, css_class=css_class)
示例2: __init__
def __init__(
self,
title,
dest,
sr_path=True,
nocname=False,
aliases=None,
target="",
use_params=False,
css_class="",
data=None,
):
aliases = aliases or []
aliases = set(_force_unicode(a.rstrip("/")) for a in aliases)
if dest:
aliases.add(_force_unicode(dest.rstrip("/")))
self.title = title
self.dest = dest
self.selected = False
self.sr_path = sr_path
self.nocname = nocname
self.aliases = aliases
self.target = target
self.use_params = use_params
self.data = data
Styled.__init__(self, self._style, css_class=css_class)