computer-use-ootb-internal 0.0.99.post1__py3-none-any.whl → 0.0.101.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.
@@ -7,6 +7,7 @@ import requests
7
7
  import platform # Add platform import
8
8
  import subprocess # Add subprocess import
9
9
  import pyautogui # Add pyautogui import
10
+ import webbrowser # Add webbrowser import
10
11
  from fastapi import FastAPI, Request
11
12
  from fastapi.responses import JSONResponse
12
13
  from fastapi.middleware.cors import CORSMiddleware
@@ -104,22 +105,41 @@ def prepare_environment(state):
104
105
  print("Star Rail mode detected on Windows. Opening Edge browser...")
105
106
  url = "https://sr.mihoyo.com/cloud/#/"
106
107
  try:
107
- # Use cmd /c start to open the URL in Edge without blocking
108
- subprocess.run(["cmd", "/c", "start", "msedge", url], check=True, shell=False)
109
- print(f"Successfully requested Edge to open {url}")
108
+ # Use webbrowser.open to open the URL in the default browser
109
+ print(f"Attempting to open {url} in browser...")
110
+ webbrowser.open(url)
111
+ print(f"Successfully requested browser to open {url}")
110
112
 
111
113
  # Add pyautogui click after opening the browser
112
- time.sleep(2) # Wait a bit for the browser to potentially load
114
+ time.sleep(5) # Increased wait time for the browser to load
115
+
116
+ # Print detected screen size
113
117
  screen_width, screen_height = pyautogui.size()
118
+ print(f"Detected screen size: {screen_width}x{screen_height}")
119
+
114
120
  click_x = int(screen_width * (1036 / 1280))
115
121
  click_y = int(screen_height * (500 / 720))
122
+ print(f"Calculated click coordinates: ({click_x}, {click_y})")
123
+
124
+ # Disable failsafe before clicking
125
+ pyautogui.FAILSAFE = False
126
+ print("PyAutoGUI failsafe temporarily disabled.")
127
+
116
128
  print(f"Clicking at coordinates: ({click_x}, {click_y})")
117
129
  pyautogui.click(click_x, click_y)
130
+
131
+ # Re-enable failsafe (optional, as script might end anyway)
132
+ # pyautogui.FAILSAFE = True
133
+ # print("PyAutoGUI failsafe re-enabled.")
118
134
 
119
135
  except FileNotFoundError:
120
- print("Error: Microsoft Edge not found. Please ensure it's installed and in PATH.")
136
+ # This error is less likely with webbrowser.open
137
+ print("Error: Could not find a web browser to open the URL.")
121
138
  except Exception as e:
122
- print(f"Error opening Edge: {e}")
139
+ print(f"Error during environment preparation (browser/click): {e}")
140
+ finally:
141
+ # Ensure failsafe is re-enabled if an error occurs after disabling it
142
+ pyautogui.FAILSAFE = True
123
143
  else:
124
144
  # Placeholder for potential preparations on other OS or non-Star Rail modes
125
145
  print("Environment preparation: No specific actions required for this OS/mode.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: computer-use-ootb-internal
3
- Version: 0.0.99.post1
3
+ Version: 0.0.101.post1
4
4
  Summary: Computer Use OOTB
5
5
  Author-email: Siyuan Hu <siyuan.hu.sg@gmail.com>
6
6
  Requires-Python: >=3.11
@@ -1,5 +1,5 @@
1
1
  computer_use_ootb_internal/README.md,sha256=FxpW95lyub2iX73ZDfK6ML7SdEKg060H5I6Grub7li4,31
2
- computer_use_ootb_internal/app_teachmode.py,sha256=N2M7lGLwCezvZytdy884Cy1qF7C3pPGaF1FyayPnE3M,17756
2
+ computer_use_ootb_internal/app_teachmode.py,sha256=Ya8EnJAA6YfkcbaSEtoiGQ39_63IzJj1yawaSBuoZuk,18613
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.99.post1.dist-info/METADATA,sha256=KvfE1u3MumMHrbYvdCGhksJpFuqjbZAxA12qpmgrl3U,942
42
- computer_use_ootb_internal-0.0.99.post1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
- computer_use_ootb_internal-0.0.99.post1.dist-info/entry_points.txt,sha256=-AbmawU7IRQuDZihgVMVDrFoY4E6rnXYOUB-5vSeBKs,93
44
- computer_use_ootb_internal-0.0.99.post1.dist-info/RECORD,,
41
+ computer_use_ootb_internal-0.0.101.post1.dist-info/METADATA,sha256=rvP5hGYf8ioubZbD3vHDDfR7s83KQMUTbgXG1pQ-ujg,943
42
+ computer_use_ootb_internal-0.0.101.post1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
+ computer_use_ootb_internal-0.0.101.post1.dist-info/entry_points.txt,sha256=-AbmawU7IRQuDZihgVMVDrFoY4E6rnXYOUB-5vSeBKs,93
44
+ computer_use_ootb_internal-0.0.101.post1.dist-info/RECORD,,