Skip to content

Commit

Permalink
show runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
hirusha-adi committed Jan 24, 2024
1 parent aa730bb commit a51a249
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a51a249

Please sign in to comment.