easy-uiauto 0.9.9__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- easy_uiauto/__init__.py +84 -0
- easy_uiauto/_highlight_worker.py +95 -0
- easy_uiauto/bin/easy-uiauto-config.exe +0 -0
- easy_uiauto/ctrl.py +1478 -0
- easy_uiauto/draw.py +678 -0
- easy_uiauto/highlight.py +161 -0
- easy_uiauto/image_cli.py +276 -0
- easy_uiauto/image_detection.py +614 -0
- easy_uiauto/image_geometry.py +165 -0
- easy_uiauto/mcp/__init__.py +157 -0
- easy_uiauto/mcp/annotation_correction.py +244 -0
- easy_uiauto/mcp/client.py +171 -0
- easy_uiauto/mcp/component_geometry.py +397 -0
- easy_uiauto/mcp/config_gui.py +183 -0
- easy_uiauto/mcp/config_launcher.py +24 -0
- easy_uiauto/mcp/configuration.py +439 -0
- easy_uiauto/mcp/control_tree.py +293 -0
- easy_uiauto/mcp/diagnostics.py +517 -0
- easy_uiauto/mcp/diagram_geometry.py +239 -0
- easy_uiauto/mcp/image_analysis.py +302 -0
- easy_uiauto/mcp/image_storage.py +442 -0
- easy_uiauto/mcp/interaction_learning.py +1071 -0
- easy_uiauto/mcp/knowledge.py +778 -0
- easy_uiauto/mcp/learning_progress.py +166 -0
- easy_uiauto/mcp/native_windows.py +134 -0
- easy_uiauto/mcp/ocr_matching.py +81 -0
- easy_uiauto/mcp/protocol.py +190 -0
- easy_uiauto/mcp/rectangle_snap.py +122 -0
- easy_uiauto/mcp/results.py +113 -0
- easy_uiauto/mcp/scanner.py +2602 -0
- easy_uiauto/mcp/semantic_identity.py +241 -0
- easy_uiauto/mcp/server.py +2979 -0
- easy_uiauto/mcp/service.py +940 -0
- easy_uiauto/mcp/skill_installation.py +62 -0
- easy_uiauto/mcp/ui_cli.py +806 -0
- easy_uiauto/mcp/ui_cli_command.py +300 -0
- easy_uiauto/mcp/visual_segmentation.py +687 -0
- easy_uiauto/mcp/visualization.py +469 -0
- easy_uiauto/mcp/waiting.py +265 -0
- easy_uiauto/mcp/window_crop.py +172 -0
- easy_uiauto/py.typed +0 -0
- easy_uiauto/record.py +579 -0
- easy_uiauto/skills/__init__.py +1 -0
- easy_uiauto/skills/easy-uiauto-learning/SKILL.md +204 -0
- easy_uiauto/skills/easy-uiauto-learning/agents/openai.yaml +4 -0
- easy_uiauto/skills/easy-uiauto-operate/SKILL.md +66 -0
- easy_uiauto/skills/easy-uiauto-operate/agents/openai.yaml +4 -0
- easy_uiauto/ui_image_fusion.py +280 -0
- easy_uiauto/ui_layout.py +152 -0
- easy_uiauto/utils.py +1522 -0
- easy_uiauto/visual.py +59 -0
- easy_uiauto-0.9.9.dist-info/METADATA +977 -0
- easy_uiauto-0.9.9.dist-info/RECORD +57 -0
- easy_uiauto-0.9.9.dist-info/WHEEL +5 -0
- easy_uiauto-0.9.9.dist-info/entry_points.txt +8 -0
- easy_uiauto-0.9.9.dist-info/licenses/LICENSE +21 -0
- easy_uiauto-0.9.9.dist-info/top_level.txt +1 -0
easy_uiauto/__init__.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""easy-uiauto - UI automation toolkit based on pyautogui and uiautomation"""
|
|
3
|
+
|
|
4
|
+
__version__ = "0.9.9"
|
|
5
|
+
__author__ = "Poggi-Tang"
|
|
6
|
+
|
|
7
|
+
from .ctrl import (
|
|
8
|
+
Controller,
|
|
9
|
+
left_click,
|
|
10
|
+
right_click,
|
|
11
|
+
double_click,
|
|
12
|
+
centre_click,
|
|
13
|
+
mouse_left_press,
|
|
14
|
+
mouse_left_release,
|
|
15
|
+
mouse_right_press,
|
|
16
|
+
mouse_right_release,
|
|
17
|
+
mouse_move_pos,
|
|
18
|
+
mouse_move_control,
|
|
19
|
+
drag_control,
|
|
20
|
+
drag_control_by_control,
|
|
21
|
+
set_text,
|
|
22
|
+
input_text,
|
|
23
|
+
key_click,
|
|
24
|
+
key_press,
|
|
25
|
+
key_release,
|
|
26
|
+
key_group,
|
|
27
|
+
activate_window,
|
|
28
|
+
run_action,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
from .record import run_record, RecordThread
|
|
32
|
+
|
|
33
|
+
from .utils import (
|
|
34
|
+
find_control,
|
|
35
|
+
find_control_by_xpath,
|
|
36
|
+
get_control_info,
|
|
37
|
+
get_control_xpath,
|
|
38
|
+
compile_controls,
|
|
39
|
+
push_message,
|
|
40
|
+
set_top_window,
|
|
41
|
+
auto_scroll,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
from .draw import ScreenControlOverlay, ScreenLineBox, show_control_overlay
|
|
45
|
+
from .visual import crop_window_image, segment_image, segment_screen_rect
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
"Controller",
|
|
49
|
+
"ScreenControlOverlay",
|
|
50
|
+
"ScreenLineBox",
|
|
51
|
+
"show_control_overlay",
|
|
52
|
+
"segment_image",
|
|
53
|
+
"segment_screen_rect",
|
|
54
|
+
"crop_window_image",
|
|
55
|
+
"left_click",
|
|
56
|
+
"right_click",
|
|
57
|
+
"double_click",
|
|
58
|
+
"centre_click",
|
|
59
|
+
"mouse_left_press",
|
|
60
|
+
"mouse_left_release",
|
|
61
|
+
"mouse_right_press",
|
|
62
|
+
"mouse_right_release",
|
|
63
|
+
"mouse_move_pos",
|
|
64
|
+
"mouse_move_control",
|
|
65
|
+
"drag_control",
|
|
66
|
+
"drag_control_by_control",
|
|
67
|
+
"set_text",
|
|
68
|
+
"input_text",
|
|
69
|
+
"key_click",
|
|
70
|
+
"key_press",
|
|
71
|
+
"key_release",
|
|
72
|
+
"key_group",
|
|
73
|
+
"activate_window",
|
|
74
|
+
"run_action",
|
|
75
|
+
"run_record",
|
|
76
|
+
"RecordThread",
|
|
77
|
+
"find_control",
|
|
78
|
+
"find_control_by_xpath",
|
|
79
|
+
"get_control_info",
|
|
80
|
+
"compile_controls",
|
|
81
|
+
"push_message",
|
|
82
|
+
"set_top_window",
|
|
83
|
+
"auto_scroll",
|
|
84
|
+
]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Internal JSON-lines worker; the Tk mainloop stays on its process main thread."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import queue
|
|
7
|
+
import sys
|
|
8
|
+
import threading
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _emit(event, **data):
|
|
12
|
+
print(json.dumps({"event": event, **data}, ensure_ascii=False), flush=True)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
import tkinter as tk
|
|
17
|
+
|
|
18
|
+
import uiautomation
|
|
19
|
+
|
|
20
|
+
from .draw import ScreenLineBox
|
|
21
|
+
from .utils import format_action_data_by_xpath, observe_control
|
|
22
|
+
|
|
23
|
+
root = box = None
|
|
24
|
+
try:
|
|
25
|
+
initial = json.loads(sys.stdin.readline())
|
|
26
|
+
if initial.get("cmd") != "init":
|
|
27
|
+
raise ValueError("first highlight command must be init")
|
|
28
|
+
with uiautomation.UIAutomationInitializerInThread():
|
|
29
|
+
root = tk.Tk()
|
|
30
|
+
root.withdraw()
|
|
31
|
+
box = ScreenLineBox(root=root, interval_ms=50, **(initial.get("style") or {}))
|
|
32
|
+
if initial.get("rect"):
|
|
33
|
+
box.set_rect(initial["rect"])
|
|
34
|
+
commands = queue.Queue()
|
|
35
|
+
|
|
36
|
+
def read_commands():
|
|
37
|
+
try:
|
|
38
|
+
for line in sys.stdin:
|
|
39
|
+
commands.put(json.loads(line))
|
|
40
|
+
except Exception as error:
|
|
41
|
+
commands.put({"cmd": "reader_error", "error": str(error)})
|
|
42
|
+
finally:
|
|
43
|
+
commands.put({"cmd": "stop"})
|
|
44
|
+
|
|
45
|
+
threading.Thread(target=read_commands, daemon=True).start()
|
|
46
|
+
|
|
47
|
+
def pump():
|
|
48
|
+
for _ in range(100):
|
|
49
|
+
try:
|
|
50
|
+
command = commands.get_nowait()
|
|
51
|
+
except queue.Empty:
|
|
52
|
+
break
|
|
53
|
+
try:
|
|
54
|
+
name = command.get("cmd")
|
|
55
|
+
if name == "stop":
|
|
56
|
+
root.quit()
|
|
57
|
+
return
|
|
58
|
+
if name == "reader_error":
|
|
59
|
+
raise RuntimeError(command["error"])
|
|
60
|
+
if name == "rect":
|
|
61
|
+
box.set_rect(command.get("rect"))
|
|
62
|
+
elif name == "set_xpath":
|
|
63
|
+
action = format_action_data_by_xpath("", "", command["xpath"], {}, "")
|
|
64
|
+
box.set_control(observe_control(action["LOCATION"]))
|
|
65
|
+
elif name == "style":
|
|
66
|
+
box.set_style(**(command.get("style") or {}))
|
|
67
|
+
except Exception as error:
|
|
68
|
+
# A control wrapper can become invalid when an XPath
|
|
69
|
+
# is resolved from this isolated process. A rect
|
|
70
|
+
# snapshot sent by the recorder is still useful, so
|
|
71
|
+
# keep showing it and report the tracking failure as a
|
|
72
|
+
# non-fatal warning. Only fail the worker for errors
|
|
73
|
+
# that prevent it from servicing commands at all.
|
|
74
|
+
if name == "set_xpath":
|
|
75
|
+
_emit("warning", message=f"highlight tracking skipped: {error}")
|
|
76
|
+
else:
|
|
77
|
+
_emit("error", message=f"highlight command failed: {error}")
|
|
78
|
+
root.after(16, pump)
|
|
79
|
+
|
|
80
|
+
root.after(0, pump)
|
|
81
|
+
_emit("ready")
|
|
82
|
+
root.mainloop()
|
|
83
|
+
except Exception as error:
|
|
84
|
+
_emit("error", message=f"{type(error).__name__}: {error}")
|
|
85
|
+
return 1
|
|
86
|
+
finally:
|
|
87
|
+
if box is not None:
|
|
88
|
+
box.destroy()
|
|
89
|
+
if root is not None:
|
|
90
|
+
root.destroy()
|
|
91
|
+
return 0
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
if __name__ == "__main__":
|
|
95
|
+
raise SystemExit(main())
|
|
Binary file
|