Skip to content

Commit

Permalink
fix: error on confirmatin
Browse files Browse the repository at this point in the history
  • Loading branch information
kraanzu committed Nov 10, 2024
1 parent a5fa260 commit ae31610
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions dooit/ui/widgets/trees/_decorators.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from functools import partial
from typing import Any, Callable, TYPE_CHECKING
from textual.widgets.option_list import OptionDoesNotExist

Expand Down Expand Up @@ -48,9 +49,11 @@ def wrapper(self: "ModelTree", *args, **kwargs) -> Any:

def require_confirmation(func: Callable) -> Callable:
def wrapper(self: "ModelTree", *args, **kwargs) -> Any:
function = partial(func, self, *args, **kwargs)

if not self.api.vars.show_confirm:
return func()
return function()

self.post_message(ShowConfirm(func, *args, **kwargs))
self.post_message(ShowConfirm(function))

return wrapper
2 changes: 1 addition & 1 deletion dooit/ui/widgets/trees/model_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ def add_sibling(self):
self.highlight_id(node.uuid)
self.start_edit("description")

@refresh_tree
@require_confirmation
@refresh_tree
def _remove_node(self):
self.current_model.drop()

Expand Down

0 comments on commit ae31610

Please sign in to comment.