Skip to content

Commit 100814d

Browse files
committed
修改: 更新依赖版本
1 parent 26226c0 commit 100814d

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

pdm.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = [
66
{name = "5656565566", email = "2393963330@qq.com"},
77
]
88
dependencies = [
9-
"maafw>=5.9.2",
9+
"maafw>=5.10.4",
1010
"loguru>=0.7.2",
1111
"textual>=8.1.1",
1212
"rich>=13.9.4",

src/mluascript/control/devices/facade.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from mluascript.maa.lifecycle.runtime import MaaContext
2626
from mluascript.maa.types import MaaPaths
2727
from mluascript.shared.config import GlobalConfig, config, load_config
28+
from mluascript.shared.logging import logger
2829

2930
from .models import (
3031
ConnectAdbRequest,
@@ -76,6 +77,7 @@ def find_adb(self) -> DeviceActionResult:
7677
self._adb_page = 0
7778
return DeviceActionResult(ok=True, message=f"已搜索到 {len(self._adb_raw)} 个 ADB 设备", overview=self.get_overview())
7879
except Exception as exc:
80+
logger.error(f"Device operation failed: {exc}", exc_info=True)
7981
return DeviceActionResult(ok=False, message=f"搜索 ADB 设备失败: {exc}", severity="error", overview=self.get_overview())
8082

8183
def find_desktop(self) -> DeviceActionResult:
@@ -84,6 +86,7 @@ def find_desktop(self) -> DeviceActionResult:
8486
self._desktop_page = 0
8587
return DeviceActionResult(ok=True, message=f"已搜索到 {len(self._desktop_raw)}{current_desktop_label()}", overview=self.get_overview())
8688
except Exception as exc:
89+
logger.error(f"Device operation failed: {exc}", exc_info=True)
8790
return DeviceActionResult(ok=False, message=f"搜索本地窗口失败: {exc}", severity="error", overview=self.get_overview())
8891

8992
def change_adb_page(self, delta: int) -> DeviceOverview:
@@ -107,6 +110,7 @@ def connect_adb(self, request: ConnectAdbRequest) -> DeviceActionResult:
107110
self._maa_facade.attach_session(session)
108111
return DeviceActionResult(ok=True, message=f"已连接 ADB 设备: {address}", overview=self.get_overview())
109112
except Exception as exc:
113+
logger.error(f"Device operation failed: {exc}", exc_info=True)
110114
return DeviceActionResult(ok=False, message=f"连接 ADB 失败: {exc}", severity="error", overview=self.get_overview())
111115

112116
def connect_device(self, action_id: str) -> DeviceActionResult:
@@ -125,6 +129,7 @@ def disconnect_device(self) -> DeviceActionResult:
125129
self._maa_facade.clear_session()
126130
return DeviceActionResult(ok=True, message="已断开当前设备连接", overview=self.get_overview())
127131
except Exception as exc:
132+
logger.error(f"Device operation failed: {exc}", exc_info=True)
128133
return DeviceActionResult(ok=False, message=f"断开设备连接失败: {exc}", severity="error", overview=self.get_overview())
129134

130135
def _capture_current_screenshot_result(self) -> DeviceActionResult:
@@ -168,6 +173,8 @@ def _capture_current_screenshot_result(self) -> DeviceActionResult:
168173
)
169174

170175
except Exception as exc:
176+
177+
logger.error(f"Device operation failed: {exc}", exc_info=True)
171178
return DeviceActionResult(
172179
ok=False,
173180
message=f"截图处理时发生异常: {exc}",
@@ -193,6 +200,7 @@ def screencap_current_and_save(self) -> DeviceActionResult:
193200
result.saved_path = screenshot_path.as_posix()
194201
return result
195202
except Exception as exc:
203+
logger.error(f"Device operation failed: {exc}", exc_info=True)
196204
return DeviceActionResult(
197205
ok=False,
198206
message=f"截图保存时发生异常: {exc}",
@@ -224,6 +232,7 @@ def _connect_adb_item(self, action_id: str) -> DeviceActionResult:
224232
self._maa_facade.attach_session(session)
225233
return DeviceActionResult(ok=True, message=f"已连接 ADB 设备: {params.address}", overview=self.get_overview())
226234
except Exception as exc:
235+
logger.error(f"Device operation failed: {exc}", exc_info=True)
227236
return DeviceActionResult(ok=False, message=f"连接 ADB 设备失败: {exc}", severity="error", overview=self.get_overview())
228237

229238
def _connect_desktop_item(self, action_id: str) -> DeviceActionResult:
@@ -246,6 +255,7 @@ def _connect_desktop_item(self, action_id: str) -> DeviceActionResult:
246255
window_name = str(window.get("window_name") or handle or backend)
247256
return DeviceActionResult(ok=True, message=f"已连接{current_desktop_label()}: {window_name}", overview=self.get_overview())
248257
except Exception as exc:
258+
logger.error(f"Device operation failed: {exc}", exc_info=True)
249259
return DeviceActionResult(ok=False, message=f"连接本地窗口失败: {exc}", severity="error", overview=self.get_overview())
250260

251261
def _connect_emulator_item(self, action_id: str) -> DeviceActionResult:
@@ -271,6 +281,7 @@ def _connect_emulator_item(self, action_id: str) -> DeviceActionResult:
271281
self._maa_facade.attach_session(session)
272282
return DeviceActionResult(ok=True, message=f"已连接模拟器设备: {device.name}", overview=self.get_overview())
273283
except Exception as exc:
284+
logger.error(f"Device operation failed: {exc}", exc_info=True)
274285
return DeviceActionResult(ok=False, message=f"连接模拟器设备失败: {exc}", severity="error", overview=self.get_overview())
275286

276287
def _build_connection_state(self) -> DeviceConnectionState:
@@ -401,6 +412,7 @@ def _connect_browser_item(self, action_id: str) -> DeviceActionResult:
401412
self._maa_facade.attach_session(session)
402413
return DeviceActionResult(ok=True, message=f"已连接浏览器设备: {device.name}", overview=self.get_overview())
403414
except Exception as exc:
415+
logger.error(f"Device operation failed: {exc}", exc_info=True)
404416
return DeviceActionResult(ok=False, message=f"连接浏览器设备失败: {exc}", severity="error", overview=self.get_overview())
405417

406418
def _get_device_config(self) -> MaaDeviceConfig:

0 commit comments

Comments
 (0)