The cerebro.events module contains descriptions of event classes and types, which are passed into the functions of event handling module.
The event types are described in the Event event base class.
10.6.10 cerebro.events.BeforeEventChangingOfAttachmentsHashtags
10.6.13 cerebro.events.BeforeEventChangingOfMessagesHashtags
classcerebro.events.AfterEventChangingOfAttachments(event_type, event_id)
Bases: cerebro.events.EventChangingOfAttachments
The class for the property change event - for a single attachment or several attachments at once. It grants access to the data of the modified attachments after writing it into the database.
Warning
this class is used to handle the changes of most part of the properties, but not all of them. In order to handle, for example, tag modifying, some other classes should be used. See the complete list of event classes.
The class object is input into the following function: after_event of the module event.
def after_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_ATTACHMENT_HASHTAGS:
...
See also
classcerebro.events.AfterEventChangingOfMessage(event_type, event_id)
Bases: cerebro.events.AfterEventMessage
The class for the message editing event. It grants access to the data of the modified message after writing it into the database.
The class object is input into the following function: after_event of the module event
def after_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_MESSAGE:
...
See also
classcerebro.events.AfterEventChangingOfMessages(event_type, event_id)
Bases: cerebro.events.EventChangingOfMessages
The class for the property change event - for a single message or several messages at once. It grants access to the data of the modified messages after writing it into the database.
Warning
this class is used to handle the changes of most part of the properties, but not all of them. In order to handle, for example, tag modifying, some other classes should be used. See the complete list of event classes.
The class object is input into the following function: after_event of the module event
def after_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_MESSAGE_FLAGS:
...
See also
classcerebro.events.AfterEventChangingOfTasks(event_type, event_id)
Bases: cerebro.events.EventChangingOfTasks
The class for the property change event - for a single task or several tasks at once. It grants access to the data of the modified tasks after writing it into the database.
Warning
this class is used to handle the changes of most part of the properties, but not all of them. In order to handle, for example, tag modifying, some other classes should be used. See the complete list of event classes.
The class object is input into the following function: after_event of the module event.
def after_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_TASKS_PROGRESS:
...
See also
classcerebro.events.AfterEventChangingOfTasksTag(event_type, event_id)
Bases: cerebro.events.AfterEventChangingOfTasks
The class for the tag value altering event - for a single or for multiple task(s). It grants access to the data of the modified tasks after writing it into the database.
The class object is input into the following function: after_event of the module event.
def after_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_TASKS_TAG:
...
See also
tag()
Returns: | the changed tag. |
Return type: | cerebro.aclasses.AbstractTag |
classcerebro.events.AfterEventCreationOfMessage(event_type, event_id)
Bases: cerebro.events.AfterEventMessage
The class for the task creation event. Grants access to the data of a newly created message after it is written into the database.
The class object is input into the following function: after_event of the module event.
def after_event(event):
if event.event_type() == event.EVENT_CREATION_OF_MESSAGE:
...
See also
classcerebro.events.AfterEventCreationOfTask(event_type, event_id)
Bases: cerebro.events.Event , cerebro.aclasses.Task
The class for the task creation event. It grants access to the data of the new task after writing it into the database.
The class object is input into the following function: after_event of the module event.
def after_event(event):
if event.event_type() == event.EVENT_CREATION_OF_TASK:
...
See also
definition()
Returns: | a new message of the "Definition" type. |
Return type: | cerebro.events.AfterEventCreationOfMessage |
if event.event_type() == event.EVENT_CREATION_OF_TASK:
message = event.definition()
...
classcerebro.events.AfterEventMessage(event_type, event_id)
Bases: cerebro.events.Event, cerebro.aclasses.Message
The base class for the task creation/change event. It grants access to the data of a created/modified message after it is written into the database.
See also
new_attachments()
Returns: | a list of new attachments to the message. |
Return type: | list( cerebro.aclasses.AbstractAttachment) |
resources()
Returns: | a list of resources being reported for. |
Return type: | list(tuple,) - [(resource_id, resource_name),] - a list of tuples consisting of two fields: a resource ID and a resource name. |
Resources are available in the "Resource Report" type only. If the message type is not the “Resource Report”, “None” is being returned.
if event.type() == event.TYPE_RESOURCE_REPORT:
print('resources()', event.resources())
classcerebro.events.BeforeEventChangingOfAttachments(event_type, event_id)
Bases: cerebro.events.EventChangingOfAttachments
The class for attachment properties change - for a single attachment or several attachments at once. It grants access to the data of the modified attachment before writing it into the database.
Warning
this class is used to handle the changes of most part of the properties, but not all of them. In order to handle, for example, tag modifying, some other classes should be used. See the complete list of event classes.
The class object is input into the functions before_event and error_event (in case of error) of the module event.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_ATTACHMENT_HASHTAGS:
...
See also
new_value()
Returns: | a new value of the property undergoing changing. |
The type of the returning value depends on the Property being changed. Check the methods on getting the values of similar properties of the cerebro.aclasses.Message class to define the type.
Note
Use the corresponding methods of the tasks being edited messages() to find out the current values.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_MESSAGE_HASHTAGS: # activity type is being changed
tasks = event.messages()
for message in messages:
print('Message name', message.name())
print('Previous activity type', message.activity())
print('New activity type', event.new_value())
set_new_value(val)
Parameters: | val – parameter value. |
The type of the new value depends on the property being changed. Check the methods of setting up similar properties of the cerebro.aclasses.Attachment class to define the type.
if event.type() == event.EVENT_CHANGING_OF_ATTACHMENT_HASHTAGS:
attachment_name = event.new_value()
if attachment_name.isupper() == False:
new_name = attachment_name.upper() # changing the symbols to the upper register
event.set_new_value(new_name) # substituting the value entered by user for the new one
classcerebro.events.BeforeEventChangingOfAttachmentsHashtags(event_type, event_id)
Bases: cerebro.events.BeforeEventChangingOfAttachments
The class for the attachment hashtags changing event. It grants access to the attachment hashtags being changed before writing them into the database.
The class object is input into the functions before_event and error_event (in case of error) of the module event.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_ATTACHMENT_HASHTAGS:
...
is_added()
Returns: | True, if hashtags are being added to attachment. False, is being removed. |
Return type: | bool |
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_ATTACHMENT_HASHTAGS: # hashtags is being changed
if event.is_added() == False: # hashtags are being dismissed
# asking the user if he/she is sure to do it
q = 'Are you sure you want to remove hashtags from the attachment?'
if cerebro.gui.question_box('User list change', q) == False: # if the user is not sure
raise Exception('')
# Hashtags will remain added to the attachment
classcerebro.events.BeforeEventChangingOfMessage(event_type, event_id)
Bases: cerebro.events.BeforeEventMessage
The class for the message editing event. It grants access to the data of the message being modified before writing it into the database.
The class object is input into the functions before_event and error_event (in case of error) of the module event.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_MESSAGE:
...
See also
existing_attachments()
Returns: | the list of actual attachments that were added to the message before. |
Return type: | list(cerebro.aclasses.AbstractAttachment,) |
original_message()
Returns: | the message in its previous state (before undergoing current modifications). |
Return type: | cerebro.aclasses.Message |
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_MESSAGE:
orig_message = event.original_message()
# Comparing the current (after a message modification) working time value and its original (before the modification) value
if event.work_time() != orig_message.work_time():
raise Exception('You can't change the working time!')
classcerebro.events.BeforeEventChangingOfMessages(event_type, event_id)
Bases: cerebro.events.EventChangingOfMessages
The class for message properties change - for a single message or several messages at once. It grants access to the data of the modified messages before writing it into the database.
Warning
This class is used to handle the changes of most part of the properties, but not all of them. In order to handle, for example, tag modifying, some other classes should be used. See the complete list of event classes.
The class object is input into the functions before_event and error_event (in case of error) of the module event.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_MESSAGE_APPROVED:
...
See also
new_value()
Returns: | a new value of the property undergoing changing. |
The type of the returning value depends on the Property being changed. Check the methods on getting the values of similar properties of the cerebro.aclasses.Message class to define the type.
Note
Use the corresponding methods of the tasks being edited messages() to find out the current values.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_MESSAGE_HASHTAGS: # activity type is being changed
messages = event.messages()
for message in messages:
print('Message name', message.name())
print('Previous activity type', message.activity())
print('New activity type', event.new_value())
set_new_value(val)
Parameters: | val – parameter value. |
The type of the new value depends on the property being changed. Check the methods of setting up similar properties of the cerebro.aclasses.Message class to define the type.
if event.type() == event.EVENT_CHANGING_OF_MESSAGE_HASHTAGS:
message_name = event.new_value()
if task_name.isupper() == False:
new_name = task_name.upper() # changing the symbols to the upper register
event.set_new_value(new_name) # substituting the value entered by user for the new one
classcerebro.events.BeforeEventChangingOfMessagesHashtags(event_type, event_id)
Bases: cerebro.events.BeforeEventChangingOfMessages
The class for the message hashtags changing event. It grants access to the message hashtags being changed before writing them into the database.
The class object is input into the functions before_event and error_event (in case of error) of the module event.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_MESSAGE_HASHTAGS:
...
is_added()
Returns: | True, if hashtags are being added to message. False, is being removed. |
Return type: | bool |
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_MESSAGE_HASHTAGS: # hashtags is being changed
if event.is_added() == False: # hashtags are being dismissed
# asking the user if he/she is sure to do it
q = 'Are you sure you want to remove hashtags from the message?'
if cerebro.gui.question_box('User list change', q) == False: # if the user is not sure
raise Exception('')
# Hashtags will remain added to the message
classcerebro.events.BeforeEventChangingOfTasks(event_type, event_id)
Bases: cerebro.events.EventChangingOfTasks
The class for task properties change - for a single task or several tasks at once. It grants access to the data of the modified tasks before writing it into the database.
Warning
this class is used to handle the changes of most part of the properties, but not all of them. In order to handle, for example, tag modifying, some other classes should be used. See the complete list of event classes.
The class object is input into the functions before_event and error_event (in case of error) of the module event.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_TASKS_PROGRESS:
...
See also
new_value()
Returns: | a new value of the property undergoing changing. |
Note
Use the corresponding methods of the tasks being edited tasks() to find out the current values.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_TASKS_ACTIVITY: # activity type is being changed
tasks = event.tasks()
for task in tasks:
print('Task name', task.name())
print('Previous activity type', task.activity())
print('New activity type', event.new_value())
set_new_value(val)
Parameters: | val – parameter value. |
The type of the new value depends on the property being changed. Check the methods of setting up similar properties of the cerebro.aclasses.Task class to define the type.
if event.type() == event.EVENT_CHANGING_OF_TASKS_NAME:
task_name = event.new_value()
if task_name.isupper() == False:
new_name = task_name.upper() # changing the symbols to the upper register
event.set_new_value(new_name) # substituting the value entered by user for the new one
classcerebro.events.BeforeEventChangingOfTasksAllocated(event_type, event_id)
Bases: cerebro.events.BeforeEventChangingOfTasks
The class for the allocating/dismissing users/resources to/from a single or multiple task(s). It grants access to the data of the modified tasks before writing it into the database.
The class object is input into the functions before_event and error_event (in case of error) of the module event.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_TASKS_ALLOCATED:
...
See also
is_added()
Returns: | True, if users/resources are being allocated to task(s). False, is being dismissed. |
Return type: | bool |
In case of allocating users/resources the method new_value() returns a list of users/resources being allocated. Otherwise, it returns a list of users being dismissed.
In order to change the list of users being allocated/dismissed use the method set_new_value(). The input argument for this method - list(user_id,), the list of user/resource IDs
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_TASKS_ALLOCATED: # the tasks allocated is being changed
if event.is_added() == False: # the users are being dismissed
# asking the user if he/she is sure to do it
q = 'Are you sure you want to dismiss the users from the task?'
if cerebro.gui.question_box('User list change', q) == False: # if the user is not sure
raise Exception('')
# The users will remain allocated to the task
classcerebro.events.BeforeEventChangingOfTasksHashtags(event_type, event_id)
Bases: cerebro.events.BeforeEventChangingOfTasks
The class object is input into the functions before_event and error_event (in case of error) of the module event.
The class object is input into the functions before_event and error_event (in case of error) of the module event.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_TASKS_HASHTAGS:
...
is_added()
Returns: | True, if hashtags are being added to task(s). False, is being removed. |
Return type: | bool |
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_TASKS_HASHTAGS: # hashtags is being changed
if event.is_added() == False: # hashtags are being dismissed
# asking the user if he/she is sure to do it
q = 'Are you sure you want to remove hashtags from the task?'
if cerebro.gui.question_box('User list change', q) == False: # if the user is not sure
raise Exception('')
# Hashtags will remain added to the task
classcerebro.events.BeforeEventChangingOfTasksTag(event_type, event_id)
Bases: cerebro.events.BeforeEventChangingOfTasks
The class for the tag value altering event - for a single or for multiple task(s). It grants access to the data of the modified tasks before writing it into the database.
Note
Tags in Cerebro are used as additional task properties. A tag, being allocated to a project, becomes a task property automatically. The tags acquire values in the process of working on the tasks.
The class object is input into the functions before_event and error_event (in case of error) of the module event.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_TASKS_TAG:
...
See also
is_added_elements()
Returns: | True, if the tag type is "multi enum" and the elements are being added to the tag value. Otherwise, it is False. |
Return type: | bool |
In case of adding elements to the tag value, the method new_value() returns a list of the elements being added. Otherwise, it returns a list of elements being removed.
In order to change the list of elements being added/removed, use the method set_new_value(). The input argument type for this method - list(tag_element_id,), a list of the tag element IDs.
def before_event(event):
if event.event_type() == event.EVENT_CHANGING_OF_TASKS_TAG: # changing the activity type
if event.tag().type() == event.tag().TYPE_MULTI_ENUM and event.is_added_elements():
print('The tag elements being added', event.new_value())
tag()
Returns: | the tag undergoing modification. |
Return type: | cerebro.aclasses.AbstractTag |
classcerebro.events.BeforeEventCreationOfMessage(event_type, event_id)
Bases: cerebro.events.BeforeEventMessage
The class for the task creation event. Grants access to the data of a newly created message before it is written into the database.
The class object is input into the before_event and error_event (in case of error) functions of the event module.
def before_event(event):
if event.event_type() == event.EVENT_CREATION_OF_MESSAGE:
...
See also
add_hashtags(hashtags)
Parameters: | hashtags (string, set(string, ) or list(string, )) – hashtag or array of hashtags (every hashtag should be written in one word without spaces). |
See also
remove_hashtags(hashtags)
Parameters: | hashtags (string, set(string, ) or list(string, )) – hashtag or array of hashtags (every hashtag should be written in one word without spaces). |
See also
classcerebro.events.BeforeEventCreationOfTask(event_type, event_id)
Bases: cerebro.events.Event, cerebro.aclasses.Task
The class for the task creation event. It grants access to the data of the new task before writing it into the database.
The class object is input into the functions before_event and error_event (in case of error) of the module event
def before_event(event):
if event.event_type() == event.EVENT_CREATION_OF_TASK:
...
See also
definition()
Returns: | a new message of the "Definition" type. |
Return type: | cerebro.events.BeforeEventCreationOfMessage |
if event.event_type() == event.EVENT_CREATION_OF_TASK:
message = event.definition()
...
classcerebro.events.BeforeEventMessage(event_type, event_id)
Bases: cerebro.events.Event, cerebro.aclasses.AbstractMessage
The base class for the message creation/change events. It grants access to the data of the message being created/changed before the data is written to the database.
See also
add_attachment(file_path, comment='', name='', hashtags=None)
Parameters: | |
def before_event(event):
evtype = event.event_type()
if evtype == event.EVENT_CREATION_OF_MESSAGE or evtype == event.EVENT_CHANGING_OF_MESSAGE:
file_path = cerebro.core.python_api_dir() + '/examples/icon.png'
event.add_attachment(file_path, 'Added with Cerebro Python API')
See also
add_attachment_as_link(file_path, comment='', hashtags=None)
Parameters: | |
The file_path stands for the attachment name in this case.
See also
new_attachments()
Returns: | a list of new attchments to the message. |
Return type: | list(cerebro.aclasses.NewAttachment,) |
new_task_status()
Returns: | the new status of the task, which the user sets when creating / editing a message. ‘(0, ‘’)’ means, that the user sets the task status into ‘No Status’. |
Return type: | tuple(status_id, status_name) - a list of tuples consisting of two fields: a status ID and a status name. |
In the graphical interface of creating / editing the message, you can choose the status in which the task will go after the message is sent. If the user does not change the status, the new status will be equal to :py:meth:’the current task status <cerebro.aclasses.Task.status>’.
See also
resources()
Returns: | the list of resources being reported for. |
Return type: | list(tuple,) - [(resource_id, resource_name),] - a list of tuples consisting of two fields: a resource ID and a resource name. |
Resources are available in the "Resource Report" type only. If the message type is not the “Resource Report”, “None” is being returned.
if event.type() == event.TYPE_RESOURCE_REPORT:
print('resources()', event.resources())
set_approved(is_approved)
Parameters: | is_approved (bool) – If its value is True, the Report is being marked ‘Approved’, otherwise the ‘Approved’ is cleared. |
The ‘Approved’ flag means that, the declared working time to sign off is approved. The GUI marks the message with a green check mark.
This flag makes sense only for the "Report" or "Resource Report" message types.
if event.type() == event.TYPE_RESOURCE_REPORT:
event.set_approved(True)
set_client_visible(is_visible)
Parameters: | is_visible (bool) – If the value is True, the message is marked as visible for clients, otherwise it is invisible for clients. |
def before_event(event):
evtype = event.event_type()
if evtype == event.EVENT_CREATION_OF_MESSAGE:
event.set_client_visible(True)
set_html_text(text)
Parameters: | text (string) – html-formatted or unformatted text. |
set_new_task_status(status_id)
Parameters: | status_id (int) – status ID. |
# If a report is written and the new status is not equal to 'pending review',
# then setting this status
if event.type() == event.TYPE_REPORT and event.new_task_status()[1] != 'pending review':
task = cerebro.core.task(event.task_id())
possible_statuses = task.possible_statuses()
for status in possible_statuses:
if status[cerebro.aclasses.Statuses.DATA_NAME] == 'pending review': # Verify that the user can switch to the status
event.set_new_task_status(status[cerebro.aclasses.Statuses.DATA_ID])
break
See also
set_work_time(minutes)
Parameters: | minutes (float) – time (minutes). |
If the type of the message is "Report" or "Resource Report", it indicates the time signed off (declared by the current message author). If the type of the message is "Review", it indicates the time signed off and approved for the previous Report. For all the rest of the message types it is absurd to set working time.
if event.type() == event.TYPE_REPORT:
if event.work_time() > 60000: # if a user tries to sign off more than 1000 hours for the Report
raise Exception('This is too much, isn't it?') # an exception is being raised (the user will be displayed this message)
else event.work_time() < 60: # if the user tries to sign off less than 1 hour
event.set_work_time(60) # we are setting 1 hour (60 minutes) anyway
classcerebro.events.Event(event_type, event_id)
Event base class. All event classes are inhereited from this one.
EVENT_= ''
EVENT_CHANGING_OF_ATTACHMENT_HASHTAGS= 1010 | |
The attachment hashtags changing event. It is generated by changing the attachment hashtags in the table or in the Attachment Edit hashtags window. | The objects being input into the event functions: |
EVENT_CHANGING_OF_MESSAGE= 10 | |
The message editing event. It is generated in the message editing interface. | The objects being input into the event functions: |
EVENT_CHANGING_OF_MESSAGE_APPROVED= 13 | |
The message approved editing event. It is generated by editing appruved of messages. | The objects being input into the event functions: |
EVENT_CHANGING_OF_MESSAGE_CLIENT_VISIBLE= 14 | |
The message client visible event. | The objects being input into the event functions: |
EVENT_CHANGING_OF_MESSAGE_HASHTAGS= 12 | |
The message hashtags editing event. It is generated by editing hashtags of messages in the Forum interface. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_ACTIVITY= 111 | |
The task activity changing event. It is generated by changing the activity attribute in the table or in the Task Properties window. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_ALLOCATED= 118 | |
The event of allocating/dismissing users/resources to/from tasks. It is generated by changing the list of allocated users/resources in the table or in the Task Properties window. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_BUDGET= 117 | |
The task budget changing event. It is generated by changing the budget amount in the table or in the Task Properties window. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_FINISH= 116 | |
The event of task finishing point change. It is generated by changing the finish time in the table or in the Task Properties window, or in the Gantt chart. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_HASHTAGS= 124 | |
The task hashtags changing event. It is generated by changing the task hashtags in the table or in the Task Properties window. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_NAME= 110 | |
The task name changing event. It is generated by changing a task name in the table or in the Task Properties window. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_PLANNED_TIME= 114 | |
The event of changing of the estimated time to complete a task. It is generated by changing the estimated time in the table or in the Task Properties window. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_PRIORITY= 112 | |
The task priority changing event. It is generated by changing the task priority in the table or in the Task Properties window. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_PROGRESS= 113 | |
The task progress changing event. It is generated by changing the task progress in the table or in the Task Properties window or by pressing the “Mark the task Done” button. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_START= 115 | |
The event of task starting point change. It is generated by changing the start time in the table or in the Task Properties window, or in the Gantt chart. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_STATUS= 123 | |
The task status changing event. It is generated by changing the task status in the table or in the Task Properties window or in the task forum. | The objects being input into the event functions: |
EVENT_CHANGING_OF_TASKS_TAG= 121 | |
The task tag changing event. It is generated by changing tag values in the table or in the Task Properties window. | The objects being input into the event functions: |
EVENT_CREATION_OF_MESSAGE= 1 | |
The message creation event. It is generated by pressing the “Send” button in the message creation interface.
| The objects being input into the event functions: |
EVENT_CREATION_OF_TASK= 100 | |
The new task creation event. It is generated by pressing the “Send” button in the task creation interface.
On creation of a new task, a new message of the “Definition” type is being created, so the task creation event handles the creation of this message as well.
| The objects being input into the event functions: |
EVENT_TEST= 0 | |
Test event. It is generated by pressing the test event generation button. |
The objects being input into the event functions:
|
event_type()
Returns: | event type. |
Return type: | int |
type_str()
Returns: | string name of the event type. |
Return type: | string |
classcerebro.events.EventChangingOfAttachments(event_type, event_id)
Bases: cerebro.events.Event
The base class for the attachment properties change event (as for a single attachment so for several attachments at once). It grants access to the data of the modified attachments before writing it into the database.
Note
Several attachments may undergo one and the same properties change, and in this case only one event is generated.
attachments()
Returns: | a list of the attachments being modified by the user. |
Return type: | list((attach_id, cerebro.aclasses.Message),) |
classcerebro.events.EventChangingOfMessages(event_type, event_id)
Bases: cerebro.events.Event
The base class for the message properties change event (as for a single message so for several messages at once). It grants access to the data of the modified messages before writing it into the database.
Note
Several messages may undergo one and the same properties change, and in this case only one event is generated.
messages()
Returns: | a list of the messages being modified by the user. |
Return type: | list(cerebro.aclasses.Message,) |
classcerebro.events.EventChangingOfTasks(event_type, event_id)
Bases: cerebro.events.Event
The base class for the task properties change event (as for a single task so for several tasks at once). It grants access to the data of the modified tasks before writing it into the database.
Note
Several tasks may undergo one and the same properties change, and in this case only one event is generated.
tasks()
Returns: | a list of the tasks being modified by the user. |
Return type: | list(cerebro.aclasses.Task,) |
classcerebro.events.EventError(code, text)
The event error class.
It has two attributes:
It is input into the “error_event” function of the “event” module.
def error_event(error, event):
print(error)
print(error.code)
print(error.text)
classcerebro.events.TestEvent(event_type, event_id)
Bases: cerebro.events.Event
The test event class.
The test event is called by pressing the Call test event button on the Python debugging panel. This event is used to check if the event algorythm works properly.
The class object is input into the before_event, after_event, and error_event functions of the event module.
def after_event(event):
if event.event_type() == event.EVENT_TEST:
print('Test event is successful')