class InsertedObjectType(object): (source)
Known subclasses: zim.gui.insertedobjects.UnknownInsertedImageObject
, zim.gui.insertedobjects.UnknownInsertedObject
, zim.plugins.InsertedObjectTypeExtension
Base class for defining "objects" that can be inserted in a wiki page
This class is called "InsertedObjectType" instead of "InsertedObject" because it does *not* represent a single inserted object, but defines a type of object of which many instances can occur. The instances themselves are represented by a series of tokens for the parser and a model plus a widget for the user interface.
Note: if you are looking for how to define a new object type from a plugin, please see InsertedObjectTypeExtension
in zim.plugins
. Base classes for widgets can be found in zim.gui.insertedobjects
.
Method | __init__ |
Undocumented |
Method | create_widget |
Return a Gtk widget for the given model @param model: an object created with model_from_data() @returns: a Gtk widget object derived from InsertedObjectWidget |
Method | data_from_model |
No summary |
Method | format |
Format the object using a specific output format Intended to improve rendering of the object on exporting. |
Method | model_from_data |
Returns a model for the object |
Method | new_model_interactive |
Create a new object model interactively Interactive means that we can use e.g. a dialog to prompt for input. The default behavior is to use new_object() . |
Method | new_object |
Create a new empty object @returns: a 2-tuple (attrib, data) |
Method | parse_attrib |
Convenience method to enforce the supported attributes and their types. @returns: a ConfigDict using the object_attr dict as definition |
Class Variable | is_inline |
Undocumented |
Class Variable | label |
Undocumented |
Class Variable | name |
Undocumented |
Class Variable | verb_icon |
Undocumented |
Instance Variable | object_attr |
Undocumented |
Method | _data_from_model_wrapper |
Undocumented |
Method | _format_wrapper |
Undocumented |
Method | _model_from_data_wrapper |
Undocumented |
zim.gui.insertedobjects.UnknownInsertedImageObject
, zim.gui.insertedobjects.UnknownInsertedObject
, zim.plugins.base.imagegenerator.ImageGeneratorObjectType
, zim.plugins.sourceview.SourceViewObjectType
, zim.plugins.tableeditor.TableViewObjectType
Parameters | |
model | an object created with model_from_data() |
Returns | |
a Gtk widget object derived from InsertedObjectWidget |
zim.gui.insertedobjects.UnknownInsertedImageObject
, zim.gui.insertedobjects.UnknownInsertedObject
, zim.plugins.base.imagegenerator.ImageGeneratorObjectType
, zim.plugins.sourceview.SourceViewObjectType
Parameters | |
model | an object created with model_from_data() |
Returns | |
a 2-tuple (attrib, data) |
Format the object using a specific output format Intended to improve rendering of the object on exporting.
This method should always be robust for missing attributes and body contents. The attrib will automatically be checked by parse_attrib
before being given to this method.
Implementing this method is optional, default checks for a specific method per format (e.g. format_html() for the "html" format) and raises ValueError if no such method is defined.
Parameters | |
format | name of the output format |
dumper | Dumper object |
attrib | dict with object attributes |
data | string with object content |
Returns | |
a list of strings | |
Raises | |
ValueError | if no specific formatting for "format" is available |
zim.gui.insertedobjects.UnknownInsertedImageObject
, zim.gui.insertedobjects.UnknownInsertedObject
, zim.plugins.base.imagegenerator.ImageGeneratorObjectType
, zim.plugins.sourceview.SourceViewObjectType
, zim.plugins.tableeditor.TableViewObjectType
Returns a model for the object
The main purpose for the model is that it is shared between widgets that show the same object. See e.g. Gtk.TextBuffer or Gtk.TreeModel for examples.
No API is expected of the model object other than that it can be used as argument for create_widget()
and data_from_model()
and a "changed" signal that should be emitted when the content has changed, so the pageview knows that the page has changed and should be saved before closing.
Since the model is specific for the page where the object occurs, any user of the object type should serialize back to data before e.g. copying the object to a different page.
This method should always be robust for missing attributes and body contents. The attrib will automatically be checked by parse_attrib
before being given to this method.
Parameters | |
notebook | a Notebook object |
page | a Page object for the page where this object occurs |
attrib | dict with object attributes |
data | string with object content |
Returns | |
a model object |
zim.plugins.base.imagegenerator.ImageGeneratorObjectType
, zim.plugins.sourceview.SourceViewObjectType
, zim.plugins.tableeditor.TableViewObjectType
new_object()
.Parameters | |
parent | Gtk widget to use as parent widget for dialogs |
notebook | a Notebook object |
page | a Page object for the page where this object occurs |
Returns | |
a model object (see model_from_data() ) | |
Raises | |
Unknown exception | ValueError: if user cancelled the action |
zim.gui.insertedobjects.UnknownInsertedImageObject
, zim.gui.insertedobjects.UnknownInsertedObject
Returns | |
a ConfigDict using the object_attr dict as definition |
zim.gui.insertedobjects.UnknownInsertedImageObject
, zim.plugins.base.imagegenerator.BackwardImageGeneratorObjectType
Undocumented
zim.gui.insertedobjects.UnknownInsertedImageObject
, zim.gui.insertedobjects.UnknownInsertedObject
, zim.plugins.diagrameditor.BackwardDiagramImageObjectType
, zim.plugins.ditaaeditor.BackwardDitaaImageObjectType
, zim.plugins.equationeditor.BackwardEquationImageObjectType
, zim.plugins.gnu_r_ploteditor.BackwardGnuRPlotImageObjectType
, zim.plugins.gnuplot_ploteditor.BackwardGnuplotImageObjectType
, zim.plugins.scoreeditor.BackwardScoreImageObjectType
, zim.plugins.sequencediagrameditor.BackwardSequenceDiagramImageObjectType
, zim.plugins.sourceview.SourceViewObjectType
, zim.plugins.tableeditor.TableViewObjectType
Undocumented
zim.gui.insertedobjects.UnknownInsertedImageObject
, zim.gui.insertedobjects.UnknownInsertedObject
, zim.plugins.diagrameditor.BackwardDiagramImageObjectType
, zim.plugins.ditaaeditor.BackwardDitaaImageObjectType
, zim.plugins.equationeditor.BackwardEquationImageObjectType
, zim.plugins.gnu_r_ploteditor.BackwardGnuRPlotImageObjectType
, zim.plugins.gnuplot_ploteditor.BackwardGnuplotImageObjectType
, zim.plugins.scoreeditor.BackwardScoreImageObjectType
, zim.plugins.sequencediagrameditor.BackwardSequenceDiagramImageObjectType
, zim.plugins.sourceview.SourceViewObjectType
, zim.plugins.tableeditor.TableViewObjectType
Undocumented