Catch for game quit cleanup

This commit is contained in:
Vinyl Darkscratch 2018-03-07 00:43:08 -08:00
parent 904eb51d06
commit a3b2380365

View file

@ -19,18 +19,20 @@ class WatchPipe(QThread):
def run(self): def run(self):
while True: while True:
if os.path.exists(pipe_path): break while True:
else: time.sleep(0.1) if os.path.exists(pipe_path): break
else: time.sleep(0.1)
pipe = open(pipe_path, 'r') pipe = open(pipe_path, 'r')
pipe.flush() pipe.flush()
while True: while True:
message = os.read(pipe.fileno(), 256) if not os.path.exists(pipe_path): break # Handle game quitting cleanup
if len(message) > 0: message = os.read(pipe.fileno(), 256)
self.change_image.emit(message.decode()) if len(message) > 0:
self.change_image.emit(message.decode())
time.sleep(0.05) time.sleep(0.05)
class Journal(QWidget): class Journal(QWidget):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):