From a51a24922813418537651c1f6c75521962e17e5e Mon Sep 17 00:00:00 2001 From: Hirusha Adikari <36286877+hirusha-adi@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:13:21 +0530 Subject: [PATCH] show runtime --- search.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/search.py b/search.py index 2416b4e..265180e 100644 --- a/search.py +++ b/search.py @@ -83,6 +83,7 @@ def __init__(self, root): def clear_entries(self): self.target_word_entry.delete(0, tk.END) self.found_files_listbox.delete(0, tk.END) + self.result_label.config(text=f"Made by @hirushaadi") def check(self, fpath, target): try: @@ -159,12 +160,17 @@ def search(self): self.root.update_idletasks() def search_in_thread(): + start_time = time.time() found_files = self.docx_search(target_word=target_word) + end_time = time.time() + runtime = end_time - start_time + progress_window.progress_thread.running = False progress_window.progress_thread.join() - self.result_label.config(text=f"Found '{target_word}' in {len(found_files)} files") - + self.result_label.config(text=f"Found '{target_word}' in {len(found_files)} files in {runtime:2f}s") + logger.debug(f"Found '{target_word}' in {len(found_files)} files in {runtime:2f}s") + self.found_files_listbox.delete(0, tk.END) for file_path in found_files: self.found_files_listbox.insert(tk.END, file_path)