gtksourceview.SourceView
Prev | The GtkSourceView Class Reference | Next

## gtksourceview.SourceView

gtksourceview.SourceView — a widget that displays the source code

## Synopsis

    class gtksourceview.SourceView(gtk.TextView):
        gtksourceview.SourceView(buffer=None)
        def set_show_line_numbers(show)
        def get_show_line_numbers()
        def set_show_line_markers(show)
        def get_show_line_markers()
        def set_tabs_width(width)
        def get_tabs_width()
        def set_auto_indent(enable)
        def get_auto_indent()
        def set_insert_spaces_instead_of_tabs(enable)
        def get_insert_spaces_instead_of_tabs()
        def set_show_margin(show)
        def get_show_margin()
        def set_margin(margin)
        def get_margin()
        def set_marker_pixbuf(marker_type, pixbuf)
        def get_marker_pixbuf()
        def set_smart_home_end(enable)
        def get_smart_home_end(window)

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Container
            +-- gtk.TextView
              +-- gtksourceview.SourceView

## Properties

"auto-indent" | Read-Write | If `TRUE` enable auto indentation.
"insert-spaces-instead-of-tabs" | Read-Write | If `TRUE` spaces will be inserted instead of tabs.
"margin" | Read-Write | Position of the right margin.
"show-line-markers" | Read-Write | If `TRUE`, the display line marker pixbufs will be shown.
"show-line-numbers" | Read-Write | If `TRUE`, the line numbers will be shown.
"show-margin" | Read-Write | If `TRUE`, the right margin will be shown.
"smart-home-end" | Read-Write | HOME and END keys move to first/last characters on line first before going to the start/end of the line.
"tabs-width" | Read-Write | Tabs Width.

## Signal Prototypes

"redo" | `def callback(`sourceview`, `user_param1`, `...`)`
"undo" | `def callback(`sourceview`, `user_param1`, `...`)`

## Description

A `gtksourceview.SourceView` is a text widget that extends the standard `gtk.TextView` It improves the `gtk.TextView` by implementing syntax highlighting and other features typical of a source editor.

## Constructor

        gtksourceview.SourceView(buffer=None)

`buffer` : | a `gtksourceview.SourceBuffer` or `None`
Returns : | a new `gtksourceview.SourceView`.

Creates a new `gtksourceview.SourceView` widget displaying the `gtksourceview.SourceBuffer` specified by `buffer`. If `buffer` is `None`, a new `gtksourceview.SourceBuffer` will be created. One sourcebuffer can be shared among many widgets.

## Methods

### gtksourceview.SourceView.set_show_line_numbers

        def set_show_line_numbers(show)

`show` : | if `TRUE` the line numbers will be shown.

The `set_show_line_numbers`() method sets the property "show-line-numbers" to the value of `show`. If `show` is set to `TRUE` the line numbers should be visible, otherwise not.

### gtksourceview.SourceView.get_show_line_numbers

        def get_show_line_numbers()

Returns : | `TRUE` if the line numbers are visible, `FALSE` otherwise.

The `get_show_line_numbers`() method returns the value of the "show-line-numbers" property which determines if the line numbers should be visible.

### gtksourceview.SourceView.set_show_line_markers

        def set_show_line_markers(show)

`show` : | if `TRUE` the line markers will be shown.

The `set_show_line_markers`() method sets the property "show-line-markers" to the value of `show`. If `show` is set to `TRUE` the line markers should be visible, otherwise not.

### gtksourceview.SourceView.get_show_line_markers

        def get_show_line_markers()

Returns : | `TRUE` if the line markers are visible, `FALSE` otherwise.

The `get_show_line_markers`() method returns the value of the "show-line-markers" property which determines if the line markers should be visible.

### gtksourceview.SourceView.set_tabs_width

        def set_tabs_width(width)

`width` : | The width of the tabs

The `set_tabs_width`() method sets the property "tab-width" to the value of `width`.

### gtksourceview.SourceView.get_tabs_width

        def get_tabs_width()

Returns : | The value of `width`.

The `get_tabs_width`() method returns the value of `width`.

### gtksourceview.SourceView.set_auto_indent

        def set_auto_indent(enable)

`enable` : | if `TRUE` the auto indentation will be active.

The `set_auto_indent`() method sets the property "auto-indent" to the value of `enable`. If `enable` is set to `TRUE` the auto indentation is active, otherwise not.

### gtksourceview.SourceView.get_auto_indent

        def get_auto_indent()

Returns : | `TRUE` if the auto indentation is turned on, `FALSE` otherwise.

The `get_auto_indent`() method returns the value of the "auto-indent" property which determines if the auto indentation should be used.

### gtksourceview.SourceView.set_insert_spaces_instead_of_tabs

        def set_insert_spaces_instead_of_tabs(enable)

`enable` : | if `TRUE` spaces will be used instead of tabs.

The `set_insert_spaces_instead_of_tabs`() method sets the property "insert-spaces-instead-of-tabs" to the value of `enable`. If `enable` is set to `TRUE` then spaces will be used instead of tabs, otherwise not.

### gtksourceview.SourceView.get_insert_spaces_instead_of_tabs

        def get_insert_spaces_instead_of_tabs()

Returns : | `TRUE` if spaces are used instead of tabs, `FALSE` otherwise.

The `get_insert_spaces_instead_of_tabs`() method returns the value of the "insert-spaces-instead-of-tabs" property which determines if spaces should be used instead of tabs.

### gtksourceview.SourceView.set_show_margin

        def set_show_margin(show)

`show` : | if `TRUE` the line markers will be shown.

The `set_show_margin`() method sets the property "show-margin" to the value of `show`. If `show` is set to `TRUE` the margin should be visible, otherwise not.

### gtksourceview.SourceView.get_show_margin

        def get_show_margin()

Returns : | `TRUE` if the line markers are visible, `FALSE` otherwise.

The `get_show_margin`() method returns the value of the "show-margin" property which determines if the margin should be visible.

### gtksourceview.SourceView.set_tabs_width

        def set_margin(margin)

`margin` : | The width of the margin

The `set_margin`() method sets the property "margin" to the value of `margin`.

### gtksourceview.SourceView.get_margin

        def get_margin()

Returns : | The value of `margin`.

The `get_margin`() method returns the value of `margin`.

### gtksourceview.SourceView.set_marker_pixbuf

        def set_marker_pixbuf(marker_type, pixbuf)

`marker_type` : | The marker that have to be shown in the margin.

The `set_marker_pixbuf`() method sets the marker that have to be used.

### gtksourceview.SourceView.get_marker_pixbuf

        def get_marker_pixbuf()

Returns : | The value of `marker_type`.

The `get_marker_pixbuf`() method returns the value of `marker_type`.

### gtksourceview.SourceView.set_smart_home_end

        def set_smart_home_end(enable)

`enable` : | if `TRUE` spaces will be used instead of tabs.

The `set_smart_home_end`() method sets the property "smart-home-end" to the value of `enable`. If `enable` is set to `TRUE` then HOME and END keys move to first/last characters on line first before going to the start/end of the line.

### gtksourceview.SourceView.get_smart_home_end

        def get_smart_home_end()

Returns : | `TRUE` if HOME and END keys move to first/last characters on line first before going to the start/end of the line. `FALSE` otherwise.

The `get_smart_home_end`() method returns the value of the "smart-home-end" property which determines if HOME and END keys move to first/last characters on line first before going to the start/end of the line.

## Signals

### The "redo" gtksourceview.SourceView Signal

        def callback(sourceview, user_param1, ...)

`sourceview` : | the sourceview that received the signal
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)

The "redo" signal is emitted when ...

### The "undo" gtksourceview.SourceView Signal

        def callback(sourceview, user_param1, ...)

`sourceview` : | the sourceview that received the signal
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)

The "undo" signal is emitted when ....

Prev | Up | Next
The GtkSourceView Class Reference | Home | gtksourceview.SourceBuffer