Skip to content

Commit 0876eb0

Browse files
committed
Fix issue LazoVelko#197: Ctrl+C interrupt no longer causes Traceback error when slideshow is cleared.
1 parent ed8f7f4 commit 0876eb0

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

pokemonterminal/slideshow.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@ def __get_listener_thread(event):
1616

1717
def __slideshow_worker(filtered, delay, changer_func, event_name):
1818
with PlatformNamedEvent(event_name) as e:
19-
t = __get_listener_thread(e)
20-
random.shuffle(filtered)
21-
queque = iter(filtered)
22-
while t.is_alive():
23-
next_pkmn = next(queque, None)
24-
if next_pkmn is None:
25-
random.shuffle(filtered)
26-
queque = iter(filtered)
27-
continue
28-
changer_func(next_pkmn.get_path())
29-
t.join(delay * 60)
19+
try:
20+
t = __get_listener_thread(e)
21+
random.shuffle(filtered)
22+
queque = iter(filtered)
23+
while t.is_alive():
24+
next_pkmn = next(queque, None)
25+
if next_pkmn is None:
26+
random.shuffle(filtered)
27+
queque = iter(filtered)
28+
continue
29+
changer_func(next_pkmn.get_path())
30+
t.join(delay * 60)
31+
except KeyboardInterrupt:
32+
pass
3033

3134
def start(filtered, delay, changer_func, event_name):
3235
p = multiprocessing.Process(target=__slideshow_worker, args=(filtered, delay, changer_func, event_name, ), daemon=True)

0 commit comments

Comments
 (0)