10.6.14. Class cerebro.events.BeforeEventChangingOfTasks¶
- 
class cerebro.events.BeforeEventChangingOfTasks(event_type, event_id)[source]¶
- 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. - Methods - 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_eventand- 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()[source]¶
- 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.Taskclass to define the type.- Note - Use the - corresponding methodsof 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)[source]¶
- Parameters: - val – parameter value. - Sets a new value of the property being changed. - The type of the new value depends on the property being changed. Check the methods of setting up similar properties of the - cerebro.aclasses.Taskclass 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 
 
-