本文整理汇总了Python中r2.lib.wrapped.Styled.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Styled.__init__方法的具体用法?Python Styled.__init__怎么用?Python Styled.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类r2.lib.wrapped.Styled
的用法示例。
在下文中一共展示了Styled.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from r2.lib.wrapped import Styled [as 别名]
# 或者: from r2.lib.wrapped.Styled import __init__ [as 别名]
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__
# 需要导入模块: from r2.lib.wrapped import Styled [as 别名]
# 或者: from r2.lib.wrapped.Styled import __init__ [as 别名]
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)