computer-use-ootb-internal 0.0.125__py3-none-any.whl → 0.0.126__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/preparation/star_rail_prepare.py +29 -31
- {computer_use_ootb_internal-0.0.125.dist-info → computer_use_ootb_internal-0.0.126.dist-info}/METADATA +1 -1
- {computer_use_ootb_internal-0.0.125.dist-info → computer_use_ootb_internal-0.0.126.dist-info}/RECORD +5 -5
- {computer_use_ootb_internal-0.0.125.dist-info → computer_use_ootb_internal-0.0.126.dist-info}/WHEEL +0 -0
- {computer_use_ootb_internal-0.0.125.dist-info → computer_use_ootb_internal-0.0.126.dist-info}/entry_points.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
# src/computer_use_ootb_internal/preparation/star_rail_prepare.py
|
2
2
|
import time
|
3
3
|
import platform
|
4
|
-
import
|
4
|
+
import subprocess # Added for taskkill
|
5
5
|
import webbrowser
|
6
6
|
import logging # Use logging instead of print for better practice
|
7
7
|
|
@@ -11,7 +11,7 @@ log = logging.getLogger(__name__)
|
|
11
11
|
def run_preparation(state):
|
12
12
|
"""
|
13
13
|
Performs environment preparation specific to Star Rail on Windows.
|
14
|
-
|
14
|
+
Closes existing Edge browsers and opens the specified URL in a new Edge instance.
|
15
15
|
"""
|
16
16
|
if platform.system() != "Windows":
|
17
17
|
log.info("Star Rail preparation skipped: Not running on Windows.")
|
@@ -21,45 +21,43 @@ def run_preparation(state):
|
|
21
21
|
url = "https://sr.mihoyo.com/cloud/#/" # Consider making this configurable later
|
22
22
|
browser_opened = False
|
23
23
|
try:
|
24
|
+
# Attempt to close existing Microsoft Edge processes
|
25
|
+
log.info("Attempting to close existing Microsoft Edge processes...")
|
26
|
+
try:
|
27
|
+
# /F forces termination, /IM specifies image name
|
28
|
+
result = subprocess.run(['taskkill', '/F', '/IM', 'msedge.exe'],
|
29
|
+
capture_output=True, text=True, check=False)
|
30
|
+
if result.returncode == 0:
|
31
|
+
log.info("Successfully sent termination signal to msedge.exe processes.")
|
32
|
+
elif "not found" in result.stderr.lower() or "not found" in result.stdout.lower():
|
33
|
+
log.info("No running msedge.exe processes found to close.")
|
34
|
+
else:
|
35
|
+
log.warning(f"taskkill command finished with return code {result.returncode}. Output: {result.stdout} Stderr: {result.stderr}")
|
36
|
+
time.sleep(2) # Give processes time to close
|
37
|
+
except FileNotFoundError:
|
38
|
+
log.error("Error: 'taskkill' command not found. Make sure it's in the system PATH.")
|
39
|
+
except Exception as e:
|
40
|
+
log.error(f"Error occurred while trying to close Edge: {e}", exc_info=True)
|
41
|
+
|
42
|
+
|
24
43
|
# Use only webbrowser.open
|
25
44
|
log.info(f"Attempting to open {url} using webbrowser.open()...")
|
26
45
|
if webbrowser.open(url):
|
27
46
|
log.info(f"Successfully requested browser to open {url} via webbrowser.open().")
|
28
47
|
browser_opened = True
|
48
|
+
time.sleep(5) # Wait time for the browser to potentially load the page
|
29
49
|
else:
|
30
50
|
log.warning("webbrowser.open() returned False, indicating potential failure.")
|
51
|
+
# No need to error out completely if browser *request* failed,
|
52
|
+
# but it's unlikely the rest of the process would work.
|
31
53
|
|
32
54
|
if not browser_opened:
|
33
|
-
|
34
|
-
|
35
|
-
# Add pyautogui click after attempting to open the browser
|
36
|
-
log.info("Proceeding with pyautogui actions...")
|
37
|
-
time.sleep(5) # Wait time for the browser to load
|
38
|
-
|
39
|
-
# Get screen size
|
40
|
-
screen_width, screen_height = pyautogui.size()
|
41
|
-
log.info(f"Detected screen size: {screen_width}x{screen_height}")
|
42
|
-
|
43
|
-
# Calculate click coordinates based on a reference resolution (e.g., 1280x720)
|
44
|
-
# TODO: Make these coordinates more robust or configurable
|
45
|
-
click_x = int(screen_width * (1036 / 1280))
|
46
|
-
click_y = int(screen_height * (500 / 720))
|
47
|
-
log.info(f"Calculated click coordinates: ({click_x}, {click_y})")
|
48
|
-
|
49
|
-
# Disable failsafe before clicking
|
50
|
-
pyautogui.FAILSAFE = False
|
51
|
-
log.info("PyAutoGUI failsafe temporarily disabled.")
|
55
|
+
log.error("Failed to confirm browser opening via webbrowser.open().")
|
52
56
|
|
53
|
-
|
54
|
-
pyautogui.click(click_x, click_y)
|
55
|
-
time.sleep(2)
|
56
|
-
pyautogui.click(click_x, click_y) # Double click?
|
57
|
+
# Removed pyautogui click logic
|
57
58
|
|
58
|
-
log.info("Star Rail preparation
|
59
|
+
log.info("Star Rail preparation completed (browser opened).")
|
59
60
|
|
60
61
|
except Exception as e:
|
61
|
-
log.error(f"Error during Star Rail preparation
|
62
|
-
finally
|
63
|
-
# Ensure failsafe is re-enabled
|
64
|
-
pyautogui.FAILSAFE = True
|
65
|
-
log.info("PyAutoGUI failsafe re-enabled.")
|
62
|
+
log.error(f"Error during Star Rail preparation: {e}", exc_info=True)
|
63
|
+
# No finally block needed anymore as pyautogui failsafe is removed
|
{computer_use_ootb_internal-0.0.125.dist-info → computer_use_ootb_internal-0.0.126.dist-info}/RECORD
RENAMED
@@ -32,8 +32,8 @@ computer_use_ootb_internal/computer_use_demo/tools/edit.py,sha256=b0PwUitxckHCQq
|
|
32
32
|
computer_use_ootb_internal/computer_use_demo/tools/run.py,sha256=xhXdnBK1di9muaO44CEirL9hpGy3NmKbjfMpyeVmn8Y,1595
|
33
33
|
computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py,sha256=L8qfvtUkPPQGt92N-2Zfw5ZTDBzLsDps39uMnX3_uSA,6857
|
34
34
|
computer_use_ootb_internal/preparation/__init__.py,sha256=AgtGHcBpiTkxJjF0xwcs3yyQ6SyUvhL3G0vD2XO-zJw,63
|
35
|
-
computer_use_ootb_internal/preparation/star_rail_prepare.py,sha256=
|
36
|
-
computer_use_ootb_internal-0.0.
|
37
|
-
computer_use_ootb_internal-0.0.
|
38
|
-
computer_use_ootb_internal-0.0.
|
39
|
-
computer_use_ootb_internal-0.0.
|
35
|
+
computer_use_ootb_internal/preparation/star_rail_prepare.py,sha256=2Q1TcXE09F1-W7boTHfuQkGhaFD1YDuiQV8qvG83wOY,3000
|
36
|
+
computer_use_ootb_internal-0.0.126.dist-info/METADATA,sha256=COh06SOLvlusAtDfKXDv5Rr_hxHwNgrSSQEI-qlcZW8,1048
|
37
|
+
computer_use_ootb_internal-0.0.126.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
38
|
+
computer_use_ootb_internal-0.0.126.dist-info/entry_points.txt,sha256=bXfyAU_qq-G1EiEgAQEioXvgEdRCFxaTooqdDD9Y4OA,258
|
39
|
+
computer_use_ootb_internal-0.0.126.dist-info/RECORD,,
|
{computer_use_ootb_internal-0.0.125.dist-info → computer_use_ootb_internal-0.0.126.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|