Skip to content

Commit

Permalink
Increased accuracy in regards to recording proper delays between acti…
Browse files Browse the repository at this point in the history
  • Loading branch information
ra314 authored and RMPR committed Apr 2, 2022
1 parent f496711 commit 147ee43
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions atbswp/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from threading import Thread

import pyautogui
pyautogui.PAUSE = 0

from pynput import keyboard, mouse

Expand All @@ -39,7 +40,6 @@
import wx.adv
import wx.lib.newevent as NE


TMP_PATH = os.path.join(tempfile.gettempdir(),
"atbswp-" + date.today().strftime("%Y%m%d"))
HEADER = (
Expand Down Expand Up @@ -221,8 +221,8 @@ def on_move(self, x, y):
if not self.recording:
return False
b = time.perf_counter()
timeout = int(b - self.last_time)
if timeout > 0:
timeout = float(b - self.last_time)
if timeout > 0.0:
self._capture.append(f"time.sleep({timeout})")
self.last_time = b
self.write_mouse_action(move="moveTo", parameters=f"{x}, {y}")
Expand Down Expand Up @@ -265,8 +265,8 @@ def on_scroll(self, x, y, dx, dy):
def on_press(self, key):
"""Triggered by a key press."""
b = time.perf_counter()
timeout = int(b - self.last_time)
if timeout > 0:
timeout = float(b - self.last_time)
if timeout > 0.0:
self._capture.append(f"time.sleep({timeout})")
self.last_time = b

Expand Down

0 comments on commit 147ee43

Please sign in to comment.