class documentation

class TextView(Gtk.TextView): (source)

View In Hierarchy

Widget to display a TextBuffer with page content. Implements zim specific behavior like additional key bindings, on-mouse-over signals for links, and the custom popup menu.
Unknown Field: signal
link-clicked (link): Emitted when the user clicks a link
link-enter (link): Emitted when the mouse pointer enters a link
link-leave (link): Emitted when the mouse pointer leaves a link

end-of-word (start, end, word, char, editmode): Emitted when the user typed a character like space that ends a word

  • start: a Gtk.TextIter for the start of the word
  • end: a Gtk.TextIter for the end of the word
  • word: the word as string
  • char: the character that caused the signal (a space, tab, etc.)
  • editmode: a list of constants for the formatting being in effect, e.g. VERBATIM

Plugins that want to add auto-formatting logic can connect to this signal. If the handler matches the word it should stop the signal with stop_emission() to prevent other hooks from formatting the same word.

end-of-line (end): Emitted when the user typed a newline
Method __init__ Constructor
Method click_anchor Show popover for anchor under the cursor
Method click_checkbox Toggle the checkbox under the mouse pointer, if any
Method click_link Activate the link under the mouse pointer, if any
Method click_link_at_iter Activate the link at iter, if any
Method do_button_press_event Undocumented
Method do_button_release_event Undocumented
Method do_copy_clipboard Undocumented
Method do_cut_clipboard Undocumented
Method do_end_of_line Undocumented
Method do_end_of_word Undocumented
Method do_key_press_event Undocumented
Method do_move_cursor Undocumented
Method do_paste_clipboard Undocumented
Method do_popup_menu Undocumented
Method do_visibility_notify_event Undocumented
Method get_popup Get the popup menu - intended for testing
Method get_visual_home_positions Get the TextIters for the visuale start of the line
Method on_insert_object Undocumented
Method on_motion_notify_event Undocumented
Method on_query_tooltip Undocumented
Method on_size_allocate Undocumented
Method set_buffer Undocumented
Method test_key_press_event Undocumented
Method update_cursor Update the mouse cursor type
Class Variable __gsignals__ Undocumented
Instance Variable preferences dict with preferences
Method _do_key_press_event Undocumented
Method _do_key_press_event_default Undocumented
Method _do_key_press_event_readonly Undocumented
Method _do_key_press_event_selection Undocumented
Method _get_object_wrap_width Undocumented
Method _get_pixbuf_at_pointer No summary
Method _get_pointer_location Get an iter and coordinates for the mouse pointer
Method _get_popup_menu_mark Undocumented
Method _post_key_press_event Undocumented
Method _set_cursor Undocumented
Method _set_popup_menu_mark Undocumented
Instance Variable _cursor Undocumented
Instance Variable _cursor_link Undocumented
Instance Variable _object_widgets Undocumented
Instance Variable _object_wrap_width Undocumented
def __init__(self, preferences): (source)
Constructor
Parameters
preferencesdict with preferences
Unknown Field: todo
make sure code sets proper defaults for preferences & document preferences used
def click_anchor(self): (source)
Show popover for anchor under the cursor
def click_checkbox(self, checkbox_type=None): (source)
Toggle the checkbox under the mouse pointer, if any
Parameters
checkbox_typethe checkbox type to toggle between, see TextBuffer.toggle_checkbox() for details.
Returns
True for success, False if no checkbox was found.
def click_link(self): (source)
Activate the link under the mouse pointer, if any
Returns
True when there was indeed a link
Unknown Field: emits
link-clicked
def click_link_at_iter(self, iter): (source)

Activate the link at iter, if any

Like click_link() but activates a link at a specific text iter location

Parameters
itera Gtk.TextIter
Returns
True when there was indeed a link
Unknown Field: emits
link-clicked
def do_button_press_event(self, event): (source)

Undocumented

def do_button_release_event(self, event): (source)

Undocumented

def do_copy_clipboard(self, format=None): (source)

Undocumented

def do_cut_clipboard(self): (source)

Undocumented

def do_end_of_line(self, end): (source)

Undocumented

def do_end_of_word(self, start, end, word, char, editmode): (source)

Undocumented

def do_key_press_event(self, event): (source)

Undocumented

def do_move_cursor(self, step_size, count, extend_selection): (source)

Undocumented

def do_paste_clipboard(self, format=None): (source)

Undocumented

def do_popup_menu(self): (source)

Undocumented

def do_visibility_notify_event(self, event): (source)

Undocumented

def get_popup(self): (source)
Get the popup menu - intended for testing
def get_visual_home_positions(self, iter): (source)
Get the TextIters for the visuale start of the line
Parameters
itera Gtk.TextIter
Returns

a 2-tuple with two Gtk.TextIter

The first iter is the start of the visual line - which can be the start of the line as the buffer sees it (which is also called the paragraph start in the view) or the iter at the place where the line is wrapped. The second iter is the start of the line after skipping any bullets and whitespace. For a wrapped line the second iter will be the same as the first.

def on_insert_object(self, buffer, anchor): (source)

Undocumented

def on_motion_notify_event(self, event): (source)

Undocumented

def on_query_tooltip(self, widget, x, y, keyboard_tip, tooltip): (source)

Undocumented

def on_size_allocate(self, *a): (source)

Undocumented

def set_buffer(self, buffer): (source)

Undocumented

def test_key_press_event(self, keyval, event_state=0): (source)

Undocumented

def update_cursor(self, coords=None): (source)

Update the mouse cursor type

E.g. set a "hand" cursor when hovering over a link.

Parameters
coordsa tuple with (x, y) position in buffer coords. Only give this argument if coords are known from an event, otherwise the current cursor position is used.
Unknown Field: emits
link-enter
link-leave
__gsignals__ = (source)

Undocumented

preferences = (source)
dict with preferences
def _do_key_press_event(self, keyval, event_state): (source)

Undocumented

def _do_key_press_event_default(self, keyval, event_state): (source)

Undocumented

def _do_key_press_event_readonly(self, keyval, event_state): (source)

Undocumented

def _do_key_press_event_selection(self, keyval, event_state): (source)

Undocumented

def _get_object_wrap_width(self): (source)

Undocumented

def _get_pixbuf_at_pointer(self, iter, coords): (source)
Returns the pixbuf that is under the mouse or None. The parameters should be the TextIter and the (x, y) coordinates from _get_pointer_location(). This method handles the special case where the pointer it on an iter next to the image but the mouse is visible above the image.
def _get_pointer_location(self): (source)
Get an iter and coordinates for the mouse pointer
Returns
a 2-tuple of a Gtk.TextIter and a (x, y) tupple with coordinates for the mouse pointer.
def _get_popup_menu_mark(self): (source)

Undocumented

def _post_key_press_event(self, keyval): (source)

Undocumented

def _set_cursor(self, cursor, link=None): (source)

Undocumented

def _set_popup_menu_mark(self, iter): (source)

Undocumented

_cursor = (source)

Undocumented

_cursor_link = (source)

Undocumented

_object_widgets = (source)

Undocumented

_object_wrap_width = (source)

Undocumented