From e496b99cdfc0f31287554f0c540a94b2049cb2ad Mon Sep 17 00:00:00 2001 From: Mansard <nmansard@laas.fr> Date: Thu, 17 Jan 2013 16:12:38 +0100 Subject: [PATCH] Minor changes in thread loop. --- python/ThreadInterruptibleLoop.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/python/ThreadInterruptibleLoop.py b/python/ThreadInterruptibleLoop.py index 1e1295e..4b6b011 100644 --- a/python/ThreadInterruptibleLoop.py +++ b/python/ThreadInterruptibleLoop.py @@ -68,3 +68,18 @@ def loopInThread( funLoop ): def loop(self): funLoop() return ThreadViewer + +from dynamic_graph.script_shortcuts import optionalparentheses +# Define the 4 classical shortcuts to control the loop. +def loopShortcuts(runner): + @optionalparentheses + def go(): runner.play() + @optionalparentheses + def stop(): runner.pause() + @optionalparentheses + def next(): runner.loop() + class NextInc: + def __add__(self,x): + for i in range(x): next() + n=NextInc() + return [go,stop,next,n] -- GitLab