refactor: 优化代码格式,提升可读性

This commit is contained in:
Your Name committed 2026-01-15 01:52:00 +08:00
1 parent a84836a6c7
commit 3fa03b780b
5 files changed
+146 -45

No files matched your search

+10 -3
View File
@@ -2731,10 +2731,17 @@ class underlying_operations:
raise PermissionError("sendevent 需要 root 权限且实现复杂,暂不支持完整实现")
def click(self, device_id, x=500, y=500):
"""点击坐标位置"""
def click(self, device_id, x=500, y=500, log: bool = True):
"""点击坐标位置
参数:
device_id: 设备ID
x, y: 屏幕坐标
log: 是否打印底层日志(默认为 True)。在需要安静点击的场景(如养号)传 False。
"""
try:
print(f"[Underlying] click: device_id={device_id} coord=({x},{y})")
if log:
print(f"[Underlying] click: device_id={device_id} coord=({x},{y})")
except Exception:
pass
os.system("{} -s {} shell input tap {} {}".format(self._adb(), device_id, x, y))