~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/base/plugins.py

  • Committer: William Grant
  • Date: 2012-06-28 01:52:02 UTC
  • Revision ID: me@williamgrant.id.au-20120628015202-f6ru7o367gt6nvgz
Hah

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    Base class for all Plugin classes.
23
23
    """
24
24
    pass
25
 
    
 
25
 
26
26
class ViewPlugin(BasePlugin):
27
27
    """Marker class for plugins that provide views.
28
 
    
29
 
    View plugins must have a 'urls' property which contains an iterable of pairs
30
 
    or triples, like (routex string, handler class, kwargs dict). The kwargs
31
 
    dict is optional. If present, the members of the kwargs dict will be passed
32
 
    as keyword arguments to the constructor of the view object.
33
 
    
 
28
 
 
29
    View plugins have three main types of registration:
 
30
     - forward_routes: A list of traversals from objects to their
 
31
       descendants. The discriminator is the source class and a list of zero
 
32
       or more intermediate path segments. An optional argument count may be
 
33
       given -- arguments will be taken from the path after the intermediate
 
34
       segments. The specified callable will be given the source object and
 
35
       any arguments, and should return the target object.
 
36
 
 
37
     - reverse_routes: A list of traversals from objects to their parents.
 
38
       The discriminator is just the child class. The provided callable must
 
39
       return a tuple of (parent_object, ('intermediate', path', 'segments')).
 
40
 
 
41
     - views: A list of named views for objects. The discriminator is the
 
42
       context object class, view name, and an optional view set. An optional
 
43
       (possibly infinite) argument count may again be given. The arguments
 
44
       values will be taken from the path after the view name. The callable
 
45
       should take the request object, target object and subpath, and return
 
46
       a view object.
 
47
 
 
48
    See ivle.dispatch.generate_publisher for the registry code.
 
49
 
34
50
    View plugins may also have a 'help' property, which should contain a dict
35
51
    of dicts and help file names. This dict is then used to generate the
36
52
    appropriate entries in the help system.
37
 
    """
38
 
    pass
39
 
    
 
53
 
 
54
    Tabs can also be defined by view plugins. To define tabs, provide a 'tabs'
 
55
    property containing 6-tuples of (name, title, desc, icon, path, weight).
 
56
    The icon should be relative to the plugin's media directory, and the path
 
57
    should be relative to the root. The weight is used for ordering; larger
 
58
    weights are further right.
 
59
    """
 
60
    pass
 
61
 
 
62
class PublicViewPlugin(BasePlugin):
 
63
    """Marker class for plugins that provide public mode views.
 
64
 
 
65
    Public view plugins can specify the same 'urls' property as normal view
 
66
    plugins, but they are added to the public mode publisher instead.
 
67
    """
 
68
    pass
 
69
 
40
70
class OverlayPlugin(BasePlugin):
41
71
    """Marker class for plugins which provide overlays.
42
 
    
 
72
 
43
73
    Overlay plugins provide mini-views which can be displayed on top of other
44
74
    views. The canonical example of a plugin of this type is the Console plugin.
45
75
    """