Class MAProcessor

class ooodev.gui.menu.ma.MAProcessor(container)[source]

Bases: EventsPartial

Class for processing App menus. Does not process submenus

Parameters:

container (List[MAItem]) –

__init__(container)[source]

Constructor

Parameters:

container (List[MAItem]) – Menu item data.

Return type:

None

add_event_observers(*args)

Adds observers that gets their trigger method called when this class trigger method is called.

Parameters:

args (EventObserver) – One or more observers to add.

Return type:

None

Note

Observers are removed automatically when they are out of scope.

get_action_item(menu, index)[source]

Get Action item

Return type:

MAItem | None

Parameters:
  • menu (dict) –

  • index (int) –

process(menu, index)[source]

Process menu item

Return type:

MAItem | None

Parameters:
  • menu (dict) –

  • index (int) –

remove_event_observer(observer)

Removes an observer

Parameters:

observer (EventObserver) – One or more observers to add.

Returns:

True if observer has been removed; Otherwise, False.

Return type:

bool

subscribe_event(event_name, callback)

Add an event listener to current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

trigger_event(event_name, event_args)

Trigger an event on current instance.

Parameters:
  • event_name (str) – Event Name.

  • event_args (EventArgsT) – Event Args.

Return type:

None

unsubscribe_event(event_name, callback)

Remove an event listener from current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

property event_observer: EventObserver

Gets/Sets The Event Observer for this instance.

Return type:

EventObserver