Skip to content

Commit 22508aa

Browse files
authored
Merge pull request #53 from joao-voltarelli/fix_images_path
FIX: Updated handling for image path
2 parents 31ca95a + d235e81 commit 22508aa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

botcity/web/bot.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ def _to_dict(lbs, elems):
417417

418418
results = [None] * len(labels)
419419
paths = [self._search_image_file(la) for la in labels]
420+
paths = [self._image_path_as_image(la) for la in paths]
420421

421422
if threshold:
422423
# TODO: Figure out how we should do threshold
@@ -517,6 +518,7 @@ def find_until(self, label, x=None, y=None, width=None, height=None, *,
517518
region = (x, y, w, h)
518519

519520
element_path = self._search_image_file(label)
521+
element_path = self._image_path_as_image(element_path)
520522

521523
if threshold:
522524
# TODO: Figure out how we should do threshold
@@ -620,6 +622,7 @@ def find_same(item, items):
620622
region = (x, y, w, h)
621623

622624
element_path = self._search_image_file(label)
625+
element_path = self._image_path_as_image(element_path)
623626

624627
if threshold:
625628
# TODO: Figure out how we should do threshold
@@ -785,8 +788,11 @@ def get_element_coords(self, label, x=None, y=None, width=None, height=None, mat
785788
if not best:
786789
print('Warning: Ignoring best=False for now. It will be supported in the future.')
787790

791+
element_path = self._search_image_file(label)
792+
element_path = self._image_path_as_image(element_path)
788793
haystack = self.get_screen_image()
789-
it = cv2find.locate_all_opencv(self.state.map_images[label], haystack_image=haystack,
794+
795+
it = cv2find.locate_all_opencv(element_path, haystack_image=haystack,
790796
region=region, confidence=matching)
791797
try:
792798
ele = next(it)

0 commit comments

Comments
 (0)