File: plugins.txt

package info (click to toggle)
advene 1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 10,588 kB
  • ctags: 6,326
  • sloc: xml: 56,303; python: 50,385; perl: 741; sh: 186; makefile: 83; ansic: 18
file content (83 lines) | stat: -rw-r--r-- 2,327 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Plugin architecture for Advene
------------------------------

Types of plugins
================

  * content-type handler (editor / viewer)
  * adhoc views
  * actions
  * importers
  * global methods

Location of plugins
===================

For the builtin core features: lib/advene/plugins

For the builtin GUI features: lib/advene/gui/plugins

For user-defined plugins: 
* $HOME/.advene/plugins on linux
* %USERPROFILE%/advene/plugins on windows
* $HOME/Library/Preferences/Advene/plugins on MacOSX

Implementation
==============

A plugin is a module. It *must* have :
  * a name attribute
  * a register(controller=None) function

Upon loading, the register function is called, with the controller as
parameter. It initializes and registers the plugin's components in the
Advene infrastructure.

For the moment, the following registration methods are available from
the controller:

register_content_handler(handler)
register_global_method(method, name=None)
register_action(action)
register_viewclass(class)
register_importer(importer)
register_player(player_class)

Example
=======

Here is a minimal plugin to register a new global method (in TALES):

  name="Test plugin"
  
  def register(controller=None):
      controller.register_global_method(test_global_method, 'test')
        
  def test_global_method(target, context):
      return "TEST"

You can find real examples in lib/advene/gui/plugins or lib/advene/plugins

Component-specific information
==============================

Adhoc-views have to inherit from advene.gui.views.AdhocView in order
to be integrated in the Advene framework.

Importers have to inherit from advene.util.importer.GenericImporter

Content-type handlers have to inherit from advene.gui.edit.elements.ContentHandler

Actions must be wrapped in a advene.rules.elements.RegisteredAction

Global methods must respect the signature: function(context, target)

Player plugins respect the player API. The dummy.py player basically
serves as reference for this API.
- they define a player_capabilities list of strings :
  * svg : able to caption svg
  * caption : able to caption text
  * pause : able to be paused
  * record : able to record
  * frame-by-frame : able to do frame-by-frame
  * async-snapshot : able to do asynchronous (callback-based) snapshot with precise positioning.