Sustav događaja

Sustav događaja u Gaphoru pruža API za rukovanje događajima i za pretplatu na događaje.

U Gaphoru upravljamo pretplatama za rukovanje događajima putem usluge „Upravljač događaja”. Gaphor je izrazito vođen događajima:

  • Promjene u učitanom modelu emitiraju se kao događaji

  • Promjene u dijagramima emitiraju se kao događaji

  • Promjene u korisničkom sučelju emitiraju se kao događaji

Although Gaphor depends heavily on GTK for its user interface, Gaphor is using its own event dispatcher. Events can be structured in hierarchies. For example, an AttributeUpdated event is a subtype of ElementUpdated. If we are interested in all changes to elements, we can also register ElementUpdated and receive all AttributeUpdated events as well.

class gaphor.core.eventmanager.EventManager[source]

Upravljač događaja.

handle(*events: object) None[source]

Send event notifications to registered handlers.

priority_subscribe(handler: Callable[[object], None]) None[source]

Register a handler.

Priority handlers are executed directly. They should not raise other events, cause that can cause a problem in the exection order.

U osnovi osigurava da sve događaje snima upravljač poništavanja.

shutdown() None[source]

Shutdown the services, free resources.

subscribe(handler: Callable[[object], None]) None[source]

Register a handler.

Handlers are triggered (executed) when specific events are emitted through the handle() method.

unsubscribe(handler: Callable[[object], None]) None[source]

Unregister a previously registered handler.

Under the hood events are handled by the Generics library. For more information about how the Generic library handles events see the Generic documentation.