| 1 |
""" |
|---|
| 2 |
Application wide events are managed here. |
|---|
| 3 |
""" |
|---|
| 4 |
|
|---|
| 5 |
from zope import interface |
|---|
| 6 |
from gaphor.interfaces import * |
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
class ServiceInitializedEvent(object): |
|---|
| 10 |
""" |
|---|
| 11 |
This event is emitted every time a new service has been initialized. |
|---|
| 12 |
""" |
|---|
| 13 |
interface.implements(IServiceEvent) |
|---|
| 14 |
|
|---|
| 15 |
def __init__(self, name, service): |
|---|
| 16 |
self.name = name |
|---|
| 17 |
self.service = service |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
class ServiceShutdownEvent(object): |
|---|
| 21 |
""" |
|---|
| 22 |
This event is emitted every time a service has been shut down. |
|---|
| 23 |
""" |
|---|
| 24 |
interface.implements(IServiceEvent) |
|---|
| 25 |
|
|---|
| 26 |
def __init__(self, name, service): |
|---|
| 27 |
self.name = name |
|---|
| 28 |
self.service = service |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
class TransactionBegin(object): |
|---|
| 32 |
""" |
|---|
| 33 |
This event denotes the beginning of an transaction. |
|---|
| 34 |
Nested (sub-) transactions should not emit this signal. |
|---|
| 35 |
""" |
|---|
| 36 |
interface.implements(ITransactionEvent) |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
class TransactionCommit(object): |
|---|
| 40 |
""" |
|---|
| 41 |
This event is emitted when a transaction (toplevel) is successfully |
|---|
| 42 |
commited. |
|---|
| 43 |
""" |
|---|
| 44 |
interface.implements(ITransactionEvent) |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
class TransactionRollback(object): |
|---|
| 48 |
""" |
|---|
| 49 |
If a set of operations fail (e.i. due to an exception) the transaction |
|---|
| 50 |
should be marked for rollback. This event is emitted to tell the operation |
|---|
| 51 |
has failed. |
|---|
| 52 |
""" |
|---|
| 53 |
interface.implements(ITransactionEvent) |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
class ActionExecuted(object): |
|---|
| 57 |
""" |
|---|
| 58 |
Once an operation has succesfully been executed this event is raised. |
|---|
| 59 |
""" |
|---|
| 60 |
interface.implements(IActionExecutedEvent) |
|---|
| 61 |
|
|---|
| 62 |
def __init__(self, name, action): |
|---|
| 63 |
self.name = name |
|---|
| 64 |
self.action = action |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|