RodTracker.ui.loggerwidget

TBD

class LoggerWidget(*args, **kwargs)[source]

Bases: QListWidget

A custom widget to maintain ActionLogger objects and display Action objects in the GUI.

This class maintains the ActionLogger objects that are used in the program. It also manages the location for any temporary files that are program session specific. This widget displays the logged actions in the GUI. Use an instance of this class to create new loggers for other objects of the GUI that perform actions that can be logged or reverted.

Parameters
  • *args (iterable) – Positional arguments for the QListWidget superclass.

  • **kwargs (dict) – Keyword arguments for the QListWidget superclass.

add_action(new_action: Action) None[source]

Adds a new action to the list being displayed in the GUI.

discard_changes()[source]

Discard unsaved changes in all maintained :class`ActionLogger` objects.

get_new_logger(parent_id: str) ActionLogger[source]

Creates a new ActionLogger, registers its signals for displaying the actions logged by it and returns it.

Parameters

parent_id (str) – A unique name that indicates the object from which actions will be logged in the ActionLogger.

Returns

ActionLogger

remove_action(undo_action: Action) None[source]

Removes an Action from the displayed list and deletes it.

property repeatable_changes: List[Action]

Collects the repeatable changes from all loggers and returns them collectively.

An ordered list of all currently redoable/repeatable actions that were logged by the ActionLogger objects maintained by this LoggerWidget instance. Do NOT try to insert performed actions in here directly. This property only derives its contents from the ActionLogger objects.

Returns

List[Action]

temp_manager: TemporaryDirectory
property unsaved_changes: List[Action]

Collects the unsaved changes from all loggers and returns them collectively.

An ordered list of all actions that were logged by the ActionLogger objects maintained by this LoggerWidget instance. Do NOT try to insert performed actions in here directly. This property only derives its contents from the ActionLogger objects.

Returns

List[Action]