Skip to content
Merged

Dev #64

Show file tree
Hide file tree
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
105 changes: 54 additions & 51 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="je_auto_control_dev",
version="0.0.48",
version="0.0.51",
author="JE-Chen",
author_email="zenmailman@gmail.com",
description="auto testing",
Expand Down
15 changes: 8 additions & 7 deletions je_auto_control/wrapper/auto_control_image.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
from typing import List, Union


from je_auto_control.utils.exception.exception_tag import cant_find_image
from je_auto_control.utils.exception.exception_tag import find_image_error_variable
from je_auto_control.utils.exception.exceptions import ImageNotFoundException
Expand All @@ -24,12 +25,12 @@ def locate_all_image(image, detect_threshold: [float, int] = 1,
try:
image_data_array = template_detection.find_image_multi(image, detect_threshold, draw_image)
except ImageNotFoundException as error:
raise ImageNotFoundException(find_image_error_variable + " " + repr(error))
raise ImageNotFoundException(find_image_error_variable + " " + repr(error) + " " + str(image))
if image_data_array[0] is True:
record_action_to_list("locate_all_image", param)
return image_data_array[1]
else:
raise ImageNotFoundException(cant_find_image)
raise ImageNotFoundException(cant_find_image + " / " + repr(image))
except Exception as error:
record_action_to_list("locate_all_image", param, repr(error))
print(repr(error), file=sys.stderr)
Expand All @@ -47,15 +48,15 @@ def locate_image_center(image, detect_threshold: [float, int] = 1, draw_image: b
try:
image_data_array = template_detection.find_image(image, detect_threshold, draw_image)
except ImageNotFoundException as error:
raise ImageNotFoundException(find_image_error_variable + " " + repr(error))
raise ImageNotFoundException(find_image_error_variable + " " + repr(error) + " " + str(image))
if image_data_array[0] is True:
height = image_data_array[1][2] - image_data_array[1][0]
width = image_data_array[1][3] - image_data_array[1][1]
center = [int(height / 2), int(width / 2)]
record_action_to_list("locate_image_center", param)
return [image_data_array[1][0] + center[0], image_data_array[1][1] + center[1]]
return [int(image_data_array[1][0] + center[0]), int(image_data_array[1][1] + center[1])]
else:
raise ImageNotFoundException(cant_find_image)
raise ImageNotFoundException(cant_find_image + " / " + repr(image))
except Exception as error:
record_action_to_list("locate_image_center", param, repr(error))
print(repr(error), file=sys.stderr)
Expand Down Expand Up @@ -87,9 +88,9 @@ def locate_and_click(
set_position(int(image_center_x), int(image_center_y))
click_mouse(mouse_keycode)
record_action_to_list("locate_and_click", param)
return [image_center_x, image_center_y]
return [int(image_center_x), int(image_center_y)]
else:
raise ImageNotFoundException(cant_find_image)
raise ImageNotFoundException(cant_find_image + " / " + repr(image))
except Exception as error:
record_action_to_list("locate_and_click", param, repr(error))
print(repr(error), file=sys.stderr)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="je_auto_control",
version="0.0.114",
version="0.0.117",
author="JE-Chen",
author_email="zenmailman@gmail.com",
description="auto testing",
Expand Down
Binary file modified test/test_source/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 5 additions & 33 deletions test/unit_test/execute_action/test.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,7 @@
[
[
"type_key",
{
"keycode": 0
}
],
[
"mouse_left",
{
"mouse_keycode": "mouse_left",
"x": 500,
"y": 500
}
],
[
"position"
],
[
"press_mouse",
{
"mouse_keycode": "mouse_left",
"x": 500,
"y": 500
}
],
[
"release_mouse",
{
"mouse_keycode": "mouse_left",
"x": 500,
"y": 500
}
]
["type_key", {"keycode": 0}],
["mouse_left", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}],
["position"],
["press_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}],
["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}]
]
Loading