Package advene :: Package gui :: Package views :: Module viewplugin :: Class ViewPlugin
[hide private]
[frames] | no frames]

Class ViewPlugin

source code

object --+    
         |    
 AdhocView --+
             |
            ViewPlugin

Abstract class defining the interface of ViewPlugins.

The generic way of dealing with a ViewPlugin is to create an instance of it, then call the get_widget () method to get the corresponding Gtk widget.

In the advene framework, the view should be registered via calls to register_view () so that it gets notified of the element's changes.

Do not inherit from this class, as it defines many optional methods. Inherit from AdhocView, and define the relevant additional methods.

self.load_parameters() takes a Content object as parameter, that must be of application/x-advene-adhoc-view mimetype. It will read the Content data, and return an options dictionary, and arguments as a list of (name, value) tuples. If None is passed, the view will try to load default options (cf load_parameters docstring).

Instance Methods [hide private]
 
__init__(self, controller=None, parameters=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
get_save_arguments(self)
Method called when saving a parametered view.
source code
 
register_callback(self, controller=None)
Method invoked on view creation.
source code
 
unregister_callback(self, controller=None)
Method invoked on view closing.
source code
a Gtk Widget
get_widget(self)
Return a Gtk widget representing the view of the component.
source code
 
popup(self, label=None)
Popup the view in a toplevel window.
source code
usually an Advene element (Annotation, Schema, ...)
get_model(self)
Return the model (data structure) corresponding to the view.
source code
 
activate_annotation(self, annotation)
Activate the given annotation (some kind of visual feedback).
source code
 
desactivate_annotation(self, annotation)
Desactivate the given annotation (some kind of visual feedback).
source code
 
update_model(self, package)
Update the model of the view.
source code
 
update_annotation(self, annotation=None, event=None)
Update the representation of the given annotation.
source code
 
activate_relation(self, relation)
Activate the given relation (some kind of visual feedback).
source code
 
desactivate_relation(self, relation)
Desactivate the given annotation (some kind of visual feedback).
source code
 
update_relation(self, relation=None, event=None)
Update the representation of the given relation.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

    Inherited from AdhocView
 
attach_view(self, menuitem, window) source code
 
build_widget(self) source code
 
close(self, *p) source code
 
export_as_static_view(self, ident=None)
Propose to export the view as a static view.
source code
 
load_parameters(self, param)
Parse the parameters from a Content object, a tuple or an ElementTree.Element
source code
 
log(self, msg, level=None) source code
 
message(self, m)
Display a message in the statusbar, if present.
source code
 
parameters_to_element(self, options=None, arguments=None)
Generate an ET.Element representing the view and its parameters.
source code
 
register_slave_view(self, v) source code
 
safe_connect(self, obj, *p)
Connect a signal handler to a gobject.
source code
 
save_default_options(self, *p)
Save the default options.
source code
 
save_parameters(self, content, options=None, arguments=None)
Save the view parameters to a Content object.
source code
 
save_view(self, *p) source code
 
set_label(self, label) source code
 
unregister_slave_view(self, v) source code
Class Variables [hide private]
string view_name = 'Generic view plugin'
the name of the view
string view_id = 'viewplugin'
the id of the view
string tooltip = 'You should not ever see this tooltip...'
a description of the view
Instance Variables [hide private]
AdveneController controller
the controller
dict options
view options
gkt.Widget widget
the gtk widget representing the view
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, controller=None, parameters=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

get_save_arguments(self)

source code 

Method called when saving a parametered view.

It should return a tuple (options, arguments) where options is the options dictionary, and arguments is a list of (name, value) tuples).

If it returns None, None, it means that the view saving is cancelled.

Overrides: AdhocView.get_save_arguments

register_callback(self, controller=None)

source code 

Method invoked on view creation.

It can be used to register new EventHandler callbacks for instance (typically AnnotationBegin and AnnotationEnd).

Parameters:
  • controller (advene.core.controller.Controller) - the Advene controller

unregister_callback(self, controller=None)

source code 

Method invoked on view closing.

It is used to clean up the settings done in register_callback.

Parameters:
  • controller (advene.core.controller.Controller) - the Advene controller

get_widget(self)

source code 

Return a Gtk widget representing the view of the component.

It should be idempotent (i.e. return the same reference upon multiple invocations).

Returns: a Gtk Widget
the corresponding view
Overrides: AdhocView.get_widget

popup(self, label=None)

source code 

Popup the view in a toplevel window.

Overrides: AdhocView.popup

get_model(self)

source code 

Return the model (data structure) corresponding to the view.

Returns: usually an Advene element (Annotation, Schema, ...)
the model

activate_annotation(self, annotation)

source code 

Activate the given annotation (some kind of visual feedback).

Parameters:
  • annotation (advene.model.annotation.Annotation) - the activated annotation

desactivate_annotation(self, annotation)

source code 

Desactivate the given annotation (some kind of visual feedback).

Parameters:
  • annotation (advene.model.annotation.Annotation) - the activated annotation

update_model(self, package)

source code 

Update the model of the view.

This should be called when a new package has been loaded.

Parameters:
  • package (advene.model.package.Package) - the new package

update_annotation(self, annotation=None, event=None)

source code 

Update the representation of the given annotation.

This should be called when the annotation data or metadata has been modified.

Parameters:
  • annotation (advene.model.annotation.Annotation) - the activated annotation
  • event (advene.rules.elements.Event) - the precise event (AnnotationCreate, AnnotationEditEnd, AnnotationDelete)

activate_relation(self, relation)

source code 

Activate the given relation (some kind of visual feedback).

Parameters:
  • relation (advene.model.annotation.Relation) - the activated relation

desactivate_relation(self, relation)

source code 

Desactivate the given annotation (some kind of visual feedback).

Parameters:
  • relation (advene.model.annotation.Relation) - the activated relation

update_relation(self, relation=None, event=None)

source code 

Update the representation of the given relation.

This should be called when the relation data or metadata has been modified.

Parameters:
  • relation (advene.model.relation.Relation) - the activated relation
  • event (advene.rules.elements.Event) - the precise event (RelationCreate, RelationEditEnd, RelationDelete)