Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increased accurate in regards to recording proper delays between act… #85

Merged
merged 1 commit into from
Apr 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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