Closed lrustand closed 1 year ago
I have made implementations for these functions, but I do not have an account on Codeberg so I can't send you a pull request, so I will just paste it here.
def do_list_project(self):
projects = []
for t in self.tasks.all_items:
for c in t.task.projects:
if c not in projects:
projects.append(c)
if len(projects) == 0:
return
projects.sort()
if len(projects) == 1:
self.set_search('+'+projects[0])
else:
self.set_search('')
self.focus.append(Selector(self.tasks,
projects,
lambda c: self.add_to_search('+'+c),
title="Select project",
numbered=True))
self.paint(True)
def do_list_context(self):
contexts = []
for t in self.tasks.all_items:
for c in t.task.contexts:
if c not in contexts:
contexts.append(c)
if len(contexts) == 0:
return
contexts.sort()
if len(contexts) == 1:
self.set_search('@'+contexts[0])
else:
self.set_search('')
self.focus.append(Selector(self.tasks,
contexts,
lambda c: self.add_to_search('@'+c),
title="Select Context",
numbered=True))
self.paint(True)
Both really good ideas, thanks for the input!
Also, thanks a lot for the code snippet, I’ll have a look at it and keep you posted here about the progress :)
Alright then, have a look at version 3.5.0 -- the functions clear-search
(bound to ^
by default), select-project
(F6
), and select-context
(F7
) are now implemented.
Let me know if this solves the issue for you!
This is great, thanks! And so much cleaner than mine.
Thanks :slightly_smiling_face:; the starting point was your code at any rate!
Do you mind being added to the contributors?
Thanks, go ahead if you want. Although I wouldn't say I really did that much
I wouldn’t say I really did that much
Nobody ever does :smirk:
Similar to
search-context
andsearch-project
, but for all projects, not only those on the current item. I currently use manually created saved searches for all of my contexts, but this is very tedious and requires me to constantly update my list of saved searches. I would like to be able to press a keybind and then get a list of all projects/contexts to choose from.Also a keybind to clear the search or "go home" would be great. I tried to make a saved search with an empty search string for this purpose, but it does not get saved.