platynui-native 0.2.0.dev1__cp310-abi3-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.
Potentially problematic release.
This version of platynui-native might be problematic. Click here for more details.
- platynui_native/.gitignore +12 -0
- platynui_native/__init__.py +48 -0
- platynui_native/__init__.pyi +428 -0
- platynui_native/__version__.py +1 -0
- platynui_native/_native.pyd +0 -0
- platynui_native/py.typed +0 -0
- platynui_native-0.2.0.dev1.dist-info/METADATA +255 -0
- platynui_native-0.2.0.dev1.dist-info/RECORD +9 -0
- platynui_native-0.2.0.dev1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""platynui_native package.
|
|
2
|
+
|
|
3
|
+
This package provides Python bindings for PlatynUI's native Rust implementation.
|
|
4
|
+
All types and functions are directly exported from the native extension module.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# Re-export everything from the native extension
|
|
8
|
+
from ._native import * # noqa: F401, F403
|
|
9
|
+
|
|
10
|
+
# Explicit __all__ for better IDE support (will be populated by stub file)
|
|
11
|
+
__all__ = [ # noqa: F405
|
|
12
|
+
# Core types
|
|
13
|
+
"Point",
|
|
14
|
+
"Size",
|
|
15
|
+
"Rect",
|
|
16
|
+
"PatternId",
|
|
17
|
+
"RuntimeId",
|
|
18
|
+
"TechnologyId",
|
|
19
|
+
"Namespace",
|
|
20
|
+
# Runtime
|
|
21
|
+
"Runtime",
|
|
22
|
+
"UiNode",
|
|
23
|
+
"NodeChildrenIterator",
|
|
24
|
+
"NodeAttributesIterator",
|
|
25
|
+
"EvaluationIterator",
|
|
26
|
+
"UiAttribute",
|
|
27
|
+
"EvaluatedAttribute",
|
|
28
|
+
"Focusable",
|
|
29
|
+
"WindowSurface",
|
|
30
|
+
"PlatformOverrides",
|
|
31
|
+
# Overrides
|
|
32
|
+
"PointerOverrides",
|
|
33
|
+
"KeyboardOverrides",
|
|
34
|
+
"PointerButton",
|
|
35
|
+
# Exceptions
|
|
36
|
+
"EvaluationError",
|
|
37
|
+
"ProviderError",
|
|
38
|
+
"PointerError",
|
|
39
|
+
"KeyboardError",
|
|
40
|
+
"PatternError",
|
|
41
|
+
# Mock providers (always available)
|
|
42
|
+
"MOCK_PROVIDER",
|
|
43
|
+
"MOCK_PLATFORM",
|
|
44
|
+
"MOCK_HIGHLIGHT_PROVIDER",
|
|
45
|
+
"MOCK_SCREENSHOT_PROVIDER",
|
|
46
|
+
"MOCK_POINTER_DEVICE",
|
|
47
|
+
"MOCK_KEYBOARD_DEVICE",
|
|
48
|
+
]
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
"""Type stubs for platynui_native package.
|
|
2
|
+
|
|
3
|
+
All types are directly exported from the native extension module.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Any, List, Tuple, Literal, Union, Dict, TypeAlias, Iterable
|
|
7
|
+
import enum as _enum
|
|
8
|
+
|
|
9
|
+
# ===== Core Types =====
|
|
10
|
+
|
|
11
|
+
class Point:
|
|
12
|
+
def __init__(self, x: float, y: float) -> None: ...
|
|
13
|
+
@property
|
|
14
|
+
def x(self) -> float: ...
|
|
15
|
+
@property
|
|
16
|
+
def y(self) -> float: ...
|
|
17
|
+
def to_tuple(self) -> Tuple[float, float]: ...
|
|
18
|
+
def with_x(self, x: float) -> Point: ...
|
|
19
|
+
def with_y(self, y: float) -> Point: ...
|
|
20
|
+
def translate(self, dx: float, dy: float) -> Point: ...
|
|
21
|
+
def is_finite(self) -> bool: ...
|
|
22
|
+
def __add__(self, other: Point) -> Point: ...
|
|
23
|
+
def __sub__(self, other: Point) -> Point: ...
|
|
24
|
+
def __eq__(self, other: object) -> bool: ...
|
|
25
|
+
def __ne__(self, other: object) -> bool: ...
|
|
26
|
+
def __hash__(self) -> int: ...
|
|
27
|
+
|
|
28
|
+
class Size:
|
|
29
|
+
def __init__(self, width: float, height: float) -> None: ...
|
|
30
|
+
@property
|
|
31
|
+
def width(self) -> float: ...
|
|
32
|
+
@property
|
|
33
|
+
def height(self) -> float: ...
|
|
34
|
+
def to_tuple(self) -> Tuple[float, float]: ...
|
|
35
|
+
def area(self) -> float: ...
|
|
36
|
+
def is_empty(self) -> bool: ...
|
|
37
|
+
def is_finite(self) -> bool: ...
|
|
38
|
+
def __add__(self, other: Size) -> Size: ...
|
|
39
|
+
def __sub__(self, other: Size) -> Size: ...
|
|
40
|
+
def __mul__(self, scalar: float) -> Size: ...
|
|
41
|
+
def __truediv__(self, scalar: float) -> Size: ...
|
|
42
|
+
def __eq__(self, other: object) -> bool: ...
|
|
43
|
+
def __ne__(self, other: object) -> bool: ...
|
|
44
|
+
def __hash__(self) -> int: ...
|
|
45
|
+
|
|
46
|
+
class Rect:
|
|
47
|
+
def __init__(self, x: float, y: float, width: float, height: float) -> None: ...
|
|
48
|
+
@property
|
|
49
|
+
def x(self) -> float: ...
|
|
50
|
+
@property
|
|
51
|
+
def y(self) -> float: ...
|
|
52
|
+
@property
|
|
53
|
+
def width(self) -> float: ...
|
|
54
|
+
@property
|
|
55
|
+
def height(self) -> float: ...
|
|
56
|
+
def to_tuple(self) -> Tuple[float, float, float, float]: ...
|
|
57
|
+
def left(self) -> float: ...
|
|
58
|
+
def top(self) -> float: ...
|
|
59
|
+
def right(self) -> float: ...
|
|
60
|
+
def bottom(self) -> float: ...
|
|
61
|
+
def center(self) -> Point: ...
|
|
62
|
+
def size(self) -> Size: ...
|
|
63
|
+
def position(self) -> Point: ...
|
|
64
|
+
def contains(self, point: Point) -> bool: ...
|
|
65
|
+
def intersects(self, other: Rect) -> bool: ...
|
|
66
|
+
def intersection(self, other: Rect) -> Rect | None: ...
|
|
67
|
+
def union(self, other: Rect) -> Rect: ...
|
|
68
|
+
def translate(self, dx: float, dy: float) -> Rect: ...
|
|
69
|
+
def inflate(self, dw: float, dh: float) -> Rect: ...
|
|
70
|
+
def deflate(self, dw: float, dh: float) -> Rect: ...
|
|
71
|
+
def is_empty(self) -> bool: ...
|
|
72
|
+
def __add__(self, point: Point) -> Rect: ...
|
|
73
|
+
def __sub__(self, point: Point) -> Rect: ...
|
|
74
|
+
def __eq__(self, other: object) -> bool: ...
|
|
75
|
+
def __ne__(self, other: object) -> bool: ...
|
|
76
|
+
def __hash__(self) -> int: ...
|
|
77
|
+
|
|
78
|
+
class PatternId:
|
|
79
|
+
def __init__(self, value: str) -> None: ...
|
|
80
|
+
def as_str(self) -> str: ...
|
|
81
|
+
def __eq__(self, other: object) -> bool: ...
|
|
82
|
+
def __ne__(self, other: object) -> bool: ...
|
|
83
|
+
def __hash__(self) -> int: ...
|
|
84
|
+
|
|
85
|
+
class RuntimeId:
|
|
86
|
+
def __init__(self, value: str) -> None: ...
|
|
87
|
+
def as_str(self) -> str: ...
|
|
88
|
+
def __eq__(self, other: object) -> bool: ...
|
|
89
|
+
def __ne__(self, other: object) -> bool: ...
|
|
90
|
+
def __hash__(self) -> int: ...
|
|
91
|
+
|
|
92
|
+
class TechnologyId:
|
|
93
|
+
def __init__(self, value: str) -> None: ...
|
|
94
|
+
def as_str(self) -> str: ...
|
|
95
|
+
def __eq__(self, other: object) -> bool: ...
|
|
96
|
+
def __ne__(self, other: object) -> bool: ...
|
|
97
|
+
def __hash__(self) -> int: ...
|
|
98
|
+
|
|
99
|
+
class Namespace:
|
|
100
|
+
Control: "Namespace"
|
|
101
|
+
Item: "Namespace"
|
|
102
|
+
App: "Namespace"
|
|
103
|
+
Native: "Namespace"
|
|
104
|
+
def as_str(self) -> str: ...
|
|
105
|
+
def is_default(self) -> bool: ...
|
|
106
|
+
def __eq__(self, other: object) -> bool: ...
|
|
107
|
+
def __ne__(self, other: object) -> bool: ...
|
|
108
|
+
def __hash__(self) -> int: ...
|
|
109
|
+
|
|
110
|
+
# ===== Exceptions =====
|
|
111
|
+
|
|
112
|
+
class ProviderError(Exception): ...
|
|
113
|
+
class EvaluationError(Exception): ...
|
|
114
|
+
class PointerError(Exception): ...
|
|
115
|
+
class KeyboardError(Exception): ...
|
|
116
|
+
class PatternError(Exception): ...
|
|
117
|
+
|
|
118
|
+
# ===== Type Aliases =====
|
|
119
|
+
|
|
120
|
+
Primitive: TypeAlias = Union[bool, int, float, str, None]
|
|
121
|
+
JSONLike: TypeAlias = Union[Dict[str, Any], List[Any]]
|
|
122
|
+
Complex: TypeAlias = Union[Point, Size, Rect]
|
|
123
|
+
UiValue: TypeAlias = Union[Primitive, JSONLike, Complex]
|
|
124
|
+
|
|
125
|
+
PointLike: TypeAlias = Point
|
|
126
|
+
OriginLike: TypeAlias = Union[Literal["desktop"], Point, Rect]
|
|
127
|
+
ScrollDeltaLike: TypeAlias = Tuple[float, float]
|
|
128
|
+
|
|
129
|
+
class PointerButton(_enum.IntEnum):
|
|
130
|
+
LEFT = 1
|
|
131
|
+
MIDDLE = 2
|
|
132
|
+
RIGHT = 3
|
|
133
|
+
|
|
134
|
+
ButtonLike: TypeAlias = Union[int, PointerButton]
|
|
135
|
+
|
|
136
|
+
# ===== Runtime Classes =====
|
|
137
|
+
|
|
138
|
+
class UiAttribute:
|
|
139
|
+
@property
|
|
140
|
+
def namespace(self) -> str: ...
|
|
141
|
+
@property
|
|
142
|
+
def name(self) -> str: ...
|
|
143
|
+
def value(self) -> UiValue | None: ...
|
|
144
|
+
|
|
145
|
+
class EvaluatedAttribute:
|
|
146
|
+
@property
|
|
147
|
+
def namespace(self) -> str: ...
|
|
148
|
+
@property
|
|
149
|
+
def name(self) -> str: ...
|
|
150
|
+
@property
|
|
151
|
+
def value(self) -> UiValue: ...
|
|
152
|
+
def owner(self) -> "UiNode | None": ...
|
|
153
|
+
|
|
154
|
+
class UiNode:
|
|
155
|
+
@property
|
|
156
|
+
def runtime_id(self) -> str: ...
|
|
157
|
+
@property
|
|
158
|
+
def name(self) -> str: ...
|
|
159
|
+
@property
|
|
160
|
+
def role(self) -> str: ...
|
|
161
|
+
@property
|
|
162
|
+
def namespace(self) -> Namespace: ...
|
|
163
|
+
def attribute(self, name: str, namespace: str | None = ...) -> UiValue: ...
|
|
164
|
+
def parent(self) -> "UiNode | None": ...
|
|
165
|
+
def children(self) -> "NodeChildrenIterator": ...
|
|
166
|
+
def attributes(self) -> "NodeAttributesIterator": ...
|
|
167
|
+
def supported_patterns(self) -> list[str]: ...
|
|
168
|
+
def doc_order_key(self) -> int | None: ...
|
|
169
|
+
def is_valid(self) -> bool: ...
|
|
170
|
+
def invalidate(self) -> None: ...
|
|
171
|
+
def pattern_by_id(self, id: str) -> object | None: ...
|
|
172
|
+
def has_pattern(self, id: str) -> bool: ...
|
|
173
|
+
|
|
174
|
+
class NodeChildrenIterator:
|
|
175
|
+
def __iter__(self) -> "NodeChildrenIterator": ...
|
|
176
|
+
def __next__(self) -> UiNode: ...
|
|
177
|
+
|
|
178
|
+
class NodeAttributesIterator:
|
|
179
|
+
def __iter__(self) -> "NodeAttributesIterator": ...
|
|
180
|
+
def __next__(self) -> UiAttribute: ...
|
|
181
|
+
|
|
182
|
+
class EvaluationIterator:
|
|
183
|
+
def __iter__(self) -> "EvaluationIterator": ...
|
|
184
|
+
def __next__(self) -> Union[UiNode, EvaluatedAttribute, UiValue]: ...
|
|
185
|
+
|
|
186
|
+
class Focusable:
|
|
187
|
+
def id(self) -> str: ...
|
|
188
|
+
def focus(self) -> None: ...
|
|
189
|
+
|
|
190
|
+
class WindowSurface:
|
|
191
|
+
def id(self) -> str: ...
|
|
192
|
+
def activate(self) -> None: ...
|
|
193
|
+
def minimize(self) -> None: ...
|
|
194
|
+
def maximize(self) -> None: ...
|
|
195
|
+
def restore(self) -> None: ...
|
|
196
|
+
def close(self) -> None: ...
|
|
197
|
+
def move_to(self, x: float, y: float) -> None: ...
|
|
198
|
+
def resize(self, width: float, height: float) -> None: ...
|
|
199
|
+
def move_and_resize(
|
|
200
|
+
self, x: float, y: float, width: float, height: float
|
|
201
|
+
) -> None: ...
|
|
202
|
+
def accepts_user_input(self) -> bool | None: ...
|
|
203
|
+
|
|
204
|
+
class PlatformOverrides:
|
|
205
|
+
def __init__(self) -> None: ...
|
|
206
|
+
desktop_info: int | None
|
|
207
|
+
highlight: int | None
|
|
208
|
+
screenshot: int | None
|
|
209
|
+
pointer: int | None
|
|
210
|
+
keyboard: int | None
|
|
211
|
+
|
|
212
|
+
class Runtime:
|
|
213
|
+
def __init__(self) -> None: ...
|
|
214
|
+
@staticmethod
|
|
215
|
+
def new_with_providers(provider_handles: List[int]) -> "Runtime": ...
|
|
216
|
+
@staticmethod
|
|
217
|
+
def new_with_providers_and_platforms(
|
|
218
|
+
provider_handles: List[int], platforms: PlatformOverrides
|
|
219
|
+
) -> "Runtime": ...
|
|
220
|
+
def evaluate(
|
|
221
|
+
self, xpath: str, node: "UiNode | None" = ...
|
|
222
|
+
) -> List[Union[UiNode, EvaluatedAttribute, UiValue]]: ...
|
|
223
|
+
def evaluate_single(
|
|
224
|
+
self, xpath: str, node: "UiNode | None" = ...
|
|
225
|
+
) -> Union[UiNode, EvaluatedAttribute, UiValue, None]: ...
|
|
226
|
+
def evaluate_iter(
|
|
227
|
+
self, xpath: str, node: "UiNode | None" = ...
|
|
228
|
+
) -> "EvaluationIterator": ...
|
|
229
|
+
def providers(self) -> List[Dict[str, Any]]: ...
|
|
230
|
+
def shutdown(self) -> None: ...
|
|
231
|
+
def desktop_node(self) -> UiNode: ...
|
|
232
|
+
def desktop_info(self) -> Dict[str, Any]: ...
|
|
233
|
+
def focus(self, node: UiNode) -> None: ...
|
|
234
|
+
def pointer_position(self) -> Point: ...
|
|
235
|
+
def pointer_move_to(
|
|
236
|
+
self, point: PointLike, /, overrides: "PointerOverrides | None" = ...
|
|
237
|
+
) -> Point: ...
|
|
238
|
+
def pointer_click(
|
|
239
|
+
self,
|
|
240
|
+
point: PointLike,
|
|
241
|
+
/,
|
|
242
|
+
button: ButtonLike | None = ...,
|
|
243
|
+
overrides: "PointerOverrides | None" = ...,
|
|
244
|
+
) -> None: ...
|
|
245
|
+
def pointer_multi_click(
|
|
246
|
+
self,
|
|
247
|
+
point: PointLike,
|
|
248
|
+
/,
|
|
249
|
+
clicks: int,
|
|
250
|
+
button: ButtonLike | None = ...,
|
|
251
|
+
overrides: "PointerOverrides | None" = ...,
|
|
252
|
+
) -> None: ...
|
|
253
|
+
def pointer_drag(
|
|
254
|
+
self,
|
|
255
|
+
start: PointLike,
|
|
256
|
+
/,
|
|
257
|
+
end: PointLike,
|
|
258
|
+
button: ButtonLike | None = ...,
|
|
259
|
+
overrides: "PointerOverrides | None" = ...,
|
|
260
|
+
) -> None: ...
|
|
261
|
+
def pointer_press(
|
|
262
|
+
self,
|
|
263
|
+
point: PointLike | None = ...,
|
|
264
|
+
button: ButtonLike | None = ...,
|
|
265
|
+
overrides: "PointerOverrides | None" = ...,
|
|
266
|
+
) -> None: ...
|
|
267
|
+
def pointer_release(
|
|
268
|
+
self,
|
|
269
|
+
button: ButtonLike | None = ...,
|
|
270
|
+
overrides: "PointerOverrides | None" = ...,
|
|
271
|
+
) -> None: ...
|
|
272
|
+
def pointer_scroll(
|
|
273
|
+
self, delta: ScrollDeltaLike, overrides: "PointerOverrides | None" = ...
|
|
274
|
+
) -> None: ...
|
|
275
|
+
def keyboard_type(
|
|
276
|
+
self, sequence: str, overrides: "KeyboardOverrides | None" = ...
|
|
277
|
+
) -> None: ...
|
|
278
|
+
def keyboard_press(
|
|
279
|
+
self, sequence: str, overrides: "KeyboardOverrides | None" = ...
|
|
280
|
+
) -> None: ...
|
|
281
|
+
def keyboard_release(
|
|
282
|
+
self, sequence: str, overrides: "KeyboardOverrides | None" = ...
|
|
283
|
+
) -> None: ...
|
|
284
|
+
def highlight(self, rects: Rect | Iterable[Rect], duration_ms: float | None = ...) -> None: ...
|
|
285
|
+
def clear_highlight(self) -> None: ...
|
|
286
|
+
def screenshot(
|
|
287
|
+
self, rect: Rect | None = ..., mime_type: str | None = ...
|
|
288
|
+
) -> bytes: ...
|
|
289
|
+
|
|
290
|
+
class PointerOverrides:
|
|
291
|
+
def __init__(
|
|
292
|
+
self,
|
|
293
|
+
*,
|
|
294
|
+
origin: OriginLike | None = ...,
|
|
295
|
+
speed_factor: float | None = ...,
|
|
296
|
+
acceleration_profile: Literal["constant", "ease_in", "ease_out", "smooth_step"]
|
|
297
|
+
| None = ...,
|
|
298
|
+
max_move_duration_ms: float | None = ...,
|
|
299
|
+
move_time_per_pixel_us: float | None = ...,
|
|
300
|
+
after_move_delay_ms: float | None = ...,
|
|
301
|
+
after_input_delay_ms: float | None = ...,
|
|
302
|
+
press_release_delay_ms: float | None = ...,
|
|
303
|
+
after_click_delay_ms: float | None = ...,
|
|
304
|
+
before_next_click_delay_ms: float | None = ...,
|
|
305
|
+
multi_click_delay_ms: float | None = ...,
|
|
306
|
+
ensure_move_threshold: float | None = ...,
|
|
307
|
+
ensure_move_timeout_ms: float | None = ...,
|
|
308
|
+
scroll_step: Tuple[float, float] | None = ...,
|
|
309
|
+
scroll_delay_ms: float | None = ...,
|
|
310
|
+
) -> None: ...
|
|
311
|
+
@property
|
|
312
|
+
def origin(self) -> Literal["desktop"] | Point | Rect | None: ...
|
|
313
|
+
@property
|
|
314
|
+
def speed_factor(self) -> float | None: ...
|
|
315
|
+
@property
|
|
316
|
+
def acceleration_profile(
|
|
317
|
+
self,
|
|
318
|
+
) -> Literal["constant", "ease_in", "ease_out", "smooth_step"] | None: ...
|
|
319
|
+
@property
|
|
320
|
+
def max_move_duration_ms(self) -> float | None: ...
|
|
321
|
+
@property
|
|
322
|
+
def move_time_per_pixel_us(self) -> float | None: ...
|
|
323
|
+
@property
|
|
324
|
+
def after_move_delay_ms(self) -> float | None: ...
|
|
325
|
+
@property
|
|
326
|
+
def after_input_delay_ms(self) -> float | None: ...
|
|
327
|
+
@property
|
|
328
|
+
def press_release_delay_ms(self) -> float | None: ...
|
|
329
|
+
@property
|
|
330
|
+
def after_click_delay_ms(self) -> float | None: ...
|
|
331
|
+
@property
|
|
332
|
+
def before_next_click_delay_ms(self) -> float | None: ...
|
|
333
|
+
@property
|
|
334
|
+
def multi_click_delay_ms(self) -> float | None: ...
|
|
335
|
+
@property
|
|
336
|
+
def ensure_move_threshold(self) -> float | None: ...
|
|
337
|
+
@property
|
|
338
|
+
def ensure_move_timeout_ms(self) -> float | None: ...
|
|
339
|
+
@property
|
|
340
|
+
def scroll_step(self) -> Tuple[float, float] | None: ...
|
|
341
|
+
@property
|
|
342
|
+
def scroll_delay_ms(self) -> float | None: ...
|
|
343
|
+
|
|
344
|
+
class KeyboardOverrides:
|
|
345
|
+
def __init__(
|
|
346
|
+
self,
|
|
347
|
+
*,
|
|
348
|
+
press_delay_ms: float | None = ...,
|
|
349
|
+
release_delay_ms: float | None = ...,
|
|
350
|
+
between_keys_delay_ms: float | None = ...,
|
|
351
|
+
chord_press_delay_ms: float | None = ...,
|
|
352
|
+
chord_release_delay_ms: float | None = ...,
|
|
353
|
+
after_sequence_delay_ms: float | None = ...,
|
|
354
|
+
after_text_delay_ms: float | None = ...,
|
|
355
|
+
) -> None: ...
|
|
356
|
+
@property
|
|
357
|
+
def press_delay_ms(self) -> float | None: ...
|
|
358
|
+
@property
|
|
359
|
+
def release_delay_ms(self) -> float | None: ...
|
|
360
|
+
@property
|
|
361
|
+
def between_keys_delay_ms(self) -> float | None: ...
|
|
362
|
+
@property
|
|
363
|
+
def chord_press_delay_ms(self) -> float | None: ...
|
|
364
|
+
@property
|
|
365
|
+
def chord_release_delay_ms(self) -> float | None: ...
|
|
366
|
+
@property
|
|
367
|
+
def after_sequence_delay_ms(self) -> float | None: ...
|
|
368
|
+
@property
|
|
369
|
+
def after_text_delay_ms(self) -> float | None: ...
|
|
370
|
+
|
|
371
|
+
# ===== Module exports =====
|
|
372
|
+
|
|
373
|
+
__all__ = [
|
|
374
|
+
# Core types
|
|
375
|
+
"Point",
|
|
376
|
+
"Size",
|
|
377
|
+
"Rect",
|
|
378
|
+
"PatternId",
|
|
379
|
+
"RuntimeId",
|
|
380
|
+
"TechnologyId",
|
|
381
|
+
"Namespace",
|
|
382
|
+
# Runtime
|
|
383
|
+
"Runtime",
|
|
384
|
+
"UiNode",
|
|
385
|
+
"NodeChildrenIterator",
|
|
386
|
+
"NodeAttributesIterator",
|
|
387
|
+
"EvaluationIterator",
|
|
388
|
+
"UiAttribute",
|
|
389
|
+
"EvaluatedAttribute",
|
|
390
|
+
"Focusable",
|
|
391
|
+
"WindowSurface",
|
|
392
|
+
"PlatformOverrides",
|
|
393
|
+
# Overrides
|
|
394
|
+
"PointerOverrides",
|
|
395
|
+
"KeyboardOverrides",
|
|
396
|
+
"PointerButton",
|
|
397
|
+
# Exceptions
|
|
398
|
+
"EvaluationError",
|
|
399
|
+
"ProviderError",
|
|
400
|
+
"PointerError",
|
|
401
|
+
"KeyboardError",
|
|
402
|
+
"PatternError",
|
|
403
|
+
# Mock providers (always available)
|
|
404
|
+
"MOCK_PROVIDER",
|
|
405
|
+
"MOCK_PLATFORM",
|
|
406
|
+
"MOCK_HIGHLIGHT_PROVIDER",
|
|
407
|
+
"MOCK_SCREENSHOT_PROVIDER",
|
|
408
|
+
"MOCK_POINTER_DEVICE",
|
|
409
|
+
"MOCK_KEYBOARD_DEVICE",
|
|
410
|
+
# Type aliases
|
|
411
|
+
"Primitive",
|
|
412
|
+
"JSONLike",
|
|
413
|
+
"Complex",
|
|
414
|
+
"UiValue",
|
|
415
|
+
"PointLike",
|
|
416
|
+
"OriginLike",
|
|
417
|
+
"ScrollDeltaLike",
|
|
418
|
+
"ButtonLike",
|
|
419
|
+
]
|
|
420
|
+
|
|
421
|
+
# Mock provider constants (always available)
|
|
422
|
+
# Use these with Runtime.new_with_providers_and_platforms() for testing
|
|
423
|
+
MOCK_PROVIDER: int # Mock UI tree provider
|
|
424
|
+
MOCK_PLATFORM: int # Mock desktop info provider (provides MockOS desktop info)
|
|
425
|
+
MOCK_HIGHLIGHT_PROVIDER: int # Mock highlight provider
|
|
426
|
+
MOCK_SCREENSHOT_PROVIDER: int # Mock screenshot provider
|
|
427
|
+
MOCK_POINTER_DEVICE: int # Mock pointer/mouse device
|
|
428
|
+
MOCK_KEYBOARD_DEVICE: int # Mock keyboard device
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.0-dev.1"
|
|
Binary file
|
platynui_native/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: platynui-native
|
|
3
|
+
Version: 0.2.0.dev1
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Rust
|
|
15
|
+
Classifier: Topic :: Software Development :: Testing
|
|
16
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
17
|
+
Classifier: Framework :: Robot Framework
|
|
18
|
+
Classifier: Framework :: Robot Framework :: Library
|
|
19
|
+
Requires-Dist: pytest>=8.0 ; extra == 'dev'
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Summary: Native Python bindings for PlatynUI (core types + runtime)
|
|
22
|
+
Keywords: robotframework,platynui,gui,automation,desktop
|
|
23
|
+
Author-email: Daniel Biehl <daniel.biehl@imbus.de>
|
|
24
|
+
Maintainer-email: Daniel Biehl <daniel.biehl@imbus.de>
|
|
25
|
+
License: Apache-2.0
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
28
|
+
Project-URL: Homepage, https://github.com/imbus/robotframework-PlatynUI
|
|
29
|
+
Project-URL: Documentation, https://github.com/imbus/robotframework-PlatynUI#readme
|
|
30
|
+
Project-URL: Changelog, https://github.com/imbus/robotframework-PlatynUI/blob/main/CHANGELOG.md
|
|
31
|
+
Project-URL: Issues, https://github.com/imbus/robotframework-PlatynUI/issues
|
|
32
|
+
Project-URL: Source, https://github.com/imbus/robotframework-PlatynUI
|
|
33
|
+
|
|
34
|
+
platynui-native
|
|
35
|
+
================
|
|
36
|
+
|
|
37
|
+
Native Python bindings for PlatynUI using PyO3 + maturin.
|
|
38
|
+
|
|
39
|
+
Quick start (local develop):
|
|
40
|
+
|
|
41
|
+
- uv sync --dev
|
|
42
|
+
- uv run maturin develop -m packages/native/Cargo.toml --release --features mock-provider
|
|
43
|
+
|
|
44
|
+
Then in Python:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from platynui_native import core, runtime
|
|
48
|
+
pt = core.Point(1.0, 2.0)
|
|
49
|
+
rt = runtime.Runtime()
|
|
50
|
+
items = rt.evaluate("/control:Desktop", None)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Run smoke tests (uses mock provider feature):
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
uv run maturin develop -m packages/native/Cargo.toml --release --features mock-provider
|
|
57
|
+
uv run pytest -q packages/native/tests
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
API overview
|
|
61
|
+
|
|
62
|
+
- Module layout
|
|
63
|
+
- `platynui_native.core`: `Point`/`Size`/`Rect`, `Namespace`, IDs, `attribute_names()`
|
|
64
|
+
- `platynui_native.runtime`: `Runtime`, `UiNode`, `UiAttribute`, `EvaluatedAttribute`, pointer/keyboard methods
|
|
65
|
+
|
|
66
|
+
- Creating a Runtime
|
|
67
|
+
- `rt = runtime.Runtime()`
|
|
68
|
+
|
|
69
|
+
- Pointer buttons
|
|
70
|
+
- Accepts: `'left' | 'middle' | 'right'`, `runtime.PointerButton` enum, or `int`.
|
|
71
|
+
- Mapping: `1 → LEFT`, `2 → MIDDLE`, `3 → RIGHT`, other ints → `Other(n)`.
|
|
72
|
+
|
|
73
|
+
- Pointer overrides (class)
|
|
74
|
+
- Timing (milliseconds unless noted):
|
|
75
|
+
- `after_move_delay_ms`, `after_input_delay_ms`, `press_release_delay_ms`,
|
|
76
|
+
`after_click_delay_ms`, `before_next_click_delay_ms`, `multi_click_delay_ms`,
|
|
77
|
+
`ensure_move_timeout_ms`, `scroll_delay_ms`, `max_move_duration_ms`.
|
|
78
|
+
- `move_time_per_pixel_us` (microseconds per pixel)
|
|
79
|
+
- Motion/profile:
|
|
80
|
+
- `speed_factor: float`
|
|
81
|
+
- `acceleration_profile: 'constant'|'ease_in'|'ease_out'|'smooth_step'`
|
|
82
|
+
- Origin (choose one):
|
|
83
|
+
- `'desktop'`
|
|
84
|
+
- `core.Point(x, y)` → absolute desktop point
|
|
85
|
+
- `core.Rect(x, y, w, h)` → relative to rect (top-left origin)
|
|
86
|
+
- Scrolling:
|
|
87
|
+
- `scroll_step: (h: float, v: float)`; `scroll_delay_ms`
|
|
88
|
+
- Other:
|
|
89
|
+
- `ensure_move_threshold: float`
|
|
90
|
+
- Properties: all fields are exposed read‑only (e.g. `ov.speed_factor`, `ov.origin`, `ov.after_move_delay_ms`).
|
|
91
|
+
|
|
92
|
+
- Keyboard overrides (class, milliseconds)
|
|
93
|
+
- `press_delay_ms`, `release_delay_ms`, `between_keys_delay_ms`,
|
|
94
|
+
`chord_press_delay_ms`, `chord_release_delay_ms`,
|
|
95
|
+
`after_sequence_delay_ms`, `after_text_delay_ms`.
|
|
96
|
+
- Properties: `kov.press_delay_ms`, `kov.between_keys_delay_ms`, etc.
|
|
97
|
+
|
|
98
|
+
Examples
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from platynui_native import core, runtime
|
|
102
|
+
rt = runtime.Runtime()
|
|
103
|
+
|
|
104
|
+
# Move & click with overrides
|
|
105
|
+
ov = runtime.PointerOverrides(speed_factor=1.5, after_move_delay_ms=15, origin='desktop')
|
|
106
|
+
rt.pointer_move_to(core.Point(100, 200), overrides=ov)
|
|
107
|
+
rt.pointer_click(core.Point(100, 200), button=runtime.PointerButton.LEFT,
|
|
108
|
+
overrides=runtime.PointerOverrides(multi_click_delay_ms=240))
|
|
109
|
+
|
|
110
|
+
# Drag with relative origin
|
|
111
|
+
rt.pointer_drag(core.Point(10, 10), core.Point(180, 140), button=runtime.PointerButton.LEFT,
|
|
112
|
+
overrides=runtime.PointerOverrides(origin=core.Rect(50, 60, 200, 200)))
|
|
113
|
+
|
|
114
|
+
# Keyboard with custom timings
|
|
115
|
+
rt.keyboard_type("Hello", overrides=runtime.KeyboardOverrides(between_keys_delay_ms=5))
|
|
116
|
+
rt.keyboard_press("<Ctrl+C>")
|
|
117
|
+
rt.keyboard_release("<Ctrl+C>")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Notes
|
|
121
|
+
|
|
122
|
+
- The mock provider feature (`--features mock-provider`) is intended for local development without platform backends. Some pointer/keyboard calls may raise `PointerError`/`KeyboardError` if the device is not available; structure/typing of arguments is still validated.
|
|
123
|
+
|
|
124
|
+
- Evaluate results
|
|
125
|
+
- `Runtime.evaluate()` returns a list of `UiNode`, `EvaluatedAttribute`, or plain values (`UiValue`).
|
|
126
|
+
- `UiNode.attributes()` returns `list[UiAttribute]` (no owner).
|
|
127
|
+
- `EvaluatedAttribute` includes an `owner()` reference back to the `UiNode` it belongs to.
|
|
128
|
+
|
|
129
|
+
Reference
|
|
130
|
+
|
|
131
|
+
- Pointer defaults (from runtime profile/settings)
|
|
132
|
+
- double_click_time: 500 ms; double_click_size: (4.0, 4.0); default_button: left
|
|
133
|
+
- mode: Linear; steps_per_pixel: 1.5; speed_factor: 1.0
|
|
134
|
+
- max_move_duration: 600 ms; move_time_per_pixel: 800 µs
|
|
135
|
+
- acceleration_profile: SmoothStep
|
|
136
|
+
- after_move_delay: 40 ms; after_input_delay: 35 ms
|
|
137
|
+
- press_release_delay: 50 ms; after_click_delay: 80 ms
|
|
138
|
+
- before_next_click_delay: 120 ms; multi_click_delay: 500 ms
|
|
139
|
+
- ensure_move_position: true; ensure_move_threshold: 2.0; ensure_move_timeout: 250 ms
|
|
140
|
+
- scroll_step: (0.0, -120.0); scroll_delay: 40 ms
|
|
141
|
+
|
|
142
|
+
- Keyboard defaults (KeyboardSettings.default)
|
|
143
|
+
- press_delay: 35 ms; release_delay: 25 ms
|
|
144
|
+
- between_keys_delay: 40 ms
|
|
145
|
+
- chord_press_delay: 45 ms; chord_release_delay: 45 ms
|
|
146
|
+
- after_sequence_delay: 75 ms; after_text_delay: 20 ms
|
|
147
|
+
|
|
148
|
+
Robot Framework usage (example)
|
|
149
|
+
|
|
150
|
+
Wrap the native runtime into a simple Python library and import it in Robot suites:
|
|
151
|
+
|
|
152
|
+
1) Create `examples/robot/platynui_lib.py`:
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
from platynui_native import runtime
|
|
156
|
+
|
|
157
|
+
class PlatynUILib:
|
|
158
|
+
def __init__(self):
|
|
159
|
+
self.rt = runtime.Runtime()
|
|
160
|
+
|
|
161
|
+
def pointer_move_to(self, x: float, y: float):
|
|
162
|
+
self.rt.pointer_move_to((float(x), float(y)))
|
|
163
|
+
|
|
164
|
+
def keyboard_type(self, sequence: str):
|
|
165
|
+
self.rt.keyboard_type(sequence)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
2) Create `examples/robot/quickstart.robot`:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
*** Settings ***
|
|
172
|
+
Library examples/robot/platynui_lib.py
|
|
173
|
+
|
|
174
|
+
*** Test Cases ***
|
|
175
|
+
Pointer And Keyboard Smoke
|
|
176
|
+
Pointer Move To 100 200
|
|
177
|
+
Keyboard Type Hello
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
3) Run with the mock feature installed:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
uv run maturin develop -m packages/native/Cargo.toml --release --features mock-provider
|
|
184
|
+
uv run robot examples/robot/quickstart.robot
|
|
185
|
+
|
|
186
|
+
Troubleshooting
|
|
187
|
+
|
|
188
|
+
## Mock Providers and Platform Devices
|
|
189
|
+
|
|
190
|
+
Mock providers do NOT auto-register in the inventory system. They are explicitly exposed as Python handles for testing:
|
|
191
|
+
|
|
192
|
+
### Available Mock Components
|
|
193
|
+
|
|
194
|
+
- **`MOCK_PROVIDER`** - Mock UI tree provider (provides a test UI tree)
|
|
195
|
+
- **`MOCK_PLATFORM`** - Mock desktop info provider (provides MockOS desktop with 3 monitors)
|
|
196
|
+
- **`MOCK_HIGHLIGHT_PROVIDER`** - Mock highlight provider
|
|
197
|
+
- **`MOCK_SCREENSHOT_PROVIDER`** - Mock screenshot provider
|
|
198
|
+
- **`MOCK_POINTER_DEVICE`** - Mock pointer/mouse device
|
|
199
|
+
- **`MOCK_KEYBOARD_DEVICE`** - Mock keyboard device
|
|
200
|
+
|
|
201
|
+
### Usage Examples
|
|
202
|
+
|
|
203
|
+
**Basic Runtime with Mock Provider:**
|
|
204
|
+
```python
|
|
205
|
+
from platynui_native import Runtime, MOCK_PROVIDER
|
|
206
|
+
|
|
207
|
+
rt = Runtime.new_with_providers([MOCK_PROVIDER])
|
|
208
|
+
# Uses OS platform devices (may fail if not available)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Full Mock Runtime (for testing):**
|
|
212
|
+
```python
|
|
213
|
+
from platynui_native import (
|
|
214
|
+
Runtime, PlatformOverrides,
|
|
215
|
+
MOCK_PROVIDER, MOCK_PLATFORM,
|
|
216
|
+
MOCK_POINTER_DEVICE, MOCK_KEYBOARD_DEVICE,
|
|
217
|
+
MOCK_SCREENSHOT_PROVIDER, MOCK_HIGHLIGHT_PROVIDER
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
# Configure platform overrides
|
|
221
|
+
overrides = PlatformOverrides()
|
|
222
|
+
overrides.desktop_info = MOCK_PLATFORM
|
|
223
|
+
overrides.pointer = MOCK_POINTER_DEVICE
|
|
224
|
+
overrides.keyboard = MOCK_KEYBOARD_DEVICE
|
|
225
|
+
overrides.screenshot = MOCK_SCREENSHOT_PROVIDER
|
|
226
|
+
overrides.highlight = MOCK_HIGHLIGHT_PROVIDER
|
|
227
|
+
|
|
228
|
+
# Create runtime with all mock components
|
|
229
|
+
rt = Runtime.new_with_providers_and_platforms([MOCK_PROVIDER], overrides)
|
|
230
|
+
|
|
231
|
+
# Now all operations work without real OS providers
|
|
232
|
+
info = rt.desktop_info()
|
|
233
|
+
print(info["os_name"]) # Output: "MockOS"
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Build Requirements
|
|
237
|
+
|
|
238
|
+
The `mock-provider` feature links the mock crates, making the handles available:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
uv run maturin develop -m packages/native/Cargo.toml --features mock-provider
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Common Issues
|
|
245
|
+
|
|
246
|
+
- **"no PointerDevice registered"**: Pass `MOCK_POINTER_DEVICE` in `PlatformOverrides`
|
|
247
|
+
- **"no KeyboardDevice registered"**: Pass `MOCK_KEYBOARD_DEVICE` in `PlatformOverrides`
|
|
248
|
+
- **Want mock desktop info**: Pass `MOCK_PLATFORM` in `overrides.desktop_info`
|
|
249
|
+
|
|
250
|
+
## Other Issues
|
|
251
|
+
|
|
252
|
+
- If `maturin` complains about the manifest path, always pass `-m packages/native/Cargo.toml` for mixed projects.
|
|
253
|
+
- If your shell shows a VIRTUAL_ENV mismatch, prefer `uv run --active ...` to target the active environment explicitly.
|
|
254
|
+
```
|
|
255
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
platynui_native-0.2.0.dev1.dist-info/METADATA,sha256=MQMjHBwVaQricAATJ3ci8IEDNwTnORlo7Y3PhTRRLac,9522
|
|
2
|
+
platynui_native-0.2.0.dev1.dist-info/WHEEL,sha256=4EDp_7DiFfWl1yYv5M4wSosAn5L_xgD1dyrQxQxfCx8,95
|
|
3
|
+
platynui_native/.gitignore,sha256=KcvpVACGbbOAdSEz_4Z34MVTd1or0SU8SjmYFqw--Os,233
|
|
4
|
+
platynui_native/__init__.py,sha256=d1z9qsdoy29So556ze8lvnFFDW1pmETd9pwEEmG2ows,1207
|
|
5
|
+
platynui_native/__init__.pyi,sha256=jO85x33i5nxo3lDVm7JJv8L3ihLC1FGXr26IzWmUO9M,14372
|
|
6
|
+
platynui_native/__version__.py,sha256=zNEkW8V0eOm8Z3-3kt4N_ukvoAggOtnjs5RI2dKzDqQ,29
|
|
7
|
+
platynui_native/_native.pyd,sha256=B5BnDWxHfEKnMrOBMXCbA_M_0JAivyjCcm72KHsOBcU,7249408
|
|
8
|
+
platynui_native/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
platynui_native-0.2.0.dev1.dist-info/RECORD,,
|