|
@@ -78,15 +78,18 @@ def event_loop(window):
|
|
|
if stop_button_is_pushed(event):
|
|
|
worked_time_in_minutes = timer.get_passed_time() / 60
|
|
|
selected_task_name = window.Element(TASK_TREE_COMBO_NAME).get()
|
|
|
- current_task = taskHandler.get_task_by_id(taskHandler.get_task_id(selected_task_name))
|
|
|
- current_branch = taskHandler.get_task_branch_as_string(current_task)
|
|
|
- try:
|
|
|
- save_recorded_time_in_table.save_recorded_time_in_table(worked_time_in_minutes, current_branch)
|
|
|
- timer.stop()
|
|
|
- print('Timer stopped recording for task: ' + selected_task_name.strip())
|
|
|
- except PermissionError:
|
|
|
- print("Error: couldn't write into table file. Please close any program that uses the table" +
|
|
|
- " and press 'Stop Timer' again")
|
|
|
+ if selected_task_name:
|
|
|
+ current_task = taskHandler.get_task_by_id(taskHandler.get_task_id(selected_task_name))
|
|
|
+ current_branch = taskHandler.get_task_branch_as_string(current_task)
|
|
|
+ try:
|
|
|
+ save_recorded_time_in_table.save_recorded_time_in_table(worked_time_in_minutes, current_branch)
|
|
|
+ timer.stop()
|
|
|
+ print('Timer stopped recording for task: ' + selected_task_name.strip())
|
|
|
+ except PermissionError:
|
|
|
+ print("Error: couldn't write into table file. Please close any program that uses the table" +
|
|
|
+ " and press 'Stop Timer' again")
|
|
|
+ else:
|
|
|
+ print('Please select a Task before stopping the timer')
|
|
|
|
|
|
if add_sub_task_button_is_pushed(event):
|
|
|
sub_task_name = window.Element(NEW_TASK_TEXT_KEY).get()
|