File: plugins.txt

package info (click to toggle)
gaphor 0.13.0-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,692 kB
  • ctags: 2,971
  • sloc: python: 19,981; xml: 247; makefile: 54; sh: 40
file content (107 lines) | stat: -rw-r--r-- 3,005 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Plugins
-------

Gaphor is growing and the need arises to add optional modules: plugins.

A plugin is loaded on startup of the application (and possibly on demand).

Before a plugin is loaded an xml file is read which contains some definitions
for the plugin:
 - information such as author, version, and of course the name
 - requirements: other plugins this one depends on, modules
 - definitions of Actions
 - Code that should be ran before and after installation, before and after
   removal.

A typical plugin.xml file looks like this:

<?xml version="1.0"?>
<plugin name="UML metamodel sanity check"
        version="0.1"
        author="Arjan Molenaar">
  <description>
    A description of what this thing does.
  </description>

  <require>
    <!--
      Define modules and plugins that are needed for this plugin to function
      properly.
    -->
    <module name="os.path"/>
    <plugin name="anotherPlugin"/>
  </require>

  <provide>
    <!--
      Actions should be defined on the module's toplevel (like in __init__.py).
    -->
    <action id="MyPlugin"
            label="Do a typical thing with the plugin"
            icon-file="myicon.png"
            tooltip="bla bla"
            class="MyPluginAction" slot="WindowSlot">
      <!--
        Add optional dependencies to this action. The action is then updated
        when actions defined in the depends tag are executed.
      -->
      <depends action="ItemFocus"/>
    </action>
  </provide>
</plugin>


A plugin contains three sections:
description
	A description of the plugin (could be shown in a plugin browser for example)
	This is just a text field.
require
	Prerequisits for this plugin (such as exptic modules and other plugins)
provide
	Actions that are provided by this plugin
	
The require section can contain modules and plugins that are needed for this plugin
to work.

The <provide> section contains the actions that can be added to the application.
An action is a Python class that extends gaphor.plugin.Action (or CheckAction for
checkbox actions or RadioAction for radiobutton actions). An action has an
id
	Id is a unique identifier for the action
label
	A label that is shown in the menu
tooltip
	some extra information
icon-file
	A file containing a nice (24x24) image, preferbly a PNG image.
class
	The Action class to load from the module. The Action class should be
	visible through __init__.py (class names like 'test.TestAction' do not
	work)
slot
	Slots are predefined places in a menu where new actions can be added.

Slots
-----
Currently the following slots are defined:

Main window

main menu:
	slot name		menu		comment
	FileOpenSlot		File		after the 'Open' item
	FileSaveSlot		File		after the 'Save' item
	FileExportSlot		File/Export	
	FileSlot		File		After the 'Close' item
	EditSlot		Edit
	DiagramSlot		Diagram
	WindowSlot		Window
	HelpSlot		Help

Items in a diagram can have additional actions too:

	item:	slot name:
	Class	ClassPopupSlot

More slots are likely to be defined in the future.