本文整理汇总了Python中r2.lib.wrapped.Wrapped.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Wrapped.__init__方法的具体用法?Python Wrapped.__init__怎么用?Python Wrapped.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类r2.lib.wrapped.Wrapped
的用法示例。
在下文中一共展示了Wrapped.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from r2.lib.wrapped import Wrapped [as 别名]
# 或者: from r2.lib.wrapped.Wrapped import __init__ [as 别名]
def __init__(self, space_compress = True, nav_menus = None, loginbox = True,
infotext = '', content = None, title = '', robots = None,
show_sidebar = True, **context):
Wrapped.__init__(self, **context)
self.title = title
self.robots = robots
self.infotext = infotext
self.loginbox = True
self.show_sidebar = show_sidebar
self.space_compress = space_compress
#put the sort menus at the top
self.nav_menu = MenuArea(menus = nav_menus) if nav_menus else None
#add the infobar
self.infobar = None
if c.firsttime and c.site.firsttext and not infotext:
infotext = c.site.firsttext
if infotext:
self.infobar = InfoBar(message = infotext)
self.srtopbar = None
if not c.cname:
self.srtopbar = SubredditTopBar()
if c.user_is_loggedin and self.show_sidebar:
self._content = PaneStack([ShareLink(), content])
else:
self._content = content
self.toolbars = self.build_toolbars()
示例2: __init__
# 需要导入模块: from r2.lib.wrapped import Wrapped [as 别名]
# 或者: from r2.lib.wrapped.Wrapped import __init__ [as 别名]
def __init__(self, sr = None, link = None, listing = '',
timedeltatext = '', *a, **kw):
Wrapped.__init__(self, sr = sr, link = link,
datefmt = datefmt,
timedeltatext = timedeltatext,
listing = listing,
*a, **kw)
示例3: __init__
# 需要导入模块: from r2.lib.wrapped import Wrapped [as 别名]
# 或者: from r2.lib.wrapped.Wrapped import __init__ [as 别名]
def __init__(self, space_compress = True, nav_menus = None, loginbox = True,
infotext = '', content = None, title = '', robots = None,
show_sidebar = True, body_class = None, **context):
Wrapped.__init__(self, **context)
self.title = title
self.robots = robots
self.infotext = infotext
self.loginbox = True
self.show_sidebar = show_sidebar
self.space_compress = space_compress
self.body_class = body_class
#put the sort menus at the top
self.nav_menu = MenuArea(menus = nav_menus) if nav_menus else None
#add the infobar
self.infobar = None
if c.firsttime and c.site.firsttext and not infotext:
infotext = c.site.firsttext
if not infotext and hasattr(c.site, 'infotext'):
infotext = c.site.infotext
if infotext:
self.infobar = InfoBar(message = infotext)
self.srtopbar = None
if not c.cname:
self.srtopbar = SubredditTopBar()
self._content = content
self.toolbars = self.build_toolbars()
示例4: __init__
# 需要导入模块: from r2.lib.wrapped import Wrapped [as 别名]
# 或者: from r2.lib.wrapped.Wrapped import __init__ [as 别名]
def __init__(self, space_compress = True, nav_menus = None, loginbox = True,
infotext = '', content = None, title = '', show_sidebar = True,
**context):
Wrapped.__init__(self, **context)
self.title = title
self.infotext = infotext
self.loginbox = True
self.show_sidebar = show_sidebar
self.space_compress = space_compress
#put the sort menus at the top
self.nav_menu = MenuArea(menus = nav_menus) if nav_menus else None
#add the infobar
self.infobar = None
if c.firsttime and c.site.firsttext and not infotext:
infotext = c.site.firsttext
if infotext:
self.infobar = InfoBar(message = infotext)
#c.subredditbox is set by VSRMask
self.subreddit_sidebox = False
if c.subreddit_sidebox:
self.subreddit_sidebox = True
self.subreddit_checkboxes = c.site == Default
self._content = content
self.toolbars = self.build_toolbars()
示例5: __init__
# 需要导入模块: from r2.lib.wrapped import Wrapped [as 别名]
# 或者: from r2.lib.wrapped.Wrapped import __init__ [as 别名]
def __init__(self, *args, **kwargs):
from r2.lib.user_stats import top_users
uids = top_users()
# Returns a hash keyed in the uid
users = Account._byID(uids, data=True)
# Retrieve the Account objects in this way to preseve the sort order
all_users = (users[u] for u in uids)
# Filter out banned and spammy accounts
self.things = filter(lambda user: not c.site.is_banned(user) and user.spammer < 1, all_users)
Wrapped.__init__(self, *args, **kwargs)