diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2015-09-10 10:49:03 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2015-09-10 10:49:22 +0200 |
commit | de55bfa725a5a6d45155cb8f351904c9bf7a0bc4 (patch) | |
tree | 22349a47eef1bd0f6ef7fe42fa5f81a954c121f2 /tango | |
parent | 3cae8d9183cdffa41940b97e778ac6795441139d (diff) | |
download | libuca-de55bfa725a5a6d45155cb8f351904c9bf7a0bc4.tar.gz libuca-de55bfa725a5a6d45155cb8f351904c9bf7a0bc4.tar.bz2 libuca-de55bfa725a5a6d45155cb8f351904c9bf7a0bc4.tar.xz libuca-de55bfa725a5a6d45155cb8f351904c9bf7a0bc4.zip |
Fix #74: call grab in a separate thread
Diffstat (limited to 'tango')
-rwxr-xr-x | tango/Uca | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -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): |