changeset 3441:fb60f30de213

GNU Health camera plugin: Allow to close the camera window with Alt+F4 or clickinh on close
author Luis Falcon <falcon@gnuhealth.org>
date Sat, 09 Nov 2019 17:59:38 +0000
parents 26a7a43ad340
children 8c8b27fa3b8f
files plugins/gnuhealth_camera/__init__.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/gnuhealth_camera/__init__.py
+++ b/plugins/gnuhealth_camera/__init__.py
@@ -160,7 +160,12 @@
             set_attachment(data, frame)
             break
 
-        if keypressed == ord('q'):
+        # Cleanup / Destroy window when q key is pressed or when closing
+        # the window via alt+f4
+        if (keypressed == ord('q')):
+            break
+
+        if (cv2.getWindowProperty('== GNU Health Camera ==', cv2.WND_PROP_VISIBLE) < 1):
             break
 
         if  keypressed == ord('h'):