diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2014-04-26 18:15:08 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2014-04-26 18:15:08 -0400 |
commit | cd9497d80611badcc6663572f849da52b19e3ec6 (patch) | |
tree | c6251a4aa03169c2b9f9e1bb400407266a8654c2 | |
parent | 46ab5e42be9b676242e3a7aef8748b08ac52a303 (diff) | |
download | dimension-cd9497d80611badcc6663572f849da52b19e3ec6.tar.xz |
preview: Handle ^C in more places.
-rw-r--r-- | dimension/preview.py | 15 |
1 files 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): |