From 2c95aa26bbecd6861ebc0368001486f6eee157f3 Mon Sep 17 00:00:00 2001 From: Doc Date: Tue, 13 Jan 2026 23:04:54 -0500 Subject: [PATCH] Fixed error in "faster seeking" - I made a major oversight when speeding up the grid calibration. I forgot some variables were not set until AFTER the calibration. Fixed it so it is still faster/adaptable, but doesnt try to use values not yet set. --- src/df_tools/dfwindow.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/df_tools/dfwindow.py b/src/df_tools/dfwindow.py index 449b15c..f5c321b 100644 --- a/src/df_tools/dfwindow.py +++ b/src/df_tools/dfwindow.py @@ -256,19 +256,21 @@ class DFWINDOW: self.focusWindow() time.sleep(self.sleep_after_focus) + img = self.capWindow() + # Improved seeking upper left - self.sendKeys("w", 8) - img = self.capContent() - while not self.TOOLS.isTopBorder(img): + self.sendKeys("w", 2) + self.sendKeys("a", 2) + + old_img = img + img = self.capWindow() + + while self.TOOLS.getImageDiff(old_img, img) > 3: self.sendKeys("w", 4) - img = self.capContent() - self.sendKeys("w", 4) - - self.sendKeys("a", 8) - img = self.capContent() - while not self.TOOLS.isLeftBorder(img): self.sendKeys("a", 4) - img = self.capContent() + old_img = img + img = self.capWindow() + self.sendKeys("w", 4) self.sendKeys("a", 4) img = self.capWindow() @@ -276,6 +278,7 @@ class DFWINDOW: self._content_right = int(img.shape[1] - self._content_left) self._content_bottom = int(img.shape[0] - self.bottom_to_ignore) img = img[self._content_top : self._content_bottom, self._content_left : self._content_right] # pyright: ignore[reportOptionalSubscript] + logger.debug(f"Content width {self.contentWidth}. Content height {self.contentHeight}.") # Try to measure steps