aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-07-24 14:26:43 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-07-24 14:26:43 -0300
commit59ddd744827a6b937118475273af010ea7d279e1 (patch)
tree93fae4d3b05f108c990c1e1e65a21a3ca34649b3 /packages
parent321abf096a1d82134180022bc16e596dc27b702f (diff)
downloadfinder-59ddd744827a6b937118475273af010ea7d279e1.tar.gz
finder-59ddd744827a6b937118475273af010ea7d279e1.tar.bz2
Feat: adds update_list()
Diffstat (limited to 'packages')
-rw-r--r--packages/finder/main.py29
1 files changed, 12 insertions, 17 deletions
diff --git a/packages/finder/main.py b/packages/finder/main.py
index f562322..f1fca16 100644
--- a/packages/finder/main.py
+++ b/packages/finder/main.py
@@ -53,20 +53,20 @@ class FinderMain():
return True
def change(self, _):
- # Text for the buffer
- text = self.format(self.searcher.filter(self.input_field.text))
-
- # This only works when the buffer is read-write
- #self.output_buffer.text = text
-
- # For read-only buffers
- self.output_buffer.set_document(Document(text), bypass_readonly=True)
+ self.update_list(self.searcher.filter(self.input_field.text))
def open(self):
item = self.output_buffer.document.current_line
self.opener.open(os.path.join(self.path, item))
+ def update_list(self, items):
+ # This only works when the buffer is read-write
+ #self.output_buffer.text = self.format(items)
+
+ # For read-only buffers
+ self.output_buffer.set_document(Document(self.format(items)), bypass_readonly=True)
+
def bindings(self):
self.keybindings = KeyBindings()
@@ -168,16 +168,11 @@ class FinderMain():
from .plugin.searcher.file.name import FinderPluginFileNameSearcher
from .plugin.opener.file.xdg import FinderPluginFileXdgOpener
- self.searcher = FinderPluginFileNameSearcher(self.path)
- self.opener = FinderPluginFileXdgOpener()
- self.state['loading'] = False
- text = self.format(await self.searcher.finder())
+ self.searcher = FinderPluginFileNameSearcher(self.path)
+ self.opener = FinderPluginFileXdgOpener()
+ self.state['loading'] = False
- # This only works when the buffer is read-write
- #self.output_buffer.text = text
-
- # For read-only buffers
- self.output_buffer.set_document(Document(text), bypass_readonly=True)
+ self.update_list(await self.searcher.finder())
def run(self):
return asyncio.run(self.main())