当前位置: 首页>>代码示例>>Python>>正文


Python E.div方法代码示例

本文整理汇总了Python中etgen.html.E.div方法的典型用法代码示例。如果您正苦于以下问题:Python E.div方法的具体用法?Python E.div怎么用?Python E.div使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在etgen.html.E的用法示例。


在下文中一共展示了E.div方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: value2html

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
 def value2html(self, ar):
     txt = dd.format_currency(self.value, False, True)
     if self.item.is_heading():
         # return E.b(txt)
         return E.div(E.b(txt), align="right")
     # return txt
     return E.div(txt, align="right")
开发者ID:lino-framework,项目名称:xl,代码行数:9,代码来源:models.py

示例2: get_table_summary

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
    def get_table_summary(self, obj, ar):
        # For every child, we want to display its relationship to
        # every parent of this household.
        sar = self.request(master_instance=obj)
        if sar.master_household is None:
            return E.div(str(ar.no_data_text))
        # obj is the Person for which we display the household

        def format_item(m):
            elems = [str(m.role), ': ']
            if m.person:
                elems += [obj.format_family_member(ar, m.person)]
                hl = self.find_links(ar, m.person, obj)
                if len(hl):
                    elems += [' ('] + hl + [')']
            else:
                elems += [obj.format_family_member(ar, m)]
            return elems
            
        items = []
        for m in sar.data_iterator:
            items.append(E.li(*format_item(m)))
        elems = []
        if len(items) > 0:
            elems = []
            elems.append(E.ul(*items))
        return E.div(*elems)
开发者ID:lino-framework,项目名称:xl,代码行数:29,代码来源:models.py

示例3: f

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
        def f(obj, ar):
            if obj is None or ar is None:
                return E.div()
            try:
                utype = UploadType.objects.get(shortcut=i)
            except UploadType.DoesNotExist:
                return E.div()
            items = []
            target = sender.modules.resolve(i.target)
            sar = ar.spawn_request(
                actor=target,
                master_instance=obj,
                known_values=dict(type=utype))
                # param_values=dict(pupload_type=et))
            n = sar.get_total_count()
            if n == 0:
                iar = target.insert_action.request_from(
                    sar, master_instance=obj)
                btn = iar.ar2button(
                    None, _("Upload"), icon_name="page_add",
                    title=_("Upload a file from your PC to the server."))
                items.append(btn)
            elif n == 1:
                after_show = ar.get_status()
                obj = sar.data_iterator[0]
                items.append(sar.renderer.href_button(
                    sender.build_media_url(obj.file.name),
                    _("show"),
                    target='_blank',
                    icon_name='page_go',
                    style="vertical-align:-30%;",
                    title=_("Open the uploaded file in a "
                            "new browser window")))
                after_show.update(record_id=obj.pk)
                items.append(sar.window_action_button(
                    sar.ah.actor.detail_action,
                    after_show,
                    _("Edit"), icon_name='application_form',
                    title=_("Edit metadata of the uploaded file.")))
            else:
                obj = sar.sliced_data_iterator[0]
                items.append(ar.obj2html(
                    obj, pgettext("uploaded file", "Last")))

                btn = sar.renderer.action_button(
                    obj, sar, sar.bound_action,
                    _("All {0} files").format(n),
                    icon_name=None)
                items.append(btn)

            return E.div(*join_elems(items, ', '))
开发者ID:lino-framework,项目名称:lino,代码行数:53,代码来源:models.py

示例4: get_table_summary

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
    def get_table_summary(self, mi, ar):
        if ar is None:
            return ''
        sar = self.request_from(ar, master_instance=mi)

        def fmt(obj):
            return str(obj)

        elems = []
        for obj in sar:
            # if len(elems) > 0:
            #     elems.append(', ')

            lbl = fmt(obj)
            # if obj.state.button_text:
            #     lbl = "{0}{1}".format(lbl, obj.state.button_text)
            elems.append(ar.obj2html(obj, lbl))
        elems = join_elems(elems, sep=', ')
        toolbar = []
        ar2 = self.insert_action.request_from(sar)
        if ar2.get_permission():
            btn = ar2.ar2button()
            toolbar.append(btn)

        if len(toolbar):
            toolbar = join_elems(toolbar, sep=' ')
            elems.append(E.p(*toolbar))

        return ar.html_text(E.div(*elems))
开发者ID:khchine5,项目名称:xl,代码行数:31,代码来源:models.py

示例5: weeklyNavigation

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [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)
开发者ID:lino-framework,项目名称:xl,代码行数:31,代码来源:ui.py

示例6: description

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
    def description(cls, fld, ar):
        if ar is None:
            return ''
        elems = [fld.help_text, E.br()]
        def x(label, lst, xlst):
            if lst is None:
                return
            spec = ' '.join([i.name or i.value for i in lst])
            if xlst is not None:
                spec += ' ' + ' '.join([
                    "!"+(i.name or i.value) for i in xlst])
            spec = spec.strip()
            if spec:
                elems.extend([label, " ", spec, E.br()])

        x(_("columns"), fld.vat_columns, fld.exclude_vat_columns)
        x(_("regimes"), fld.vat_regimes, fld.exclude_vat_regimes)
        x(_("classes"), fld.vat_classes, fld.exclude_vat_classes)


        elems += [
            fld.__class__.__name__, ' ',
            DCLABELS[fld.dc], 
            "" if fld.both_dc else " only",
            E.br()]

        if fld.observed_fields:
            elems += [
                _("Sum of"), ' ',
                ' '.join([i.name for i in fld.observed_fields]),
                E.br()]

        return E.div(*forcetext(elems))
开发者ID:khchine5,项目名称:xl,代码行数:35,代码来源:choicelists.py

示例7: votable_overview

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
 def votable_overview(self, ar):
     if ar is None or self.votable_id is None:
         return ''
     elems = self.votable.get_overview_elems(ar)
     # elems += [E.br()]
     # # elems += [E.br(), _("{} state:").format(
     # #     self._meta.verbose_name), ' ']
     # elems += self.get_workflow_buttons(ar)
     return E.div(*elems)
开发者ID:lino-framework,项目名称:xl,代码行数:11,代码来源:models.py

示例8: find_appointment

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
 def find_appointment(self, ar):
     if ar is None:
         return ''
     CalendarPanel = rt.models.extensible.CalendarPanel
     elems = []
     for obj in self.coachings_by_client.all():
         sar = CalendarPanel.request(
             subst_user=obj.user, current_project=self.pk)
         elems += [ar.href_to_request(sar, obj.user.username), ' ']
     return E.div(*elems)
开发者ID:khchine5,项目名称:xl,代码行数:12,代码来源:mixins.py

示例9: fmt

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
 def fmt(obj):
     s = tostring(ar.action_button(ba, obj))
     s += fds(obj.created) + " " + obj.created.strftime(
         settings.SITE.time_format_strftime) + " "
     if obj.body:
         s += ar.parse_memo(obj.body)
     else:
         s += ar.parse_memo(obj.subject)
     e = etree.parse(StringIO(s), html_parser)
     return E.li(E.div(*e.iter()))
开发者ID:lino-framework,项目名称:lino,代码行数:12,代码来源:models.py

示例10: show_story

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
    def show_story(self, ar, story, stripped=True, **kwargs):
        """
        Render the given story as an HTML element. Ignore `stripped`
        because it makes no sense in HTML.

        A story is an iterable of things that can be rendered.

        """
        from lino.core.actors import Actor
        from lino.core.tables import TableRequest
        from lino.core.requests import ActionRequest
        elems = []
        try:
            for item in forcetext(story):
                # print("20180907 {}".format(item))
                if iselement(item):
                    elems.append(item)
                elif isinstance(item, type) and issubclass(item, Actor):
                    ar = item.default_action.request(parent=ar)
                    elems.extend(self.table2story(ar, **kwargs))
                elif isinstance(item, TableRequest):
                    assert item.renderer is not None
                    elems.extend(self.table2story(item, **kwargs))
                elif isinstance(item, ActionRequest):
                    # example : courses.StatusReport in dashboard
                    assert item.renderer is not None
                    elems.append(self.show_story(ar, item.actor.get_story(None, ar), **kwargs))
                elif isinstance(item, DashboardItem):
                    elems.append(E.div(
                        self.show_story(ar, item.render(ar), **kwargs),
                        CLASS="dashboard-item " + item.actor.actor_id.replace(".","-") if getattr(item, "actor", False) else ""
                    ))
                elif isiterable(item):
                    elems.append(self.show_story(ar, item, **kwargs))
                    # for i in self.show_story(item, *args, **kwargs):
                    #     yield i
                else:
                    raise Exception("Cannot handle %r" % item)
        except Warning as e:
            elems.append(str(e))
        # print("20180907 show_story in {} : {}".format(ar.renderer, elems))
        return E.div(*elems) if elems else ""
开发者ID:lino-framework,项目名称:lino,代码行数:44,代码来源:renderer.py

示例11: ca_fmt

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
def ca_fmt(ar, ca):
    if ar is None or ca is None:
        return ''
    elems = []
    obj = ca.get_object()
    if obj is None:
        elems.append(gettext("(undefined)"))
    else:
        elems.append(ar.obj2html(obj))
    elems.append(u" ({})".format(ca))
    return E.div(*elems)
开发者ID:lino-framework,项目名称:xl,代码行数:13,代码来源:choicelists.py

示例12: f

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
        def f(obj, ar):
            if ar is None:
                return ''
            if obj is None:
                return E.div()
            try:
                et = ExcerptType.objects.get(shortcut=i)
            except ExcerptType.DoesNotExist:
                return E.div()
            items = []
            if True:
                sar = ar.spawn(
                    ExcerptsByOwner,
                    master_instance=obj,
                    param_values=dict(excerpt_type=et))
                n = sar.get_total_count()
                if n > 0:
                    ex = sar.sliced_data_iterator[0]
                    items.append(ar.obj2html(ex, _("Last")))

                    ba = sar.bound_action
                    btn = sar.renderer.action_button(
                        obj, sar, ba, "%s (%d)" % (_("All"), n),
                        icon_name=None)
                    items.append(btn)

                ia = getattr(obj, et.get_action_name())
                btn = ar.instance_action_button(
                    ia, _("Create"), icon_name=None)
                items.append(btn)

            else:
                ot = ContentType.objects.get_for_model(obj.__class__)
                qs = Excerpt.objects.filter(
                    owner_id=obj.pk, owner_type=ot, excerpt_type=et)
                if qs.count() > 0:
                    ex = qs[0]
                    txt = ExcerptsByOwner.format_excerpt(ex)
                    items.append(ar.obj2html(ex, txt))
            return E.div(*join_elems(items, ', '))
开发者ID:lino-framework,项目名称:xl,代码行数:42,代码来源:models.py

示例13: eid_info

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
    def eid_info(self, ar):
        "Display some information about the eID card."
        attrs = {'class':"lino-info"}
        if ar is None:
            return E.div(**attrs)
        must_read = False
        elems = []
        if self.card_number:
            elems += ["%s %s (%s)" %
                      (ugettext("Card no."), self.card_number, self.card_type)]
            if self.card_issuer:
                elems.append(", %s %s" %
                             (ugettext("issued by"), self.card_issuer))
                #~ card_issuer = _("issued by"),
            if self.card_valid_until is not None:
                valid = ", %s %s %s %s" % (
                    ugettext("valid from"), dd.dtos(self.card_valid_from),
                    ugettext("until"), dd.dtos(self.card_valid_until))
                if self.card_valid_until < dd.today():
                    must_read = True
                    elems.append(E.b(valid))
                    elems.append(E.br())
                else:
                    elems.append(valid)

            else:
                must_read = True
        else:
            must_read = True
        if must_read:
            msg = _("Must read eID card!")
            if dd.plugins.beid:
                elems.append(ar.instance_action_button(
                    self.read_beid, msg, icon_name=None))
            else:
                elems.append(msg)
            # same red as in lino.css for .x-grid3-row-red td
            # ~ attrs.update(style="background-color:#FA7F7F; padding:3pt;")
            attrs['class'] = "lino-info-red"
        return E.div(*elems, **attrs)
开发者ID:khchine5,项目名称:xl,代码行数:42,代码来源:mixins.py

示例14: get_table_summary

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
    def get_table_summary(self, obj, ar):
        if ar is None:
            return ''
        elems = []

        # Button for starting a session from ticket
        sar = obj.start_session.request_from(ar)
        # if ar.renderer.is_interactive and sar.get_permission():
        # if sar.get_permission():
        #     btn = sar.ar2button(obj)
        #     elems += [E.p(btn)]

        # Active sessions:
        active_sessions = []
        session_summaries = E.ul()
        qs = rt.models.working.Session.objects.filter(ticket=obj)
        tot = Duration()
        for ses in qs:
            d = ses.get_duration()
            if d is not None:
                tot += d
            if ses.end_time is None:
                txt = "{0} since {1}".format(ses.user, ses.start_time)
                lnk = ar.obj2html(ses, txt)
                sar = ses.end_session.request_from(ar)
                if sar.get_permission():
                    lnk = E.span(lnk, " ", sar.ar2button(ses))
                active_sessions.append(lnk)
            if ses.summary:
                session_summaries.insert(0,
                    E.li(
                        "%s %s: %s"%(ses.user,
                                     naturaltime(datetime.combine(
                                                 ses.start_date, ses.start_time))
                                     ,ses.summary)
                    )
                )


        # elems.append(E.p(_("Total {0} hours.").format(tot)))
        elems.append(E.p(_("Total %s hours.") % tot))

        if len(active_sessions) > 0:
            elems.append(E.p(
                ensureUtf(_("Active sessions")), ": ",
                *join_elems(active_sessions, ', ')))
        if len(session_summaries) > 0:
            elems.append(session_summaries)

        return ar.html_text(E.div(*elems))
开发者ID:lino-framework,项目名称:xl,代码行数:52,代码来源:ui.py

示例15: description_print

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import div [as 别名]
 def description_print(cls, self, ar):
     elems = body_subject_to_elems(ar, self.title, self.description)
     # dd.logger.info("20160511a %s", cls)
     if cls.include_qty_in_description:
         if self.qty != 1:
             elems += [
                 " ",
                 _("({qty}*{unit_price}/{unit})").format(
                     qty=self.quantity,
                     unit=self.product.delivery_unit,
                     unit_price=self.unit_price)]
     e = E.div(*elems)
     # dd.logger.info("20160704d %s", tostring(e))
     return e
开发者ID:khchine5,项目名称:xl,代码行数:16,代码来源:models.py


注:本文中的etgen.html.E.div方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。