mafw.ui.abstract_user_interface

An abstract generic user interface.

The module provides a generic user interface that can be implemented to allow MAFw to communicate with different user interfaces.

MAFw is designed to operate seamlessly without a user interface; however, users often appreciate the added benefit of communication between the process execution and themselves.

There are several different interfaces and different interface types (Command Line, Textual, Graphical…) and everyone has its own preferences. In order to be as generic as possible, MAFw is allowing for an abstract interface layer so that the user can either decide to use one of the few coming with MAFw or to implement the interface to their favorite interface.

Classes

UserInterfaceBase()

The abstract base user interface class.

UserInterfaceMeta

A metaclass used for the creation of user interface

class mafw.ui.abstract_user_interface.UserInterfaceBase[source]

Bases: object

The abstract base user interface class.

create_task(task_name: str, task_description: str = '', completed: int = 0, increment: int | None = None, total: int | None = None, **kwargs: Any) None[source]

Create a new task.

Parameters:
  • task_name (str) – A unique identifier for the task. You cannot have more than 1 task with the same name in the whole execution. If you want to use the processor name, it is recommended to use the unique_name.

  • task_description (str, Optional) – A short description for the task. Defaults to None.

  • completed (int, Optional) – The amount of task already completed. Defaults to None.

  • increment (int, Optional) – How much of the task has been done since last update. Defaults to None.

  • total (int, Optional) – The total amount of task. Defaults to None.

display_progress_message(message: str, i_item: int, n_item: int | None, frequency: float) None[source]

Display a message during the process execution.

Parameters:
  • message (str) – The message to be displayed.

  • i_item (int) – The current item enumerator.

  • n_item (int | None) – The total number of items or None for an indeterminate progress (while loop).

  • frequency (float) – How often (in percentage of n_item) to display the message.

update_task(task_name: str, completed: int = 0, increment: int | None = None, total: int | None = None, **kwargs: Any) None[source]

Update an existing task.

Parameters:
  • task_name (str) – A unique identifier for the task. You cannot have more than 1 task with the same name in the whole execution. If you want to use the processor name, it is recommended to use the unique_name.

  • completed (int, Optional) – The amount of task already completed. Defaults to None.

  • increment (int, Optional) – How much of the task has been done since last update. Defaults to None.

  • total (int, Optional) – The total amount of task. Defaults to None.

always_display_progress_message = 10

Threshold for displaying progress messages.

If the total number of events is below this value, then the progress message is always displayed, otherwise follow the standard update frequency.

name = 'base'

The name of the interface

class mafw.ui.abstract_user_interface.UserInterfaceMeta[source]

Bases: type

A metaclass used for the creation of user interface