| 1 |
""" |
|---|
| 2 |
Top level interface definitions for Gaphor. |
|---|
| 3 |
""" |
|---|
| 4 |
|
|---|
| 5 |
from zope import interface |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
class IService(interface.Interface): |
|---|
| 9 |
""" |
|---|
| 10 |
Base interface for all services in Gaphor. |
|---|
| 11 |
""" |
|---|
| 12 |
|
|---|
| 13 |
def init(self, application): |
|---|
| 14 |
""" |
|---|
| 15 |
Initialize the service, this method is called after all services |
|---|
| 16 |
are instantiated. |
|---|
| 17 |
""" |
|---|
| 18 |
|
|---|
| 19 |
def shutdown(self): |
|---|
| 20 |
""" |
|---|
| 21 |
Shutdown the services, free resources. |
|---|
| 22 |
""" |
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
class IServiceEvent(interface.Interface): |
|---|
| 26 |
""" |
|---|
| 27 |
An event emitted by a service. |
|---|
| 28 |
""" |
|---|
| 29 |
service = interface.Attribute("The service that emits the event") |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
class ITransaction(interface.Interface): |
|---|
| 33 |
""" |
|---|
| 34 |
The methods each transaction should adhere. |
|---|
| 35 |
""" |
|---|
| 36 |
|
|---|
| 37 |
def commit(self): |
|---|
| 38 |
""" |
|---|
| 39 |
Commit the transaction. |
|---|
| 40 |
""" |
|---|
| 41 |
|
|---|
| 42 |
def rollback(self): |
|---|
| 43 |
""" |
|---|
| 44 |
Roll back the transaction. |
|---|
| 45 |
""" |
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
class ITransactionEvent(interface.Interface): |
|---|
| 49 |
""" |
|---|
| 50 |
Events related to transaction workflow (begin/commit/rollback) implements |
|---|
| 51 |
this interface. |
|---|
| 52 |
""" |
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
class IActionProvider(interface.Interface): |
|---|
| 56 |
""" |
|---|
| 57 |
An action provider is a special service that provides actions |
|---|
| 58 |
(see gaphor/action.py) and the accompanying XML for the UI manager. |
|---|
| 59 |
""" |
|---|
| 60 |
|
|---|
| 61 |
menu_xml = interface.Attribute("The menu XML") |
|---|
| 62 |
|
|---|
| 63 |
action_group = interface.Attribute("The accompanying ActionGroup") |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
class IActionExecutedEvent(interface.Interface): |
|---|
| 67 |
""" |
|---|
| 68 |
An event emited when an action has been performed. |
|---|
| 69 |
""" |
|---|
| 70 |
name = interface.Attribute("Name of the action performed, if any") |
|---|
| 71 |
action = interface.Attribute("The performed action") |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|