From cd9497d80611badcc6663572f849da52b19e3ec6 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 26 Apr 2014 18:15:08 -0400 Subject: preview: Handle ^C in more places. --- dimension/preview.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dimension/preview.py b/dimension/preview.py index e4e9c80..aa4d032 100644 --- a/dimension/preview.py +++ b/dimension/preview.py @@ -57,11 +57,16 @@ class PreviewWindow(QtGui.QMainWindow): @QtCore.pyqtSlot() def update_preview(self): - self.widget.updateGL() - if self.future.is_done(): - self.render_timer.stop() - self.close_timer = QtCore.QTimer(self) - self.close_timer.singleShot(1000, self.close) + try: + self.widget.updateGL() + if self.future.is_done(): + self.render_timer.stop() + self.close_timer = QtCore.QTimer(self) + self.close_timer.singleShot(1000, self.close) + except: + self.future.cancel() + self.close() + raise @QtCore.pyqtSlot() def close(self): -- cgit v1.2.3