Logo Search packages:      
Sourcecode: zim version File versions  Download package

def zim::gui::pageview::TextBuffer::iter_get_zim_tags (   self,
  iter 
)

Like gtk.TextIter.get_tags() but only returns our own tags and
assumes inline tags (like 'strong', 'emphasis' etc.) have "left gravity".
The "line based" tags (like 'indent', 'h', 'pre') gravitate both ways
(but not at the same time). This method is used to determing which tags
should be applied to newly inserted text at 'iter'.

Definition at line 687 of file pageview.py.

00687                                        :
            '''Like gtk.TextIter.get_tags() but only returns our own tags and
            assumes inline tags (like 'strong', 'emphasis' etc.) have "left gravity".
            The "line based" tags (like 'indent', 'h', 'pre') gravitate both ways
            (but not at the same time). This method is used to determing which tags
            should be applied to newly inserted text at 'iter'.
            '''
            # For example:
            # <indent level=1>foo\n</indent><cursor><indent level=2>bar</indent>
            #     in this case new text should get indent level 2 -> right gravity
            # <indent level=1>foo\n</indent><indent level=2>bar</indent><cursor>\n
            #     in this case new text should also get indent level 2 -> left gravity
            start_tags = set(filter(_is_not_line_based_tag, iter.get_toggled_tags(True)))
            tags = filter(
                  lambda tag: _is_zim_tag(tag) and not tag in start_tags,
                  iter.get_tags() )

            end_tags = filter(_is_zim_tag, iter.get_toggled_tags(False))
            if filter(_is_line_based_tag, tags):
                  # already have a right gravity line-based tag
                  end_tags = filter(_is_not_line_based_tag, end_tags)
            tags.extend(end_tags)

            tags.sort(key=lambda tag: tag.get_priority())
            return tags

      def do_textstyle_changed(self, name):


Generated by  Doxygen 1.6.0   Back to index