How to use the atelier.utils.unindent function in atelier

To help you get started, we’ve selected a few atelier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lino-framework / lino / lino / api / selenium.py View on Github external
def screenshot(self, name, caption, before='', after=''):
        
        filename = self.screenshot_root.child(name)
        if not self.driver.get_screenshot_as_file(filename):
            print("Failed to write {0}".format(filename))
            sys.exit(-1)
        print("Wrote screenshot {0} ...".format(filename))
        before = unindent(before)
        after = unindent(after)
        self.screenshots.append((name, caption, before, after))
github lino-framework / lino / lino / api / selenium.py View on Github external
def screenshot(self, name, caption, before='', after=''):
        
        filename = self.screenshot_root.child(name)
        if not self.driver.get_screenshot_as_file(filename):
            print("Failed to write {0}".format(filename))
            sys.exit(-1)
        print("Wrote screenshot {0} ...".format(filename))
        before = unindent(before)
        after = unindent(after)
        self.screenshots.append((name, caption, before, after))
github lino-framework / lino / lino / sphinxcontrib / actordoc.py View on Github external
def get_actor_description(self):
    """
    `self` is the actor
    """
    body = "\n\n"
    if self.help_text:
        body += unindent(force_text(self.help_text).strip()) + "\n\n"

    #~ ll = self.get_handle().list_layout
    #~ if ll is not None:
        #~ body += fields_table([ e.field for e in ll.main.columns] )

    #~ model_reports = [r for r in kernel.master_tables if r.model is self.model]
    #~ if model_reports:
        #~ body += '\n\nMaster tables: %s\n\n' % rptlist(model_reports)
    #~ if getattr(model,'_lino_slaves',None):
        #~ body += '\n\nSlave tables: %s\n\n' % rptlist(model._lino_slaves.values())

    return body
github lino-framework / lino / lino / utils / diag.py View on Github external
def show_memo_commands(self, doctestfmt=False):
        rst = ""
        mp = settings.SITE.plugins.memo.parser
        items = []
        for cmd, func in sorted(mp.commands.items()):
            doc = unindent(func.__doc__ or '')
            if doc:
                # doc = doc.splitlines()[0]
                items.append(
                    "[{0} ...] : {1}".format(cmd, doc))

        # rst += "\n**Commands**"
        # rst += rstgen.boldheader("Commands")
        rst += rstgen.ul(items)

        if False:
            items = []
            for model, func in sorted(mp.renderers.items()):
                doc = unindent(func.__doc__ or '')
                if doc:
                    items.append(
                        "[{0} ...] : {1}".format(model, doc))
github lino-framework / lino / lino / api / selenium.py View on Github external
def write_index(self):
        index = self.screenshot_root.child('index.rst')
        if self.ref:
            content = ".. _{0}:\n\n".format(self.ref)
        else:
            content = ""
        content += rstgen.header(1, self.title)
        content += "\n\n\n"
        if self.intro:
            content += unindent(self.intro)
            content += "\n\n\n"

        for name, caption, before, after in self.screenshots:
            content += "\n\n"
            content += rstgen.header(2, caption)
            content += """

{before}

.. image:: {name}
    :alt: {caption}
    :width: 500

{after}

""".format(**locals())
github lino-framework / lino / lino / modlib / users / choicelists.py View on Github external
def attach(self, cls):
        super(UserType, self).attach(cls)
        self.kw.setdefault('hidden_languages', cls.hidden_languages)
        if 'remark' not in self.kw:
            s = self.role.__doc__
            if s is not None:
                self.kw['remark'] = unindent(s)

        for k, vf in cls.virtual_fields.items():
            if vf.has_default():
                self.kw.setdefault(k, vf.get_default())
            elif vf.return_type.blank:
                self.kw.setdefault(k, None)

        for k, v in self.kw.items():
            setattr(self, k, v)

        if self.hidden_languages is not None:
            self.hidden_languages = set(
                settings.SITE.resolve_languages(self.hidden_languages))

        del self.kw