本文整理汇总了Python中etgen.html.E.h2方法的典型用法代码示例。如果您正苦于以下问题:Python E.h2方法的具体用法?Python E.h2怎么用?Python E.h2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类etgen.html.E
的用法示例。
在下文中一共展示了E.h2方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: weeklyNavigation
# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import h2 [as 别名]
def weeklyNavigation(cls, obj, ar):
today = obj.date
prev = cls.date2pk(DurationUnits.months.add_duration(today, -1))
next = cls.date2pk(DurationUnits.months.add_duration(today, 1))
elems = cls.calender_header(ar)
header = [
ar.goto_pk(prev, "<<"), " ",
"{} {}".format(monthname(today.month), today.year),
" ", ar.goto_pk(next, ">>")]
elems.append(E.h2(*header, align="center"))
rows = []
for week in CALENDAR.monthdatescalendar(today.year, today.month):
# each week is a list of seven datetime.date objects.
cells = []
current_week = week[0].isocalendar()[1]
cells.append(E.td(str(current_week)))
for day in week:
pk = cls.date2pk(day)
if day.isocalendar()[1] == today.isocalendar()[1]:
cells.append(E.td(str(day.day)))
else:
cells.append(E.td(ar.goto_pk(pk, str(day.day))))
rows.append(E.tr(*cells, align="center"))
elems.append(E.table(*rows, align="center"))
elems.append(E.p(ar.goto_pk(0, gettext("This week")), align="center"))
# for o in range(-10, 10):
# elems.append(ar.goto_pk(o, str(o)))
# elems.append(" ")
return E.div(*elems)
示例2: render_request
# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import h2 [as 别名]
def render_request(self, ar, sar):
"""
Render the given table action
request. `ar` is the incoming request (the one which displays
the dashboard), `sar` is the table we want to show (a child of
`ar`).
This is a helper function for shared use by :class:`ActorItem`
and :class:`RequestItem`.
"""
T = sar.actor
if self.min_count is not None:
if sar.get_total_count() < self.min_count:
# print("20180212 render no rows in ", sar)
return
if self.header_level is not None:
buttons = sar.plain_toolbar_buttons()
buttons.append(
ar.window_action_button(
T.default_action,
label="⏏", # 23CF
style="text-decoration:none;",
title=_("Show this table in own window")))
elems = []
for b in buttons:
elems.append(b)
elems.append(' ')
yield E.h2(str(
sar.actor.get_title_base(sar)), ' ', *elems)
yield sar
示例3: calender_header
# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import h2 [as 别名]
def calender_header(ar):
header = "Calendar Type"
elems = [E.h2(*header, align="center")]
today_url = ar.renderer.js2url("""
Lino.cal.DailyView.detail.run(null, {"record_id": 0})
""")
week_url = ar.renderer.js2url("""
Lino.cal.WeeklyView.detail.run(null, {"record_id": 0})
""")
elems.append(E.p(ar.renderer.href(today_url, gettext("Day")), align="center"))
elems.append(E.p(ar.renderer.href(week_url, gettext("Week")), align="center"))
elems.append(E.p(ar.goto_pk(0, gettext("This month")), align="center"))
return elems
示例4: get_story
# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import h2 [as 别名]
def get_story(cls, self, ar):
"""
Yield a sequence of story items. Every item can be (1) an
ElementTree element or (2) a table or (3) an action request.
"""
# cls.check_params(cls.param_values)
if cls.report_items is None:
raise Exception("{0} has no report_items".format(cls))
for A in cls.report_items:
yield E.h2(str(A.label))
# if A.help_text:
# yield E.p(str(A.help_text))
yield A