aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/utils/contexts/Random.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze/utils/contexts/Random.py')
-rw-r--r--src/argaze/utils/contexts/Random.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/argaze/utils/contexts/Random.py b/src/argaze/utils/contexts/Random.py
index 3409dd9..29b9830 100644
--- a/src/argaze/utils/contexts/Random.py
+++ b/src/argaze/utils/contexts/Random.py
@@ -64,18 +64,20 @@ class GazePositionGenerator(ArFeatures.ArContext):
self.__x = int(self.range[0] / 2)
self.__y = int(self.range[1] / 2)
- while not self._stop_event.is_set():
+ while self.is_running():
- # Edit millisecond timestamp
- timestamp = int((time.time() - start_time) * 1e3)
+ if not self.is_paused():
- self.__x += random.randint(-10, 10)
- self.__y += random.randint(-10, 10)
+ # Edit millisecond timestamp
+ timestamp = int((time.time() - start_time) * 1e3)
- logging.debug('> timestamp=%i, x=%i, y=%i', timestamp, self.__x, self.__y)
+ self.__x += random.randint(-10, 10)
+ self.__y += random.randint(-10, 10)
- # Process timestamped random gaze position
- self._process_gaze_position(timestamp = timestamp, x = self.__x, y = self.__y)
+ logging.debug('> timestamp=%i, x=%i, y=%i', timestamp, self.__x, self.__y)
+
+ # Process timestamped random gaze position
+ self._process_gaze_position(timestamp = timestamp, x = self.__x, y = self.__y)
# wait 10ms
time.sleep(0.01)