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


Python E.br方法代码示例

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


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

示例1: description

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [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

示例2: what

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
 def what(self, obj, ar):
     chunks = []
     if obj.name:
         chunks += [E.b(str(obj)), E.br()]
     chunks += sepjoin(obj.features.all())
     #~ if obj.url:
         #~ chunks += [E.br(),E.a(_("More"),href=obj.url)]
     return E.p(*chunks)
开发者ID:lino-framework,项目名称:xl,代码行数:10,代码来源:models.py

示例3: x

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

示例4: body_subject_to_elems

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
def body_subject_to_elems(ar, title, description):
    """
    Convert the given `title` and `description` to a list of HTML
    elements.

    Used by :mod:`lino.modlib.notify` and by :mod:`lino_xl.lib.sales`
    """
    if description:
        elems = [E.p(E.b(title), E.br())]
        elems += rich_text_to_elems(ar, description)
        
    else:
        elems = [E.b(title)]
        # return E.span(self.title)
    return elems
开发者ID:lino-framework,项目名称:lino,代码行数:17,代码来源:bleached.py

示例5: get_overview_elems

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
 def get_overview_elems(self, ar):
     elems = []
     buttons = self.get_mti_buttons(ar)
     # buttons = join_elems(buttons, ', ')
     elems.append(E.p(str(_("See as ")), *buttons,
                      style="font-size:8px;text-align:right;padding:3pt;"))
     elems += self.get_name_elems(ar)
     elems.append(E.br())
     elems += join_elems(list(self.address_location_lines()), sep=E.br)
     elems = [
         E.div(*forcetext(elems),
               style="font-size:18px;font-weigth:bold;"
               "vertical-align:bottom;text-align:middle")]
     elems += AddressOwner.get_overview_elems(self, ar)
     elems += ContactDetailsOwner.get_overview_elems(self, ar)
     return elems
开发者ID:khchine5,项目名称:xl,代码行数:18,代码来源:models.py

示例6: get_table_summary

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
 def get_table_summary(self, obj, ar):
     sar = self.request_from(ar, master_instance=obj)
     items = []
     for c in sar:
         # todo have another js button that will expand the summary
         # into the complete description.
         items.append(E.li(
             E.a(c.sha[:6], href=c.url, target="_BLANK"),
             ":" if c.user else "",
             ar.obj2html(c.user) if c.user else "",
             ":",
             ar.obj2html(
                 c, naturaltime(c.created),
                 title=c.created.strftime('%Y-%m-%d %H:%M')),
             E.br(), c.summary))
     return E.ul(*items)
开发者ID:lino-framework,项目名称:xl,代码行数:18,代码来源:desktop.py

示例7: welcome_messages

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
def welcome_messages(ar):
    """Yield messages for the welcome page."""
    #todo show all users active sessions

    Session = rt.models.working.Session
    # Ticket = rt.models.tickets.Ticket
    # TicketStates = rt.models.tickets.TicketStates
    me = ar.get_user()

    # your open sessions (i.e. those you are busy with)
    qs = Session.objects.filter(end_time__isnull=True)
    working = {me:[E.b(six.text_type(_("You are busy with ")))]}
    if qs.count() == 0:
        return
    for ses in qs:
        if ses.user not in working:
            working[ses.user] = [ar.obj2html(ses.user),
                                 gettext(" is working on: ")]
        txt = six.text_type(ses.ticket)
        working[ses.user].append(
            ar.obj2html(ses.ticket, txt, title=getattr(ses.ticket,'summary',"") or
                                               getattr(ses.ticket,'name',"")))

        if ses.user == me:
            working[ses.user] += [
                ' (',
                ar.instance_action_button(
                    ses.end_session, EndTicketSession.label),
                ')']
        working[ses.user].append(', ')

    if len(working[me]) > 1:

        working[me][-1] = working[me][-1].replace(", ", ".")
        result = E.p(*working.pop(me))
    else:
        result = E.p()
        working.pop(me)
    for u, s in working.items():
        if len(result):
            result.append(E.br())
        s[-1] = s[-1].replace(", ", ".")
        result.append(E.span(*s))
    yield result
开发者ID:lino-framework,项目名称:xl,代码行数:46,代码来源:models.py

示例8: get_table_summary

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
    def get_table_summary(self, obj, ar):
        sar = self.request(master_instance=obj)
        elems = []
        # n = sar.get_total_count()
        # if n == 0:
        #     elems += [_("Not member of any household."), E.br()]
        # else:

        items = []
        for m in sar.data_iterator:
            
            args = (str(m.role), gettext(" in "),
                    ar.obj2html(m.household))
            if m.primary:
                items.append(E.li(E.b("\u2611 ", *args)))
            else:
                btn = m.set_primary.as_button_elem(
                    ar, "\u2610 ", style="text-decoration:none;")
                items.append(E.li(btn, *args))
        if len(items) > 0:
            elems += [gettext("%s is") % obj]
            elems.append(E.ul(*items))

        if self.insert_action is not None:
            sar = self.insert_action.request_from(ar)
            if sar.get_permission():
                elems.append(E.br())
                sar.known_values.update(person=obj)
                # sar.known_values.pop('child', None)
                elems += [
                    sar.ar2button(
                        None, gettext("Join an existing household"), icon_name=None),
                    " ", gettext("or"), " ",
                    ar.instance_action_button(
                        obj.create_household,
                        gettext("create a new one")),
                    # " ",
                    # rt.models.households.Household._meta.verbose_name,
                    "."]
            
        return E.div(*elems)
开发者ID:lino-framework,项目名称:xl,代码行数:43,代码来源:models.py

示例9: get_table_summary

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
    def get_table_summary(self, obj, ar):
        chunks = []
        for other in ar.spawn(self, master_instance=obj):
            chunks.append(ar.obj2html(other))

        # sar = WordsByOwner.default_action.request_from(
        #     ar, master_instance=obj)
        # if sar.get_permission():
        #     if len(chunks):
        #         chunks.append(E.br())
        #     s = getattr(obj, obj.dupable_words_field)
        #     words = ' '.join(obj.get_dupable_words(s))
        #     label = "({0})".format(words)
        #     btn = sar.ar2button(label=label)
        #     chunks.append(btn)
        if len(chunks):
            chunks.append(E.br())
        s = getattr(obj, obj.dupable_words_field)
        words = ' '.join(obj.get_dupable_words(s))
        chunks.append("({0})".format(words))
        return E.p(*join_elems(chunks))
开发者ID:lino-framework,项目名称:lino,代码行数:23,代码来源:models.py

示例10: eid_info

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [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

示例11: get_table_summary

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
    def get_table_summary(self, obj, ar):

        elems = []
        sar = self.request(master_instance=obj)
        # elems += ["Partner:", unicode(ar.master_instance)]
        for voucher in sar:
            vc = voucher.get_mti_leaf()
            if vc and vc.state.name == "draft":
                elems += [ar.obj2html(vc), " "]

        vtypes = []
        for vt in VoucherTypes.items():
            if issubclass(vt.model, self._voucher_base):
                vtypes.append(vt)

        actions = []

        def add_action(btn):
            if btn is None:
                return False
            actions.append(btn)
            return True

        if not ar.get_user().user_type.readonly:
            flt = {self._master_field_name: obj}
            for vt in vtypes:
                for jnl in vt.get_journals():
                    sar = vt.table_class.insert_action.request_from(
                        ar, master_instance=jnl,
                        known_values=flt)
                    btn = sar.ar2button(label=str(jnl), icon_name=None)
                    if len(actions):
                        actions.append(', ')
                    actions.append(btn)

            elems += [E.br(), str(_("Create voucher in journal")), " "] + actions
        return E.div(*elems)
开发者ID:khchine5,项目名称:xl,代码行数:39,代码来源:mixins.py

示例12: get_name_elems

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
 def get_name_elems(self, ar):
     elems = [self.get_salutation(nominative=True), ' ',
              self.prefix, E.br()]
     elems += [self.first_name, ' ', E.b(self.last_name)]
     return elems
开发者ID:lino-framework,项目名称:xl,代码行数:7,代码来源:models.py

示例13: get_change_info

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
 def get_change_info(self, ar, cw):
     yield E.p(
         gettext("Subject"), ': ', self.subject,
         E.br(), gettext("Client"), ': ', ar.obj2memo(self.project))
开发者ID:lino-framework,项目名称:xl,代码行数:6,代码来源:models.py

示例14: get_table_summary

# 需要导入模块: from etgen.html import E [as 别名]
# 或者: from etgen.html.E import br [as 别名]
    def get_table_summary(self, obj, ar):
        """The :meth:`summary view <lino.core.actors.Actor.get_table_summary>`
        for :class:`LinksByTicket`.

        """
        # if obj.pk is None:
        #     return ''
        #     raise Exception("20150218")
        sar = self.request_from(ar, master_instance=obj)
        links = []
        for lnk in sar:
            if lnk.parent is None or lnk.child is None:
                pass
            else:
                if lnk.child_id == obj.id:
                    i = (lnk.type.as_child(), lnk.parent)
                else:
                    i = (lnk.type.as_parent(), lnk.child)
                links.append(i)

        def by_age(a):
            return a[1].modified

        try:
            links.sort(key=by_age)
        # except AttributeError:
        except (AttributeError, ValueError):
            # AttributeError: 'str' object has no attribute 'as_date'
            # possible when empty birth_date
            # ValueError: day is out of range for month
            pass

        tbt = dict()  # tickets by lnktype
        for lnktype, other in links:
            lst = tbt.setdefault(lnktype, [])
            # txt = "#%d" % other.id
            lst.append(other.obj2href(ar))

        items = []
        for lnktype, lst in tbt.items():
            items.append(E.li(unicode(lnktype), ": ", *join_elems(lst, ', ')))
        elems = []
        if len(items) > 0:
            # elems += join_elems(items)
            # elems.append(l(*items))
            elems.append(E.ul(*items))
        # else:
        #     elems.append(_("No dependencies."))

        # Buttons for creating relationships:

        sar = obj.spawn_triggered.request_from(ar)
        if ar.renderer.is_interactive and sar.get_permission():
            btn = sar.ar2button(obj)
            elems += [E.br(), btn]

        if self.insert_action is not None and ar.renderer.is_interactive:
            sar = self.insert_action.request_from(ar)
            if sar.get_permission():
                actions = []
                for lt in LinkTypes.objects():
                    actions.append(E.br())
                    sar.known_values.update(type=lt, parent=obj)
                    sar.known_values.pop('child', None)
                    btn = sar.ar2button(None, lt.as_parent(), icon_name=None)
                    if not lt.symmetric:
                        # actions.append('/')
                        sar.known_values.update(type=lt, child=obj)
                        sar.known_values.pop('parent', None)
                        btn2 = sar.ar2button(None, lt.as_child(), icon_name=None)
                        # actions.append(btn)
                        btn = E.span(btn, '/', btn2)
                    actions.append(btn)
                    # actions.append(' ')
                # actions = join_elems(actions, E.br)

                if len(actions) > 0:
                    elems += [E.br(), _("Create dependency as ")] + actions
        return E.div(*elems)
开发者ID:khchine5,项目名称:xl,代码行数:81,代码来源:ui.py


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