pycoze 0.1.283__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.
@@ -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
- class WindowCls:
10
-
11
- def message(self, message: str, type: str = 'info'):
12
- assert type in ['info', 'warning', 'success', 'error'], 'type must be info, warning, success or error'
13
- if not isinstance(message, str):
14
- message = repr(message)
15
- socket.post("append-msg", {"message": message, "type": type})
16
-
17
- def confirm(self, title:str, message: str) -> bool:
18
- return socket.post_and_recv_result("confirm", {"title":title, "message": message})
19
-
20
- def maximize(self):
21
- socket.post("maximize", {})
22
-
23
- def get_slected_text(self) -> str:
24
- result = socket.post_and_recv_result("get-selected-text", {})
25
- return result
26
-
27
- def open_file_with_system(self, file_path, wait: bool):
28
- process_fn = subprocess.run if wait else subprocess.Popen
29
- if sys.platform.startswith('linux'):
30
- process_fn(['xdg-open', file_path])
31
- elif sys.platform.startswith('darwin'):
32
- process_fn(['open', file_path])
33
- elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'):
34
- os.startfile(file_path)
35
- else:
36
- raise OSError('Unsupported operating system')
37
-
38
- def open_program(self, program_path, wait: bool):
39
- process_fn = subprocess.run if wait else subprocess.Popen
40
- process_fn([program_path])
41
-
42
- def execute_javaScript(self, js_code: str):
43
- result = socket.post_and_recv_result("executeJavaScript", {"code": js_code})
44
- if not result["ok"]:
45
- raise Exception(result["value"])
46
- return result["value"] if "value" in result else None
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.283
3
+ Version: 0.1.284
4
4
  Summary: Package for pycoze only!
5
5
  Home-page: UNKNOWN
6
6
  Author: Yuan Jie Xiong
@@ -9,7 +9,7 @@ pycoze/api/__init__.py,sha256=GGRRRPop0ZxdXe5JRhg2XvHITGIWfNcHA25opJZ0f1w,313
9
9
  pycoze/api/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
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=Yezy-SR_EwVtUjrgXnHRC69WGgXVaXeJHjaxn09Ophg,1737
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.283.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
39
- pycoze-0.1.283.dist-info/METADATA,sha256=mPKe547GwDHZgsiGSXB726lGwmQsrEqGU9yqetxNHQk,755
40
- pycoze-0.1.283.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
41
- pycoze-0.1.283.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
42
- pycoze-0.1.283.dist-info/RECORD,,
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,,