Skip to content

Dooit Events

Dooit emits event when certain things happen, you can use @subscribe or @timer to execute code when that event fires

Timer Usage

❕ NOTE

Timer is not an event, it just tells dooit to update a function every X seconds

python
from dooit.ui.api import DooitAPI, timer

@timer(1) # in seconds
def foo(api: DooitAPI):
    # your code here

Subscribe Usage

Subscribe can be used to execute and update values of function on a particular event It takes in two parameters: api and event which are a copy of dooit api and the event respectively

python
from dooit.ui.api.events import DooitEvent
from dooit.ui.api import DooitAPI, subscribe

@subscribe(DooitEvent)
def foo(api: DooitAPI, event: DooitEvent):
    # your code here

You can find all the available events below

DooitEvent

Triggered for all dooit events.

WorkspaceEvent

Triggered for all workspace related events i.e. creation/modification/deletion etc.

Parameters:

Param
Default
Description
workspaceThe workspace object associated with the event.

TodoEvent

Triggered for all todo related events i.e. creation/modification/deletion etc.

Parameters:

Param
Default
Description
todoThe todo object associated with the event.

Startup

Triggered when the app starts.

ShutDown

Triggered when the user presses the exit app keybind.

SwitchTab

Triggered when the user switches focus to another pane.

SpawnHelp

Triggered when the user presses ? in NORMAL mode.

ModeChanged

Triggered when there is a change in the status mode.

Parameters:

Param
Default
Description
modeThe new mode (ModeType) that was set.

StartSearch

Triggered when the user initiates a search operation.

StartSort

Triggered when the user initiates a sort operation.

Parameters:

Param
Default
Description
modelThe model (Todo or Workspace) to be sorted.

ShowConfirm

Triggered when a user confirmation is required.

WorkspaceSelected

Triggered when the user selects a workspace.

Parameters:

Param
Default
Description
workspaceThe workspace object selected by the user.

WorkspaceRemoved

Triggered when the user removes a workspace.

Parameters:

Param
Default
Description
workspaceThe workspace object that was removed.

WorkspaceDescriptionChanged

Triggered when the user updates the description of a workspace.

Parameters:

Param
Default
Description
oldThe previous description of the workspace.
newThe updated description of the workspace.
workspaceThe workspace object whose description was changed.

TodoSelected

Triggered when the user selects a todo.

Parameters:

Param
Default
Description
todoThe todo object selected by the user.

TodoRemoved

Triggered when the user removes a todo.

Parameters:

Param
Default
Description
todoThe todo object that was removed.

TodoDescriptionChanged

Triggered when the user updates the description of a todo.

Parameters:

Param
Default
Description
oldThe previous description of the todo.
newThe updated description of the todo.
todoThe todo object whose description was changed.

TodoDueChanged

Triggered when the user updates the due date of a todo.

Parameters:

Param
Default
Description
oldThe previous due date of the todo.
newThe updated due date of the todo.
todoThe todo object whose due date was changed.

TodoStatusChanged

Triggered when the user updates the status of a todo.

Parameters:

Param
Default
Description
oldThe previous status of the todo.
newThe updated status of the todo.
todoThe todo object whose status was changed.

TodoEffortChanged

Triggered when the user updates the effort level of a todo.

Parameters:

Param
Default
Description
oldThe previous effort level of the todo.
newThe updated effort level of the todo.
todoThe todo object whose effort level was changed.

TodoRecurrenceChanged

Triggered when the user updates the recurrence of a todo.

Parameters:

Param
Default
Description
oldThe previous recurrence interval of the todo.
newThe updated recurrence interval of the todo.
todoThe todo object whose recurrence interval was changed.

TodoUrgencyChanged

Triggered when the user updates the urgency level of a todo.

Parameters:

Param
Default
Description
oldThe previous urgency level of the todo.
newThe updated urgency level of the todo.
todoThe todo object whose urgency level was changed.