summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-09-10 10:49:03 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-09-10 10:49:22 +0200
commitde55bfa725a5a6d45155cb8f351904c9bf7a0bc4 (patch)
tree22349a47eef1bd0f6ef7fe42fa5f81a954c121f2
parent3cae8d9183cdffa41940b97e778ac6795441139d (diff)
downloadlibuca-de55bfa725a5a6d45155cb8f351904c9bf7a0bc4.tar.gz
libuca-de55bfa725a5a6d45155cb8f351904c9bf7a0bc4.tar.bz2
libuca-de55bfa725a5a6d45155cb8f351904c9bf7a0bc4.tar.xz
libuca-de55bfa725a5a6d45155cb8f351904c9bf7a0bc4.zip
Fix #74: call grab in a separate thread
-rwxr-xr-xtango/Uca14
1 files changed, 9 insertions, 5 deletions
diff --git a/tango/Uca b/tango/Uca
index ed6069e..0438f70 100755
--- a/tango/Uca
+++ b/tango/Uca
@@ -4,6 +4,7 @@ import sys
import time
import numpy as np
import PyTango
+import threading
from gi.repository import Uca, GObject
from PyTango import Attr, AttrWriteType, DevState
from PyTango.server import Device, DeviceMeta, attribute, device_property, command, server_run
@@ -119,12 +120,15 @@ class Camera(Device):
@command(dtype_in=str, doc_in="Path and filename to store frame")
def Store(self, path):
- frame = self.grab()
+ def grab_and_write():
+ frame = self.grab()
- if HAVE_TIFFFILE:
- tifffile.imsave(path, frame)
- else:
- np.savez(open(path, 'wb'), frame)
+ if HAVE_TIFFFILE:
+ tifffile.imsave(path, frame)
+ else:
+ np.savez(open(path, 'wb'), frame)
+
+ threading.Thread(target=grab_and_write).start()
@command
def Trigger(self):