Skip to content

Commit

Permalink
fix dnd details
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvladus committed Dec 27, 2023
1 parent a4e80d8 commit 120cd10
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions errands/widgets/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,11 @@ def build_ui(self):
)
)

def add_task(self, uid: str) -> None:
def add_task(self, uid: str) -> Self:
new_task = Task(uid, self.list_uid, self.window, self.task_list, self, True)
self.tasks_list.append(new_task)
new_task.toggle_visibility(not new_task.get_prop("trash"))
return new_task

def add_sub_tasks(self) -> None:
subs = UserData.get_sub_tasks_uids(self.list_uid, self.uid)
Expand Down Expand Up @@ -362,6 +363,7 @@ def on_task_top_drop(self, _drop, task, _x, _y) -> bool:
self.parent.tasks_list.reorder_child_after(new_task, self)
self.parent.tasks_list.reorder_child_after(self, new_task)
new_task.toggle_visibility(True)
self.details.update_info(new_task)
# Update status
self.parent.update_status()
task.parent.update_status()
Expand Down Expand Up @@ -394,7 +396,8 @@ def on_drop(self, _drop, task: Self, _x, _y) -> None:
# Remove old task
task.purge()
# Add new sub-task
self.add_task(task.uid)
new_task = self.add_task(task.uid)
self.details.update_info(new_task)
self.update_props(["completed"], [False])
self.just_added = True
self.completed_btn.set_active(False)
Expand Down

0 comments on commit 120cd10

Please sign in to comment.