moo.Editor - editor object
Prev | Chapter 3. medit Python API | Next

## moo.Editor - editor object

    gobject.Object
      |
      +-- moo.Editor

### signal after-save

    after-save(doc)

This signal is emitted after the document has been successfully saved on disk.

`doc` : | the document which was saved on disk

### signal before-save

    before-save(doc, file)

This signal is emitted when the document is going to be saved on disk. Callbacks must return `SAVE_RESPONSE_CANCEL` if document should not be saved, and `SAVE_RESPONSE_CONTINUE` otherwise. For example, if before saving the file must be checked out from a version control system, a callback can do that and return `SAVE_RESPONSE_CANCEL` if checkout failed. Callbacks must not modify document content. If you need to modify it before saving, use `will-save` signal instead.

`doc` : | the document which is about to be saved on disk
`file` : | the `gio.File` object which represents saved file

`Returns:` `SAVE_RESPONSE_CANCEL` to cancel saving, `SAVE_RESPONSE_CONTINUE` otherwise.

### signal will-close-doc

    will-close-doc(doc)

This signal is emitted before the document is closed.

`doc` : | the document which is about to be closed

`Returns:` `moo.CloseResponse`

### signal will-close-window

    will-close-window(window)

This signal is emitted before the window is closed.

`window` : | the window which is about to be closed

### signal will-save

    will-save(doc, file)

This signal is emitted when the document is going to be saved on disk, after `before-save` signal. Callbacks may modify document content at this point.

`doc` : | the document which is about to be saved on disk
`file` : | the `gio.File` object which represents saved file

### create_instance()

    Editor.create_instance(embedded=True)

`embedded` : | `bool`

`Returns:` `moo.Editor`

### instance()

    Editor.instance()

`Returns:` `moo.Editor`

### close_doc()

    editor.close_doc(doc)

`doc` : | `moo.Edit`

`Returns:` `bool`

### close_docs()

    editor.close_docs(docs)

`docs` : | list of `moo.Edit` objects

`Returns:` `bool`

### close_window()

    editor.close_window(window)

`window` : | `moo.EditWindow`

`Returns:` `bool`

### create_doc()

    editor.create_doc(filename=None, encoding=None)

Create a document instance which can be embedded into arbitrary widget. This method may not be used in medit (use `new_doc()`, `new_file()`, `open_file()`, `open_files()`, `open_uri()`, `open_path()` instead).

`filename` : | `str` or `None`
`encoding` : | `str` or `None`

`Returns:` `moo.Edit`

### get_active_doc()

    editor.get_active_doc()

`Returns:` `moo.Edit`

### get_active_view()

    editor.get_active_view()

`Returns:` `moo.EditView`

### get_active_window()

    editor.get_active_window()

`Returns:` `moo.EditWindow`

### get_doc()

    editor.get_doc(filename)

Finds open document by filename.

`filename` : | `str`

`Returns:` `moo.Edit`

### get_doc_for_file()

    editor.get_doc_for_file(file)

Finds open document by `gio.File`.

`file` : | `gio.File`

`Returns:` `moo.Edit`

### get_doc_for_uri()

    editor.get_doc_for_uri(uri)

Finds open document by URI.

`uri` : | `str`

`Returns:` `moo.Edit`

### get_docs()

    editor.get_docs()

`Returns:` list of `moo.Edit` objects

### get_windows()

    editor.get_windows()

`Returns:` list of `moo.EditWindow` objects

### new_doc()

    editor.new_doc(window=None)

`window` : | `moo.EditWindow` or `None`

`Returns:` `moo.Edit`

### new_file()

    editor.new_file(info, parent=None)

`info` : | `moo.OpenInfo`
`parent` : | `gtk.Widget` or `None`

`Returns:` `moo.Edit`

### new_window()

    editor.new_window()

`Returns:` `moo.EditWindow`

### open_file()

    editor.open_file(info, parent=None)

`info` : | `moo.OpenInfo`
`parent` : | `gtk.Widget` or `None`

`Returns:` `moo.Edit`

### open_files()

    editor.open_files(files, parent=None)

`files` : | list of `moo.OpenInfo` objects
`parent` : | `gtk.Widget` or `None`

`Returns:` `bool`

### open_path()

    editor.open_path(path, encoding=None, line=-1, window=None)

`path` : | `str`
`encoding` : | `str` or `None`
`line` : | `int`
`window` : | `moo.EditWindow` or `None`

`Returns:` `moo.Edit`

### open_uri()

    editor.open_uri(uri, encoding=None, line=-1, window=None)

`uri` : | `str`
`encoding` : | `str` or `None`
`line` : | `int`
`window` : | `moo.EditWindow` or `None`

`Returns:` `moo.Edit`

### reload()

    editor.reload(doc, info=None)

`doc` : | `moo.Edit`
`info` : | `moo.ReloadInfo` or `None`

`Returns:` `bool`

### save()

    editor.save(doc)

`doc` : | `moo.Edit`

`Returns:` `bool`

### save_as()

    editor.save_as(doc, info=None)

Save document with new filename and/or encoding. If `info` is missing or ``None`` then user is asked for new filename first.

`doc` : | `moo.Edit`
`info` : | `moo.SaveInfo` or `None`

`Returns:` `bool`

### save_copy()

    editor.save_copy(doc, info)

`doc` : | `moo.Edit`
`info` : | `moo.SaveInfo`

`Returns:` `bool`

### set_active_doc()

    editor.set_active_doc(doc)

`doc` : | `moo.Edit`

### set_active_view()

    editor.set_active_view(view)

`view` : | `moo.EditView`

### set_active_window()

    editor.set_active_window(window)

`window` : | `moo.EditWindow`

### set_doc_type()

    editor.set_doc_type(type)

`type` : | `type`

### set_window_type()

    editor.set_window_type(type)

`type` : | `type`

Prev | Up | Next
moo.EditWindow - document window object | Home | moo.LineView