Skip to content

Commit 130bb95

Browse files
authored
Merge pull request #47 from Alan0943/main
Stop button now force quits
2 parents 08b281f + ed0e783 commit 130bb95

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

app/app.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ def send_user_request_from_ui_to_core(self) -> None:
6262

6363
if user_request == 'stop':
6464
self.core.stop_previous_request()
65+
66+
# ensures all threads are joined before force quit (my code)
67+
try:
68+
for thread in threading.enumerate():
69+
if thread != threading.main_thread():
70+
thread.join(timeout=2)
71+
except Exception as e:
72+
continue
73+
6574
else:
6675
threading.Thread(target=self.core.execute_user_request, args=(user_request,), daemon=True).start()
6776

app/ui.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ def stop_previous_request(self) -> None:
317317
# Interrupt currently running request by queueing a stop signal.
318318
self.user_request_queue.put('stop')
319319

320+
# force quit program
321+
self.destroy()
322+
320323
def display_input(self) -> str:
321324
# Get the entry and update the input display
322325
user_input = self.entry.get()

0 commit comments

Comments
 (0)