pycoze 0.1.282__py3-none-any.whl → 0.1.284__py3-none-any.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.
- pycoze/api/lib/tab_cls.py +5 -5
- pycoze/api/lib/window_cls.py +59 -46
- {pycoze-0.1.282.dist-info → pycoze-0.1.284.dist-info}/METADATA +1 -1
- {pycoze-0.1.282.dist-info → pycoze-0.1.284.dist-info}/RECORD +7 -7
- {pycoze-0.1.282.dist-info → pycoze-0.1.284.dist-info}/LICENSE +0 -0
- {pycoze-0.1.282.dist-info → pycoze-0.1.284.dist-info}/WHEEL +0 -0
- {pycoze-0.1.282.dist-info → pycoze-0.1.284.dist-info}/top_level.txt +0 -0
pycoze/api/lib/tab_cls.py
CHANGED
@@ -42,31 +42,31 @@ class TabCls:
|
|
42
42
|
results = socket.post_and_recv_result("get-all-tabs", {})
|
43
43
|
return results
|
44
44
|
|
45
|
-
def close_tab(self, location: list[str]
|
45
|
+
def close_tab(self, location: Union[list[str], ViewCls]):
|
46
46
|
if isinstance(location, ViewCls):
|
47
47
|
location = location.location
|
48
48
|
self.wait_for_tab_open(location)
|
49
49
|
socket.post("close-tab", {"location": location})
|
50
50
|
|
51
|
-
def switch_tab(self, location: list[str]
|
51
|
+
def switch_tab(self, location: Union[list[str], ViewCls]):
|
52
52
|
if isinstance(location, ViewCls):
|
53
53
|
location = location.location
|
54
54
|
self.wait_for_tab_open(location)
|
55
55
|
socket.post("switchTab", {"location": location})
|
56
56
|
|
57
|
-
def is_tab_open(self, location: list[str]
|
57
|
+
def is_tab_open(self, location: Union[list[str], ViewCls]):
|
58
58
|
if isinstance(location, ViewCls):
|
59
59
|
location = location.location
|
60
60
|
result = socket.post_and_recv_result("is-tab-open", {"location": location})
|
61
61
|
return result
|
62
62
|
|
63
|
-
def pin_tab(self, location: list[str]
|
63
|
+
def pin_tab(self, location: Union[list[str], ViewCls]):
|
64
64
|
if isinstance(location, ViewCls):
|
65
65
|
location = location.location
|
66
66
|
self.wait_for_tab_open(location)
|
67
67
|
socket.post("pin-tab", {"location": location})
|
68
68
|
|
69
|
-
def unpin_tab(self, location: list[str]
|
69
|
+
def unpin_tab(self, location: Union[list[str], ViewCls]):
|
70
70
|
if isinstance(location, ViewCls):
|
71
71
|
location = location.location
|
72
72
|
self.wait_for_tab_open(location)
|
pycoze/api/lib/window_cls.py
CHANGED
@@ -1,46 +1,59 @@
|
|
1
|
-
import sys
|
2
|
-
import subprocess
|
3
|
-
import os
|
4
|
-
from pycoze import utils
|
5
|
-
|
6
|
-
|
7
|
-
socket = utils.socket
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
socket.post("
|
22
|
-
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
1
|
+
import sys
|
2
|
+
import subprocess
|
3
|
+
import os
|
4
|
+
from pycoze import utils
|
5
|
+
|
6
|
+
|
7
|
+
socket = utils.socket
|
8
|
+
|
9
|
+
|
10
|
+
class WindowCls:
|
11
|
+
|
12
|
+
def message(self, message: str, type: str = "info"):
|
13
|
+
assert type in [
|
14
|
+
"info",
|
15
|
+
"warning",
|
16
|
+
"success",
|
17
|
+
"error",
|
18
|
+
], "type must be info, warning, success or error"
|
19
|
+
if not isinstance(message, str):
|
20
|
+
message = repr(message)
|
21
|
+
socket.post("append-msg", {"message": message, "type": type})
|
22
|
+
|
23
|
+
def confirm(self, title: str, message: str) -> bool:
|
24
|
+
return socket.post_and_recv_result(
|
25
|
+
"confirm", {"title": title, "message": message}
|
26
|
+
)
|
27
|
+
|
28
|
+
def input(self, title: str, message: str) -> str:
|
29
|
+
return socket.post_and_recv_result(
|
30
|
+
"input", {"title": title, "message": message}
|
31
|
+
)
|
32
|
+
|
33
|
+
def maximize(self):
|
34
|
+
socket.post("maximize", {})
|
35
|
+
|
36
|
+
def get_slected_text(self) -> str:
|
37
|
+
result = socket.post_and_recv_result("get-selected-text", {})
|
38
|
+
return result
|
39
|
+
|
40
|
+
def open_file_with_system(self, file_path, wait: bool):
|
41
|
+
process_fn = subprocess.run if wait else subprocess.Popen
|
42
|
+
if sys.platform.startswith("linux"):
|
43
|
+
process_fn(["xdg-open", file_path])
|
44
|
+
elif sys.platform.startswith("darwin"):
|
45
|
+
process_fn(["open", file_path])
|
46
|
+
elif sys.platform.startswith("win32") or sys.platform.startswith("cygwin"):
|
47
|
+
os.startfile(file_path)
|
48
|
+
else:
|
49
|
+
raise OSError("Unsupported operating system")
|
50
|
+
|
51
|
+
def open_program(self, program_path, wait: bool):
|
52
|
+
process_fn = subprocess.run if wait else subprocess.Popen
|
53
|
+
process_fn([program_path])
|
54
|
+
|
55
|
+
def execute_javaScript(self, js_code: str):
|
56
|
+
result = socket.post_and_recv_result("executeJavaScript", {"code": js_code})
|
57
|
+
if not result["ok"]:
|
58
|
+
raise Exception(result["value"])
|
59
|
+
return result["value"] if "value" in result else None
|
@@ -7,9 +7,9 @@ pycoze/ai/llm/text_to_image_prompt.py,sha256=0bx2C_YRvjAo7iphHGp1-pmGKsKqwur7dM0
|
|
7
7
|
pycoze/ai/llm/think.py,sha256=sUgTBdGzcZtL3r-Wx8M3lDuVUmDVz8g3qC0VU8uiKAI,5143
|
8
8
|
pycoze/api/__init__.py,sha256=GGRRRPop0ZxdXe5JRhg2XvHITGIWfNcHA25opJZ0f1w,313
|
9
9
|
pycoze/api/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
pycoze/api/lib/tab_cls.py,sha256=
|
10
|
+
pycoze/api/lib/tab_cls.py,sha256=lD2Uvylzi-zsHj-27YI1mS4ggbIGtCi3vypvGvY48gM,2619
|
11
11
|
pycoze/api/lib/view.py,sha256=_PIpTfeuTPPlMDKshMGsqFQYMq7ZiO4Hg5XwHwDoU60,7357
|
12
|
-
pycoze/api/lib/window_cls.py,sha256=
|
12
|
+
pycoze/api/lib/window_cls.py,sha256=bTkQCzQZ7i3pYXB70bUSTBNJ9C4TW_X3yMae1VkquGk,1944
|
13
13
|
pycoze/bot/__init__.py,sha256=JxnRoCCqx_LFyVb3pLu0qYCsH8ZLuAaMXAtvVUuCHuE,78
|
14
14
|
pycoze/bot/agent_chat.py,sha256=ARXXsIVCTpmBojz2C4BR69nB0QhM6gkEngL3iq34JPo,4178
|
15
15
|
pycoze/bot/bot.py,sha256=_qmUTZ09FmRLifHrW5stDZWGVK6yuMEMBC3fmeYJnqk,844
|
@@ -35,8 +35,8 @@ pycoze/utils/arg.py,sha256=jop1tBfe5hYkHW1NSpCeaZBEznkgguBscj_7M2dWfrs,503
|
|
35
35
|
pycoze/utils/env.py,sha256=5pWlXfM1F5ZU9hhv1rHlDEanjEW5wf0nbyez9bNRqqA,559
|
36
36
|
pycoze/utils/socket.py,sha256=bZbFFRH4mfThzRqt55BAAGQ6eICx_ja4x8UGGrUdAm8,2428
|
37
37
|
pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
|
38
|
-
pycoze-0.1.
|
39
|
-
pycoze-0.1.
|
40
|
-
pycoze-0.1.
|
41
|
-
pycoze-0.1.
|
42
|
-
pycoze-0.1.
|
38
|
+
pycoze-0.1.284.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
|
39
|
+
pycoze-0.1.284.dist-info/METADATA,sha256=7NRzJB0uGt2arHh5jYvBXhcspsqvN7RQmLtr7BUsaa4,755
|
40
|
+
pycoze-0.1.284.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
|
41
|
+
pycoze-0.1.284.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
|
42
|
+
pycoze-0.1.284.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|