Skip to content
Open
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
22 changes: 7 additions & 15 deletions atbswp/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,6 @@ def write_mouse_action(self, engine="pyautogui", move="", parameters=""):
move -- the mouse movement (mouseDown, mouseUp, scroll, moveTo)
parameters -- the details of the movement
"""
def isinteger(s):
try:
int(s)
return True
except:
return False

if move == "moveTo":
coordinates = [int(s)
for s in parameters.split(", ") if isinteger(s)]
if abs(coordinates[0] - self._lastx) < self.mouse_sensibility \
and abs(coordinates[1] - self._lasty) < self.mouse_sensibility:
return
else:
self._lastx, self._lasty = coordinates
self._capture.append(engine + "." + move + '(' + parameters + ')')

def write_keyboard_action(self, engine="pyautogui", move="", key=""):
Expand All @@ -219,6 +204,13 @@ def on_move(self, x, y):
"""Triggered by a mouse move."""
if not self.recording:
return False

if abs(x - self._lastx) < self.mouse_sensibility \
and abs(y - self._lasty) < self.mouse_sensibility:
return
else:
self._lastx, self._lasty = x,y

b = time.perf_counter()
timeout = float(b - self.last_time)
if timeout > 0.0:
Expand Down