aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2024-04-23 08:04:13 +0200
committerThéo de la Hogue2024-04-23 08:04:13 +0200
commit10f2adf3446499e6e0358c1c3f375fec5d750fdd (patch)
tree41e64d86637dbb1b9d7def7006105de96aa084a9 /src
parent1487defacef6ba3e63d92f46d0e54a8339a37897 (diff)
downloadargaze-10f2adf3446499e6e0358c1c3f375fec5d750fdd.zip
argaze-10f2adf3446499e6e0358c1c3f375fec5d750fdd.tar.gz
argaze-10f2adf3446499e6e0358c1c3f375fec5d750fdd.tar.bz2
argaze-10f2adf3446499e6e0358c1c3f375fec5d750fdd.tar.xz
Using playback features.
Diffstat (limited to 'src')
-rw-r--r--src/argaze/utils/contexts/OpenCV.py9
-rw-r--r--src/argaze/utils/contexts/Random.py18
2 files changed, 14 insertions, 13 deletions
diff --git a/src/argaze/utils/contexts/OpenCV.py b/src/argaze/utils/contexts/OpenCV.py
index 6a79b57..14d9326 100644
--- a/src/argaze/utils/contexts/OpenCV.py
+++ b/src/argaze/utils/contexts/OpenCV.py
@@ -62,8 +62,7 @@ class Window(ArFeatures.ArContext):
logging.debug('Window.on_mouse_event %i %i', x, y)
- # Process timestamped gaze position
- self._process_gaze_position(
- timestamp = int((time.time() - self.__start_time) * 1e3),
- x = x,
- y = y)
+ if not self.is_paused():
+
+ # Process timestamped gaze position
+ self._process_gaze_position(timestamp = int((time.time() - self.__start_time) * 1e3), x = x, y = y)
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)