コード例 #1
0
ファイル: reader-extras.py プロジェクト: rahife/canto-curses
    def edit_extras(self, body, extra_content):
        sel = self.reader.callbacks["get_var"]("reader_item")
        if not sel:
            return

        # If we have the attrs, or are already waiting, bail.
        if self.got_attrs:
            return self._dofuncs(body, extra_content, sel)
        elif self.setup_hook:
            return (body, extra_content)

        item_url = eval(sel.id)["URL"]

        for extra in enabled_extras:
            url_rgx, needed, func = hacks[extra]
            if url_rgx.match(item_url):
                for a in needed:
                    if a not in sel.content and a not in self.needed_attrs:
                        self.needed_attrs.append(a)
                self.do_funcs.append(func)

        if self.needed_attrs != []:
            on_hook("curses_attributes", self.on_attributes)
            tag_updater.request_attributes(sel.id, self.needed_attrs)
            self.setup_hook = True
            return (body, extra_content)
        else:
            self.got_attrs = True
            return self._dofuncs(body, extra_content, sel)
コード例 #2
0
    def edit_extras(self, body, extra_content):
        sel = self.reader.callbacks["get_var"]("reader_item")
        if not sel:
            return

        # If we have the attrs, or are already waiting, bail.
        if self.got_attrs:
            return self._dofuncs(body, extra_content, sel)
        elif self.setup_hook:
            return (body, extra_content)

        item_url = eval(sel.id)["URL"]

        for extra in enabled_extras:
            url_rgx, needed, func = hacks[extra]
            if url_rgx.match(item_url):
                for a in needed:
                    if a not in sel.content and a not in self.needed_attrs:
                        self.needed_attrs.append(a)
                self.do_funcs.append(func)

        if self.needed_attrs != []:
            on_hook("curses_attributes", self.on_attributes)
            tag_updater.request_attributes(sel.id, self.needed_attrs)
            self.setup_hook = True
            return (body, extra_content)
        else:
            self.got_attrs = True
            return self._dofuncs(body, extra_content, sel)
コード例 #3
0
ファイル: reader-extras.py プロジェクト: rahife/canto-curses
    def edit_debug(self, body, extra_content):
        sel = self.reader.callbacks["get_var"]("reader_item")
        if not sel:
            return

        if not self.got_attrs:
            on_hook("curses_attributes", self.on_attributes)
            tag_updater.request_attributes(sel.id, [])
        else:
            extra_content += '\n\n'
            for k in sel.content.keys():
                line = '[%s]: %s' % (k, sel.content[k])
                extra_content += prep_for_display(line) + '\n'

        return(body, extra_content)
コード例 #4
0
    def edit_debug(self, body, extra_content):
        sel = self.reader.callbacks["get_var"]("reader_item")
        if not sel:
            return

        if not self.got_attrs:
            on_hook("curses_attributes", self.on_attributes)
            tag_updater.request_attributes(sel.id, [])
        else:
            extra_content += '\n\n'
            for k in sel.content.keys():
                line = '[%s]: %s' % (k, sel.content[k])
                extra_content += prep_for_display(line) + '\n'

        return (body, extra_content)