From f7bf7ba06f8a1aac21c6ec8191477567a625e660 Mon Sep 17 00:00:00 2001
From: destinyk <destiny.kuehn@student.nmt.edu>
Date: Mon, 4 Dec 2023 16:34:48 -0700
Subject: [PATCH] add run var so user can cancel thread

---
 mseedpeek/mseedpeek.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mseedpeek/mseedpeek.py b/mseedpeek/mseedpeek.py
index 59d0c28..8da242e 100644
--- a/mseedpeek/mseedpeek.py
+++ b/mseedpeek/mseedpeek.py
@@ -806,6 +806,7 @@ class MainWindow(QWidget):
         as a thread
         """
 
+        self.run_find_trace = 1
         self.begin_thread("Find Trace",
                           self.find_trace,
                           self.after_find_trace)
@@ -831,6 +832,8 @@ class MainWindow(QWidget):
                 print("Directory Read Error: %s" % e)
 
             for file in listfiles:
+                if not self.run_find_trace:
+                    break
                 if mod(cnt, 5):
                     pass
                 else:
@@ -1494,7 +1497,7 @@ class MainWindow(QWidget):
         """
 
         if title == "Find Trace":
-            self.run_build_trace = 0
+            self.run_find_trace = 0
 
 
 class SliderBox(QGroupBox):
-- 
GitLab