Skip to content

Commit

Permalink
fix: dont show help menu when not in normal node (closes #214)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraanzu committed Nov 25, 2024
1 parent 0e623cf commit 27e9b7d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions dooit/ui/api/dooit_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,7 @@ def decrease_urgency(self):
"""Decrease the urgency of the todo"""
if isinstance(self.focused, TodosTree):
self.focused.decrease_urgency()

def show_help(self):
"""Show the help screen"""
self.focused.show_help()
6 changes: 3 additions & 3 deletions dooit/ui/widgets/trees/model_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ def add_children_recurse(model: ModelType):
def on_mount(self):
self.force_refresh()

def key_question_mark(self):
self.app.push_screen("help")

@require_highlighted_node
def start_sort(self):
self.post_message(StartSort(self.current_model, self.sort))
Expand Down Expand Up @@ -341,6 +338,9 @@ def sort(self, attr: str):
else:
self.current_model.sort_siblings(attr)

def show_help(self):
self.app.push_screen("help")

def compose(self) -> ComposeResult:
with Label(id="empty_message"):
yield Label("No items to display")
1 change: 1 addition & 0 deletions dooit/utils/default_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def key_setup(api: DooitAPI, _):
api.keys.set("/", api.start_search)
api.keys.set("<ctrl+s>", api.start_sort)
api.keys.set("<ctrl+q>", api.quit)
api.keys.set("?", api.show_help)


@subscribe(Startup)
Expand Down

0 comments on commit 27e9b7d

Please sign in to comment.