class documentation

class TextBuffer(Gtk.TextBuffer): (source)

View In Hierarchy

Method __init__ Constructor
Method append_parsetree Append a ParseTree to the buffer
Method clear Undocumented
Method copy_clipboard Copy current selection to a clipboard
Method cut_clipboard Cut current selection to a clipboard
Method do_begin_insert_tree Undocumented
Method do_end_insert_tree Undocumented
Method do_end_user_action Undocumented
Method do_insert_child_anchor Undocumented
Method do_insert_pixbuf Undocumented
Method do_insert_text Signal handler for insert-text signal
Method do_mark_set Undocumented
Method do_post_delete_range Undocumented
Method do_pre_delete_range Undocumented
Method find_anchor Searches the current page for an anchor with the requested name.
Method find_implicit_anchor No summary
Method foreach_line_in_selection Convenience function to call a function for each line that is currently selected
Method get_anchor_data Undocumented
Method get_anchor_for_location No summary
Method get_anchor_or_object_id Undocumented
Method get_bullet Get the bullet type on a specific line, if any
Method get_bullet_at_iter Return the bullet type in a specific location
Method get_has_link_selection Check whether a link is selected or not @returns: link attributes when succcessful, None otherwise
Method get_has_selection Check if there is a selection
Method get_image_data Get the attributes for an image at a specific position, if any
Method get_indent Get the indent level for a specific line
Method get_indent_at_cursor Get the indent level at the cursor
Method get_insert_iter Get a Gtk.TextIter for the current cursor position
Method get_iter_at_line No summary
Method get_line_bounds Get the TextIters at start and end of line
Method get_line_is_empty Check for empty lines
Method get_link_data Get the link attributes for a link at a specific position, if any
Method get_link_tag Get the Gtk.TextTag for a link at a specific position, if any
Method get_link_text Undocumented
Method get_objectanchor Undocumented
Method get_objectanchor_at_cursor Undocumented
Method get_parsetree Get a ParseTree representing the buffer contents
Method get_tag Get the Gtk.TextTag for a zim type at a specific position, if any
Method get_tag_bounds Undocumented
Method get_tag_data Get the attributes for a tag at a specific position, if any
Method get_tag_tag Get the Gtk.TextTag for a tag at a specific position, if any
Method get_tag_text Undocumented
Method get_textstyles Get the name of the formatting style that will be applied to newly inserted text
Method indent Increase the indent for a given line
Method insert_anchor Insert a "link anchor" with id name at iter
Method insert_anchor_at_cursor Insert a "link anchor" with id name
Method insert_child_anchor Undocumented
Method insert_image Insert an image in the buffer
Method insert_image_at_cursor Insert an image in the buffer
Method insert_link Insert a link into the buffer
Method insert_link_at_cursor Insert a link into the buffer
Method insert_object_at_cursor No summary
Method insert_object_model_at_cursor Undocumented
Method insert_objectanchor Undocumented
Method insert_objectanchor_at_cursor Undocumented
Method insert_parsetree Insert a ParseTree in the buffer
Method insert_parsetree_at_cursor Insert a ParseTree in the buffer
Method insert_pixbuf Undocumented
Method insert_tag Insert a tag into the buffer
Method insert_tag_at_cursor Insert a tag into the buffer
Method iter_anchors_for_range Undocumented
Method iter_backward_word_start No summary
Method iter_forward_past_bullet Move an TextIter past a bullet
Method iter_forward_word_end No summary
Method iter_get_zim_tags Replacement for Gtk.TextIter.get_tags() which returns zim specific tags
Method iter_in_selection Check if a specific TextIter is within the selection
Method list_objectanchors Undocumented
Method paste_clipboard Paste data from a clipboard into the buffer
Method range_has_tag Check if a certain TextTag appears anywhere in a range
Method range_has_tags No summary
Method remove_link Removes any links between in a range
Method remove_textstyle_tags Removes all format style TexTags from a range
Method renumber_list Renumber list from this line downward
Method renumber_list_after_indent Like renumber_list(), but more complex rules because indent change has different heuristics.
Method select_line Selects a line @param line: line number; if None current line will be selected @returns: True when successful
Method select_lines No summary
Method select_link Selects the current link, if any @returns: link attributes when succcessful, None otherwise
Method select_word Selects the current word, if any
Method set_bullet Sets the bullet type for a line
Method set_indent Set the indenting for a specific line.
Method set_parsetree Load a new ParseTree in the buffer
Method set_textstyles Sets the current text format style.
Method smart_remove_tags This method removes tags over a range based on a function
Method strip_selection Shrinks the selection to exclude any whitespace on start and end. If only white space was selected this function will not change the selection. @returns: True when this function changed the selection.
Method tmp_cursor Get a SaveCursorContext object
Method toggle_checkbox Toggles the state of the checkbox at a specific line, if any
Method toggle_checkbox_for_cursor_or_selection Like toggle_checkbox() but applies to current line or current selection. Intended for interactive use.
Method toggle_textstyle Toggle the current textstyle
Method unindent Decrease the indent level for a given line
Method unset_selection Remove any selection in the buffer
Method update_editmode Updates the text style and indenting applied to newly indented text based on the current cursor position
Method update_indent_tag Update the indent TextTag for a given line
Method whole_range_has_tag Check if a certain TextTag is applied to the whole range or not
Class Variable __gsignals__ Undocumented
Class Variable pixels_indent Undocumented
Class Variable tag_attributes Undocumented
Class Variable tag_styles Undocumented
Instance Variable finder Undocumented
Instance Variable notebook Undocumented
Instance Variable page Undocumented
Instance Variable showing_template Undocumented
Instance Variable undostack Undocumented
Instance Variable user_action Undocumented
Property hascontent Undocumented
Method _create_link_tag Creates an anonymouse TextTag for a link
Method _create_tag_tag Creates an anonymous TextTag for a tag
Method _do_lines_merged Undocumented
Method _find_base_dir Undocumented
Method _fix_pre_selection Undocumented
Method _get_bullet_at_iter Undocumented
Method _get_close_anchor_or_object_id Undocumented
Method _get_heading_text Undocumented
Method _get_implict_anchor_if_heading Undocumented
Method _get_indent_tag Undocumented
Method _insert_bullet_at_cursor No summary
Method _insert_element_children Undocumented
Method _insert_table_element_at_cursor Undocumented
Method _iter_forward_past_bullet Undocumented
Method _remove_indent Undocumented
Method _renumber_list Undocumented
Method _replace_bullet Undocumented
Method _search_bullet Undocumented
Method _set_indent Undocumented
Method _sort_nesting_style_tags Undocumented
Method _split_nesting_style_tags Undocumented
Class Variable _nesting_style_tags Undocumented
Class Variable _static_style_tags Undocumented
Class Variable _static_tag_after_tags Undocumented
Class Variable _static_tag_before_links Undocumented
Instance Variable _check_renumber Undocumented
Instance Variable _deleted_editmode_mark Undocumented
Instance Variable _deleted_line_end Undocumented
Instance Variable _editmode_tags Undocumented
Instance Variable _insert_tree_in_progress Undocumented
Instance Variable _renumbering Undocumented
def __init__(self, notebook, page, parsetree=None): (source)
Constructor
Parameters
notebooka Notebook object
pagea Page object
parsetreeoptional ParseTree object, if given this will initialize the buffer content *before* initializing the undostack
def append_parsetree(self, tree, interactive=False): (source)

Append a ParseTree to the buffer

Like insert_parsetree() but inserts at the end of the current buffer.

def clear(self): (source)

Undocumented

def copy_clipboard(self, clipboard, format='plain'): (source)
Copy current selection to a clipboard
Parameters
clipboarda Clipboard object
formata format name
def cut_clipboard(self, clipboard, default_editable): (source)

Cut current selection to a clipboard

First copies the selection to the clipboard and then deletes the selection in the buffer.

Parameters
clipboarda Clipboard object
default_editabledefault state of the TextView
def do_begin_insert_tree(self, interactive): (source)

Undocumented

def do_end_insert_tree(self): (source)

Undocumented

def do_end_user_action(self): (source)

Undocumented

def do_insert_child_anchor(self, iter, anchor): (source)

Undocumented

def do_insert_pixbuf(self, iter, pixbuf): (source)

Undocumented

def do_insert_text(self, iter, string, length): (source)
Signal handler for insert-text signal
def do_mark_set(self, iter, mark): (source)

Undocumented

def do_post_delete_range(self, start, end): (source)

Undocumented

def do_pre_delete_range(self, start, end): (source)

Undocumented

def find_anchor(self, name): (source)

Searches the current page for an anchor with the requested name.

Explicit anchors are being searched with precedence over implicit anchors derived from heading elements.

Parameters
namethe name of the anchor to look for
Returns
a Gtk.TextIter pointing to the start of the heading or None.
def find_implicit_anchor(self, name): (source)
Search the current page for a heading who's derived (implicit) anchor name is matching the provided parameter.
Parameters
namethe name of the anchor
Returns
a Gtk.TextIter pointing to the start of the heading or None.
def foreach_line_in_selection(self, func, *args, **kwarg): (source)
Convenience function to call a function for each line that is currently selected
Parameters
func

function which will be called as:

        func(line, *args, **kwargs)

where line is the line number

*argsadditional argument for func
**kwargadditional keyword argument for func
Returns
False if there is no selection, True otherwise
def get_anchor_data(self, iter): (source)

Undocumented

def get_anchor_for_location(self, iter): (source)
Returns an anchor name that refers to iter or the same line Uses iter to return id of explicit anchor on the same line closest to iter. If no explicit anchor is found and iter is within a heading line, the implicit anchor for the heading is returned.
Parameters
iterthe location to refer to
Returns
an anchor name if any anchor object or heading is found, else None
def get_anchor_or_object_id(self, iter): (source)

Undocumented

def get_bullet(self, line): (source)
Get the bullet type on a specific line, if any
Parameters
linethe line number
Returns

the bullet type, if any, or None. The bullet type can be any of:

                BULLET
                UNCHECKED_BOX
                CHECKED_BOX
                XCHECKED_BOX
                MIGRATED_BOX
                TRANSMIGRATED_BOX

or a numbered list bullet (test with is_numbered_bullet_re)

def get_bullet_at_iter(self, iter): (source)

Return the bullet type in a specific location

Like get_bullet()

Parameters
itera Gtk.TextIter
Returns
a bullet type, or None
def get_has_link_selection(self): (source)
Check whether a link is selected or not
Returns
link attributes when succcessful, None otherwise
def get_has_selection(self): (source)

Check if there is a selection

Method available in Gtk.TextBuffer for gtk version >= 2.10 reproduced here for backward compatibility.

Returns
True when there is a selection
def get_image_data(self, iter): (source)
Get the attributes for an image at a specific position, if any
Parameters
itera Gtk.TextIter object
Returns
a dict with image properties or None
def get_indent(self, line): (source)
Get the indent level for a specific line
Parameters
linethe line number
Returns
a number for the indenting level
def get_indent_at_cursor(self): (source)
Get the indent level at the cursor
Returns
a number for the indenting level
def get_insert_iter(self): (source)
Get a Gtk.TextIter for the current cursor position
def get_iter_at_line(self, line): (source)
Like Gtk.TextBuffer.get_iter_at_line() but with additional safety check
Parameters
linean integer line number counting from 0
Returns
a Gtk.TextIter
Raises
ValueErrorwhen line is not within the buffer
def get_line_bounds(self, line): (source)
Get the TextIters at start and end of line
Parameters
linethe line number
Returns
a 2-tuple of Gtk.TextIter for start and end of the line
def get_line_is_empty(self, line): (source)
Check for empty lines
Parameters
linethe line number
Returns
True if the line only contains whitespace
def get_link_data(self, iter, raw=False): (source)
Get the link attributes for a link at a specific position, if any
Parameters
itera Gtk.TextIter
rawUndocumented
Returns
a dict with link properties if there is a link at iter, None otherwise
def get_link_tag(self, iter): (source)
Get the Gtk.TextTag for a link at a specific position, if any
Parameters
itera Gtk.TextIter
Returns
a Gtk.TextTag if there is a link at iter, None otherwise
def get_link_text(self, iter): (source)

Undocumented

def get_objectanchor(self, iter): (source)

Undocumented

def get_objectanchor_at_cursor(self): (source)

Undocumented

def get_parsetree(self, bounds=None, raw=False): (source)
Get a ParseTree representing the buffer contents
Parameters
boundsa 2-tuple with two Gtk.TextIter specifying a range in the buffer (e.g. current selection). If None the whole buffer is returned.
raw

if True you get a tree that is not nicely cleaned up. This raw tree should result in the exact same contents in the buffer when reloaded. However such a 'raw' tree may cause problems when passed to one of the format modules. So it is intended only for internal use between the buffer and e.g. the UndoStackManager.

Raw parsetrees have an attribute to flag them as a raw tree, so on insert we can make sure they are inserted in the same way.

When raw is False reloading the same tree may have subtle differences.

Returns
a ParseTree object
def get_tag(self, iter, type): (source)
Get the Gtk.TextTag for a zim type at a specific position, if any
Parameters
itera Gtk.TextIter
typethe zim type to look for ('style', 'link', 'tag', 'indent', 'anchor')
Returns
a Gtk.TextTag if there is a tag at iter, None otherwise
def get_tag_bounds(self, iter, tag): (source)

Undocumented

def get_tag_data(self, iter): (source)
Get the attributes for a tag at a specific position, if any
Parameters
itera Gtk.TextIter
Returns
a dict with tag properties if there is a link at iter, None otherwise
def get_tag_tag(self, iter): (source)
Get the Gtk.TextTag for a tag at a specific position, if any
Parameters
itera Gtk.TextIter
Returns
a Gtk.TextTag if there is a tag at iter, None otherwise
def get_tag_text(self, iter, tag): (source)

Undocumented

def get_textstyles(self): (source)

Get the name of the formatting style that will be applied to newly inserted text

This style may change as soon as the cursor position changes, so only relevant for current cursor position.

def indent(self, line, interactive=False): (source)

Increase the indent for a given line

Can be used as function for foreach_line_in_selection().

Parameters
linethe line number
interactivehint if indenting is result of user interaction, or automatic action
Returns
True if successful
def insert_anchor(self, iter, name, **attrib): (source)
Insert a "link anchor" with id name at iter
def insert_anchor_at_cursor(self, name): (source)
Insert a "link anchor" with id name
def insert_child_anchor(self, iter, anchor): (source)

Undocumented

def insert_image(self, iter, file, src, **attrib): (source)
Insert an image in the buffer
Parameters
itera Gtk.TextIter for the insert position
filea File object or a absolute file path or URI, if None the file will be resolved based on src relative to the notebook and page
src

the file path the show to the user

If the image is e.g. specified in the page source as a relative link, file should give the absolute path the link resolves to, while src gives the relative path.

**attribany other image properties
def insert_image_at_cursor(self, file, src, **attrib): (source)

Insert an image in the buffer

Like insert_image() but inserts at the current cursor position

Parameters
filea File object or a file path or URI
srcthe file path the show to the user
**attribany other image properties
def insert_link(self, iter, text, href, **attrib): (source)
Insert a link into the buffer
Parameters
itera Gtk.TextIter for the insert position
textthe text for the link as string
hrefthe target (URL, pagename) of the link as string
**attribany other link attributes
def insert_link_at_cursor(self, text, href=None, **attrib): (source)

Insert a link into the buffer

Like insert_link() but inserts at the current cursor position

Parameters
textthe text for the link as string
hrefthe target (URL, pagename) of the link as string
**attribany other link attributes
def insert_object_at_cursor(self, attrib, data, raw=False): (source)
Inserts a custom object in the page
Parameters
attribdict with object attributes
datastring data of object
rawboolean for "raw" parsetree insert
def insert_object_model_at_cursor(self, objecttype, model, raw=False): (source)

Undocumented

def insert_objectanchor(self, iter, anchor): (source)

Undocumented

def insert_objectanchor_at_cursor(self, anchor): (source)

Undocumented

def insert_parsetree(self, iter, tree, interactive=False): (source)

Insert a ParseTree in the buffer

This method inserts a parsetree at a specific place in the buffer.

Parameters
itera Gtk.TextIter for the insert position
treea ParseTree object
interactive

Boolean which determines how current state in the buffer is handled. If not interactive we break any existing tags and insert the tree, otherwise we insert using the formatting tags that that are present at iter.

For example when a parsetree is inserted because the user pastes content from the clipboard interactive should be True.

def insert_parsetree_at_cursor(self, tree, interactive=False): (source)

Insert a ParseTree in the buffer

Like insert_parsetree() but inserts at the current cursor position.

Parameters
treea ParseTree object
interactiveBoolean which determines how current state in the buffer is handled.
def insert_pixbuf(self, iter, pixbuf): (source)

Undocumented

def insert_tag(self, iter, text, **attrib): (source)

Insert a tag into the buffer

Insert a tag in the buffer (not a TextTag, but a tag like "@foo")

Parameters
itera Gtk.TextIter object
textThe text for the tag
**attribany other tag attributes
def insert_tag_at_cursor(self, text, **attrib): (source)

Insert a tag into the buffer

Like insert_tag() but inserts at the current cursor position

Parameters
textThe text for the tag
**attribany other tag attributes
def iter_anchors_for_range(self, start, end): (source)

Undocumented

def iter_backward_word_start(self, iter): (source)
Like Gtk.TextIter.backward_word_start() but less intelligent. This method does not take into account the language or punctuation and just skips to either the last whitespace or the beginning of line.
Parameters
itera Gtk.TextIter, the position of this iter will be modified
Returns
True when successful
def iter_forward_past_bullet(self, iter): (source)

Move an TextIter past a bullet

This method is useful because we typically want to insert new text on a line with a bullet after the bullet. This method can help to find that position.

Parameters
itera Gtk.TextIter. The position of this iter will be modified by this method.
def iter_forward_word_end(self, iter): (source)
Like Gtk.TextIter.forward_word_end() but less intelligent. This method does not take into account the language or punctuation and just skips to either the next whitespace or the end of the line.
Parameters
itera Gtk.TextIter, the position of this iter will be modified
Returns
True when successful
def iter_get_zim_tags(self, iter): (source)

Replacement for Gtk.TextIter.get_tags() which returns zim specific tags

In contrast to Gtk.TextIter.get_tags() this method assumes "left gravity" for TextTags. This means that it returns TextTags ending to the left of the iter position but not TextTags starting to the right.

For TextTags that should be applied per line (like 'indent', 'h', 'pre') some additional logic is used to keep them consistent. So at the start of the line, we do copy TextTags starting to the right and not inadvertently copy formatting from the previous line which ends on the left.

This method is for example used by update_editmode() to determine which TextTags should be applied to newly inserted text at at a specific location.

Parameters
itera Gtk.TextIter
Returns
a list of Gtk.TextTags (sorted by priority)
def iter_in_selection(self, iter): (source)
Check if a specific TextIter is within the selection
Parameters
itera Gtk.TextIter
Returns
True if there is a selection and iter is within the range of the selection
def list_objectanchors(self): (source)

Undocumented

def paste_clipboard(self, clipboard, iter, default_editable, text_format=None): (source)
Paste data from a clipboard into the buffer
Parameters
clipboarda Clipboard object
itera Gtk.TextIter for the insert location
default_editabledefault state of the TextView
text_formatUndocumented
def range_has_tag(self, tag, start, end): (source)
Check if a certain TextTag appears anywhere in a range
Parameters
taga Gtk.TextTag
starta Gtk.TextIter
enda Gtk.TextIter
def range_has_tags(self, func, start, end): (source)
Like range_has_tag() but uses a function to check for multiple tags. The function gets called for each TextTag in the range and the method returns as soon as the function returns True for any tag. There are a number of lambda functions defined in the module to test categories of TextTags.
Parameters
funca function that is called as: func(tag) for each TextTag in the range
starta Gtk.TextIter
enda Gtk.TextIter
def remove_link(self, start, end): (source)
Removes any links between in a range
Parameters
starta Gtk.TextIter
enda Gtk.TextIter
def remove_textstyle_tags(self, start, end): (source)
Removes all format style TexTags from a range
Parameters
starta Gtk.TextIter
enda Gtk.TextIter
def renumber_list(self, line): (source)
def renumber_list_after_indent(self, line, old_indent): (source)
def select_line(self, line=None): (source)
Selects a line
Parameters
lineline number; if None current line will be selected
Returns
True when successful
def select_lines(self, first, last): (source)
Select multiple lines
Parameters
firstline number first line
lastline number last line
Returns
True when successful
def select_link(self): (source)
Selects the current link, if any
Returns
link attributes when succcessful, None otherwise
def select_word(self): (source)
Selects the current word, if any
Returns
True when succcessful
def set_bullet(self, line, bullet, indent=None): (source)

Sets the bullet type for a line

Replaces any bullet that may already be present on the line. Set bullet None to remove any bullet at this line.

Parameters
linethe line number
bullet

the bullet type, one of:

        BULLET
        UNCHECKED_BOX
        CHECKED_BOX
        XCHECKED_BOX
        MIGRATED_BOX
        TRANSMIGRATED_BOX
        NUMBER_BULLET
        None

or a numbered bullet, like "1."

indentoptional indent to set after inserting the bullet, but before renumbering
def set_indent(self, line, level, interactive=False): (source)

Set the indenting for a specific line.

May also trigger renumbering for numbered lists.

Parameters
linethe line number
levelthe indenting level as a number, 0 for no indenting, 1 for the equivalent of 1 tab, etc.
interactive

hint if indenting is result of user interaction, or automatic action

If interactive, the line will be forced to end with a newline. Reason is that if the last line of the buffer is empty and does not end with a newline, the indenting will not be visible, giving the impression that it failed.

Returns
True for success (e.g. indenting a heading is not allowed, if you try it will fail and return False here)
def set_parsetree(self, tree, showing_template=False): (source)

Load a new ParseTree in the buffer

This method replaces any content in the buffer with the new parser tree.

Parameters
treea ParseTree object
showing_templateif True the tree represents a template and not actual page content (yet)
def set_textstyles(self, names): (source)
Sets the current text format style.
Parameters
names

the name of the format style

This style will be applied to text inserted at the cursor. Use set_textstyles(None) to reset to normal text.

def smart_remove_tags(self, func, start, end): (source)

This method removes tags over a range based on a function

So range_has_tags() for a details on such a test function.

Please use this method instead of remove_tag() when you are not sure if specific tags are present in the first place. Calling remove_tag() will emit signals which make the UndoStackManager assume the tag was there. If this was not the case the undo stack gets messed up.

def strip_selection(self): (source)
Shrinks the selection to exclude any whitespace on start and end. If only white space was selected this function will not change the selection.
Returns
True when this function changed the selection.
def tmp_cursor(self, iter=None, gravity=GRAVITY_LEFT): (source)
Get a SaveCursorContext object
Parameters
itera Gtk.TextIter for the new (temporary) cursor position
gravitygive mark left or right "gravity" compared to new inserted text, default is "left" which means new text goes after the cursor position
def toggle_checkbox(self, line, checkbox_type=None, recursive=False): (source)
Toggles the state of the checkbox at a specific line, if any
Parameters
linethe line number
checkbox_typethe checkbox type that we want to toggle: one of CHECKED_BOX, XCHECKED_BOX, MIGRATED_BOX, TRANSMIGRATED_BOX. If checkbox_type is given, it toggles between this type and unchecked. Otherwise it rotates through unchecked, checked and xchecked. As a special case when the checkbox_type ir UNCHECKED_BOX the box is always unchecked.
recursiveWhen True any child items in the list will also be upadted accordingly (see TextBufferList.set_bullet()
Returns
True for success, False if no checkbox was found.
def toggle_checkbox_for_cursor_or_selection(self, checkbox_type=None, recursive=False): (source)
Like toggle_checkbox() but applies to current line or current selection. Intended for interactive use.
Parameters
checkbox_typethe checkbox type that we want to toggle
recursiveWhen True any child items in the list will also be upadted accordingly (see TextBufferList.set_bullet()
def toggle_textstyle(self, name): (source)

Toggle the current textstyle

If there is a selection toggle the text style of the selection, otherwise toggle the text style for newly inserted text.

This method is mainly to change the behavior for interactive editing. E.g. it is called indirectly when the user clicks one of the formatting buttons in the EditBar.

For selections we remove the format if the whole range has the format already. If some part of the range does not have the format we apply the format to the whole tange. This makes the behavior of the format buttons consistent if a single tag applies to any range.

Parameters
namethe format style name
def unindent(self, line, interactive=False): (source)

Decrease the indent level for a given line

Can be used as function for foreach_line_in_selection().

Parameters
linethe line number
interactivehint if indenting is result of user interaction, or automatic action
Returns
True if successful
def unset_selection(self): (source)
Remove any selection in the buffer
def update_editmode(self): (source)

Updates the text style and indenting applied to newly indented text based on the current cursor position

This method is triggered automatically when the cursor is moved, but there are some cases where you may need to call it manually to force a consistent state.

def update_indent_tag(self, line, bullet): (source)

Update the indent TextTag for a given line

The TextTags used for indenting differ between normal indented paragraphs and indented items in a bullet list. The reason for this is that the line wrap behavior of list items should be slightly different to align wrapped text with the bullet.

This method does not change the indent level for a specific line, but it makes sure the correct TextTag is applied. Typically called e.g. after inserting or deleting a bullet.

Parameters
linethe line number
bulletthe bullet type for this line, or None
def whole_range_has_tag(self, tag, start, end): (source)
Check if a certain TextTag is applied to the whole range or not
Parameters
taga Gtk.TextTag
starta Gtk.TextIter
enda Gtk.TextIter
__gsignals__ = (source)

Undocumented

pixels_indent: int = (source)

Undocumented

tag_attributes = (source)

Undocumented

tag_styles = (source)

Undocumented

finder = (source)

Undocumented

notebook = (source)

Undocumented

page = (source)

Undocumented

showing_template = (source)

Undocumented

undostack = (source)

Undocumented

user_action = (source)

Undocumented

@property
hascontent = (source)

Undocumented

def _create_link_tag(self, text, href, **attrib): (source)
Creates an anonymouse TextTag for a link
def _create_tag_tag(self, text, **attrib): (source)
Creates an anonymous TextTag for a tag
def _do_lines_merged(self, iter): (source)

Undocumented

def _find_base_dir(self, line): (source)

Undocumented

def _fix_pre_selection(self, start, end): (source)

Undocumented

def _get_bullet_at_iter(self, iter): (source)

Undocumented

def _get_close_anchor_or_object_id(self, iter): (source)

Undocumented

def _get_heading_text(self, iter): (source)

Undocumented

def _get_implict_anchor_if_heading(self, iter): (source)

Undocumented

def _get_indent_tag(self, level, bullet=None, dir='LTR'): (source)

Undocumented

def _insert_bullet_at_cursor(self, bullet, raw=False): (source)

Insert a bullet plus a space at the cursor position. If 'raw' is True the space will be omitted and the check that cursor position must be at the start of a line will not be enforced.

External interface should use set_bullet(line, bullet) instead of calling this method directly.

def _insert_element_children(self, node, list_level=-1, list_type=None, list_start='0', raw=False, textstyles=[]): (source)

Undocumented

def _insert_table_element_at_cursor(self, element, raw): (source)

Undocumented

def _iter_forward_past_bullet(self, iter, bullet, raw=False): (source)

Undocumented

def _remove_indent(self, line): (source)

Undocumented

def _renumber_list(self, line, indent, newbullet): (source)

Undocumented

def _replace_bullet(self, line, bullet): (source)

Undocumented

def _search_bullet(self, line, indent, step): (source)

Undocumented

def _set_indent(self, line, level, bullet, dir=None): (source)

Undocumented

def _sort_nesting_style_tags(self, iter, end, tags, open_tags): (source)

Undocumented

def _split_nesting_style_tags(self, tags): (source)

Undocumented

_nesting_style_tags: tuple[str, ...] = (source)

Undocumented

_static_style_tags: tuple[str, ...] = (source)

Undocumented

_static_tag_after_tags: str = (source)

Undocumented

_static_tag_before_links: str = (source)

Undocumented

_check_renumber: list = (source)

Undocumented

_deleted_editmode_mark = (source)

Undocumented

_deleted_line_end = (source)

Undocumented

_editmode_tags = (source)

Undocumented

_insert_tree_in_progress: bool = (source)

Undocumented

_renumbering: bool = (source)

Undocumented