From de55bfa725a5a6d45155cb8f351904c9bf7a0bc4 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Thu, 10 Sep 2015 10:49:03 +0200 Subject: Fix #74: call grab in a separate thread --- tango/Uca | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tango') 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): -- cgit v1.2.3