computer-use-ootb-internal 0.0.100.post1__py3-none-any.whl → 0.0.102.post1__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.
- computer_use_ootb_internal/app_teachmode.py +49 -9
- {computer_use_ootb_internal-0.0.100.post1.dist-info → computer_use_ootb_internal-0.0.102.post1.dist-info}/METADATA +1 -1
- {computer_use_ootb_internal-0.0.100.post1.dist-info → computer_use_ootb_internal-0.0.102.post1.dist-info}/RECORD +5 -5
- {computer_use_ootb_internal-0.0.100.post1.dist-info → computer_use_ootb_internal-0.0.102.post1.dist-info}/WHEEL +0 -0
- {computer_use_ootb_internal-0.0.100.post1.dist-info → computer_use_ootb_internal-0.0.102.post1.dist-info}/entry_points.txt +0 -0
@@ -8,6 +8,7 @@ import platform # Add platform import
|
|
8
8
|
import subprocess # Add subprocess import
|
9
9
|
import pyautogui # Add pyautogui import
|
10
10
|
import webbrowser # Add webbrowser import
|
11
|
+
import os # Import os for path joining
|
11
12
|
from fastapi import FastAPI, Request
|
12
13
|
from fastapi.responses import JSONResponse
|
13
14
|
from fastapi.middleware.cors import CORSMiddleware
|
@@ -104,14 +105,50 @@ def prepare_environment(state):
|
|
104
105
|
if is_star_rail:
|
105
106
|
print("Star Rail mode detected on Windows. Opening Edge browser...")
|
106
107
|
url = "https://sr.mihoyo.com/cloud/#/"
|
108
|
+
browser_opened = False
|
107
109
|
try:
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
print(f"Attempting to open {url} using specific Edge paths...")
|
111
|
+
# Common paths for msedge.exe
|
112
|
+
edge_paths = [
|
113
|
+
os.path.join(os.environ.get("ProgramFiles(x86)", "C:\Program Files (x86)"), "Microsoft\Edge\Application\msedge.exe"),
|
114
|
+
os.path.join(os.environ.get("ProgramFiles", "C:\Program Files"), "Microsoft\Edge\Application\msedge.exe")
|
115
|
+
]
|
116
|
+
|
117
|
+
opened_with_subprocess = False
|
118
|
+
for edge_path in edge_paths:
|
119
|
+
if os.path.exists(edge_path):
|
120
|
+
try:
|
121
|
+
print(f"Trying path: {edge_path}")
|
122
|
+
subprocess.Popen([edge_path, url])
|
123
|
+
print(f"Successfully launched Edge with Popen using path: {edge_path}")
|
124
|
+
opened_with_subprocess = True
|
125
|
+
browser_opened = True
|
126
|
+
break # Exit loop once successfully opened
|
127
|
+
except Exception as sub_e:
|
128
|
+
print(f"Failed to launch Edge with Popen using {edge_path}: {sub_e}")
|
129
|
+
else:
|
130
|
+
print(f"Edge path not found: {edge_path}")
|
131
|
+
|
132
|
+
# Fallback to webbrowser.open if subprocess failed
|
133
|
+
if not opened_with_subprocess:
|
134
|
+
print("Subprocess launch failed, falling back to webbrowser.open()...")
|
135
|
+
try:
|
136
|
+
if webbrowser.open(url):
|
137
|
+
print("Successfully opened browser using webbrowser.open() as fallback.")
|
138
|
+
browser_opened = True
|
139
|
+
else:
|
140
|
+
print("webbrowser.open() also failed to indicate success.")
|
141
|
+
except Exception as web_e:
|
142
|
+
print(f"webbrowser.open() fallback failed: {web_e}")
|
143
|
+
|
144
|
+
if not browser_opened:
|
145
|
+
print("ERROR: Failed to open browser using both subprocess and webbrowser.")
|
146
|
+
# Decide if you want to proceed without the browser or raise an error
|
147
|
+
# For now, we'll proceed to the click attempt but it might fail
|
148
|
+
|
149
|
+
# Add pyautogui click after attempting to open the browser
|
150
|
+
print("Proceeding with pyautogui actions...")
|
151
|
+
time.sleep(5) # Wait time for the browser to load
|
115
152
|
|
116
153
|
# Print detected screen size
|
117
154
|
screen_width, screen_height = pyautogui.size()
|
@@ -127,19 +164,22 @@ def prepare_environment(state):
|
|
127
164
|
|
128
165
|
print(f"Clicking at coordinates: ({click_x}, {click_y})")
|
129
166
|
pyautogui.click(click_x, click_y)
|
167
|
+
time.sleep(2)
|
168
|
+
pyautogui.click(click_x, click_y)
|
130
169
|
|
131
170
|
# Re-enable failsafe (optional, as script might end anyway)
|
132
171
|
# pyautogui.FAILSAFE = True
|
133
172
|
# print("PyAutoGUI failsafe re-enabled.")
|
134
173
|
|
135
174
|
except FileNotFoundError:
|
136
|
-
# This error
|
137
|
-
print("Error: Could not
|
175
|
+
# This specific error might occur if edge_path exists but execution fails
|
176
|
+
print("Error: Could not execute the browser command (FileNotFound). Check permissions or path.")
|
138
177
|
except Exception as e:
|
139
178
|
print(f"Error during environment preparation (browser/click): {e}")
|
140
179
|
finally:
|
141
180
|
# Ensure failsafe is re-enabled if an error occurs after disabling it
|
142
181
|
pyautogui.FAILSAFE = True
|
182
|
+
print("PyAutoGUI failsafe re-enabled.")
|
143
183
|
else:
|
144
184
|
# Placeholder for potential preparations on other OS or non-Star Rail modes
|
145
185
|
print("Environment preparation: No specific actions required for this OS/mode.")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
computer_use_ootb_internal/README.md,sha256=FxpW95lyub2iX73ZDfK6ML7SdEKg060H5I6Grub7li4,31
|
2
|
-
computer_use_ootb_internal/app_teachmode.py,sha256=
|
2
|
+
computer_use_ootb_internal/app_teachmode.py,sha256=k4Y5ecIPmgQrtBkSV_xPHb0C6tssdEWfqI7uQsW2ku8,20963
|
3
3
|
computer_use_ootb_internal/app_teachmode_gradio.py,sha256=zAw-n3s20j1Jr0S4TzXHwllKV6APJ8HEHB1KqBuzriY,7907
|
4
4
|
computer_use_ootb_internal/dependency_check.py,sha256=y8RMEP6RXQzTgU1MS_1piBLtz4J-Hfn9RjUZg59dyvo,1333
|
5
5
|
computer_use_ootb_internal/example_websocket_js.html,sha256=BLYwDExVlgiAX4vXVXW3RuP5KD8FXE4EFXIl54bwF7w,1322
|
@@ -38,7 +38,7 @@ computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py,sha256=zZu
|
|
38
38
|
computer_use_ootb_internal/computer_use_demo/tools/edit.py,sha256=b0PwUitxckHCQqFP3ZwlthWdqNkn7WETeTHeB6-o98c,11486
|
39
39
|
computer_use_ootb_internal/computer_use_demo/tools/run.py,sha256=xhXdnBK1di9muaO44CEirL9hpGy3NmKbjfMpyeVmn8Y,1595
|
40
40
|
computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py,sha256=L8qfvtUkPPQGt92N-2Zfw5ZTDBzLsDps39uMnX3_uSA,6857
|
41
|
-
computer_use_ootb_internal-0.0.
|
42
|
-
computer_use_ootb_internal-0.0.
|
43
|
-
computer_use_ootb_internal-0.0.
|
44
|
-
computer_use_ootb_internal-0.0.
|
41
|
+
computer_use_ootb_internal-0.0.102.post1.dist-info/METADATA,sha256=Wu4c7JCwLWtGWf96CQAh37Pfs4y8Rf1lOO_Jc4jnXEc,943
|
42
|
+
computer_use_ootb_internal-0.0.102.post1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
43
|
+
computer_use_ootb_internal-0.0.102.post1.dist-info/entry_points.txt,sha256=-AbmawU7IRQuDZihgVMVDrFoY4E6rnXYOUB-5vSeBKs,93
|
44
|
+
computer_use_ootb_internal-0.0.102.post1.dist-info/RECORD,,
|
File without changes
|