From 6233e0e4e4e7f6fb3083bae29b29dc14d5d9d2bb Mon Sep 17 00:00:00 2001 From: Starwort Date: Mon, 19 Nov 2018 20:48:06 +0000 Subject: [PATCH 1/3] Focus the window at the start of playing --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 4f37930..d3cdbfc 100644 --- a/main.py +++ b/main.py @@ -190,6 +190,7 @@ def run(self, *args): if not opts.files: played = 0 + click((0,0)) # Focus the window while played < opts.games or not opts.games: if played: log.info('Beginning new game...') From 8897521ce83e47311975982d65f5f33636d1a52b Mon Sep 17 00:00:00 2001 From: Starwort Date: Mon, 19 Nov 2018 20:51:40 +0000 Subject: [PATCH 2/3] Modify click() to be more stable on some platforms I made this change to my own copy because pyautogui.mouseDown(x,y) is inconsistent at clicking the marbles on my system (win10), but moveTo();mouseDown() works every time --- sigsolve/util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sigsolve/util.py b/sigsolve/util.py index 9338875..7169984 100644 --- a/sigsolve/util.py +++ b/sigsolve/util.py @@ -111,10 +111,10 @@ def denumpify(array): def click(where, down=0.05, up=0): - x, y = where - pyautogui.mouseDown(x=x, y=y) + pyautogui.moveTo(*where) + pyautogui.mouseDown() time.sleep(down) - pyautogui.mouseUp(x=x, y=y) + pyautogui.mouseUp() time.sleep(up) @@ -141,4 +141,4 @@ def __enter__(self): self.start() def __exit__(self, exc_type, exc_val, exc_tb): - self.stop() \ No newline at end of file + self.stop() From f37a40a0733bb3895290d09d85d443a10fb8eea2 Mon Sep 17 00:00:00 2001 From: Starwort Date: Mon, 19 Nov 2018 20:55:43 +0000 Subject: [PATCH 3/3] I forgot to consider the failsafe --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index d3cdbfc..f7b6c01 100644 --- a/main.py +++ b/main.py @@ -190,7 +190,7 @@ def run(self, *args): if not opts.files: played = 0 - click((0,0)) # Focus the window + click((1,1)) # Focus the window WITHOUT triggering the failsafe while played < opts.games or not opts.games: if played: log.info('Beginning new game...')