root/gaphor/tags/gaphor-0.7.0/gaphor/plugin.py

Revision 365, 1.2 kB (checked in by arjanmol, 4 years ago)

*** empty log message ***

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 # vim:sw=4:et
2 """This module provides everything needed to create a plugin.
3
4 resource - Get/set application wide resources
5
6 Classes to construct Actions:
7     Action
8     CheckAction (Checkbutton Action)
9     RadioAction (RadioButton Action, should set the group attribute)
10     ObjectAction (this is not an action, but it contains some code to make
11                   instances of Actions behave like Action classes)
12
13 Each action is initialized. The window containing the action can be accessed
14 by the 'window' property.
15 """
16
17 from gaphor import resource
18
19 from gaphor.misc.action import Action as _Action
20 from gaphor.misc.action import CheckAction as _CheckAction
21 from gaphor.misc.action import RadioAction as _RadioAction
22 from gaphor.misc.action import ObjectAction
23
24
25 class _ActionMixIn(object):
26     """Handle initialization of actions in a way that the main window
27     can properly initialize the action.
28     """
29
30     def init(self, window):
31         self._window = window
32
33     def get_window(self):
34         return self._window
35
36     window = property(get_window)
37
38 class Action(_Action, _ActionMixIn): pass
39 class CheckAction(_CheckAction, _ActionMixIn): pass
40 class RadioAction(_RadioAction, _ActionMixIn): pass
41
42 del _Action, _CheckAction, _RadioAction, _ActionMixIn
43
Note: See TracBrowser for help on using the browser.