-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimation.py
More file actions
56 lines (47 loc) · 1.9 KB
/
animation.py
File metadata and controls
56 lines (47 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import logging
import time
import constants
import pyautogui
from Exceptions import UnclickableException
def hasAnimation() -> bool:
find2xSpeedCheck = pyautogui.locateOnScreen('check.png', confidence=0.9)
if find2xSpeedCheck:
return True
else:
return False
def clickSpeedTextbox():
pyautogui.scroll(-40)
find2xSpeedCheck = 0
clickAttempts = 0
while find2xSpeedCheck is not None:
find2xSpeedCheck = pyautogui.locateOnScreen('check.png', confidence=0.9)
if find2xSpeedCheck is None:
logging.warning("function could not find animation for some reason")
return
logging.info("Found checkbox, clicking")
clickAttempts += 1
pyautogui.moveTo(find2xSpeedCheck.left + 5, find2xSpeedCheck.top + 5, duration=0)
pyautogui.click()
time.sleep(.4)
find2xSpeedCheck = pyautogui.locateOnScreen('check.png', confidence=0.9)
if find2xSpeedCheck:
logging.info("Textbox Unclicked, on attempt " + clickAttempts)
if clickAttempts == constants.NUM_ATTEMPTS_TIL_ERROR:
logging.error("Textbox clicking not working")
raise UnclickableException
def clickStart():
start = pyautogui.locateOnScreen('start.png', grayscale=True, confidence=0.9)
pyautogui.click(x=start.left + 20, y=start.top + 10)
def runAnimation():
rightArrow = None
reverseArrow = None
while reverseArrow is None:
rightArrow = None
while rightArrow is None and reverseArrow is None:
reverseArrow = pyautogui.locateOnScreen('backArrow.png', confidence=0.9)
rightArrow = pyautogui.locateOnScreen('rightArrow.png', grayscale=True, confidence=0.9)
time.sleep(0.4)
if reverseArrow is None:
print(rightArrow)
pyautogui.click(x=rightArrow.left + 5, y=rightArrow.top + 5)
pyautogui.moveRel(0, 40, duration=0)