refactor: 优化代码格式,提升可读性
This commit is contained in:
1 parent
d36b73d3df
commit
ea77c0b501
4 files changed
+71
-31
No files matched your search
@@ -797,7 +797,9 @@ class underlying_operations:
|
||||
# 优先走 exec-out:只需 1 次 adb 调用;不在手机端落盘,减少 I/O 与卡顿
|
||||
# 为避免被并发读取到"半写入文件",写入 tmp 后再原子替换。
|
||||
execout_timeout_sec = float(os.environ.get("ADB_EXECOUT_TIMEOUT_SEC", "10"))
|
||||
execout_warn_after_sec = float(os.environ.get("ADB_EXECOUT_WARN_AFTER_SEC", "3"))
|
||||
execout_warn_after_sec = float(
|
||||
os.environ.get("ADB_EXECOUT_WARN_AFTER_SEC", "3")
|
||||
)
|
||||
execout_heartbeat_interval_sec = float(
|
||||
os.environ.get("ADB_EXECOUT_HEARTBEAT_INTERVAL_SEC", "5")
|
||||
)
|
||||
@@ -3098,14 +3100,18 @@ class underlying_operations:
|
||||
# 先确保输入框获得焦点
|
||||
try:
|
||||
try:
|
||||
print(f"[Underlying] paste_text_at: clicking to focus device_id={device_id} coord=({x},{y})")
|
||||
print(
|
||||
f"[Underlying] paste_text_at: clicking to focus device_id={device_id} coord=({x},{y})"
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
self.click(device_id, int(x), int(y))
|
||||
time_module.sleep(0.2)
|
||||
# 有些输入框第一次点不进,补一次轻点
|
||||
try:
|
||||
print(f"[Underlying] paste_text_at: clicking again to ensure focus device_id={device_id} coord=({x},{y})")
|
||||
print(
|
||||
f"[Underlying] paste_text_at: clicking again to ensure focus device_id={device_id} coord=({x},{y})"
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
self.click(device_id, int(x), int(y))
|
||||
@@ -3118,11 +3124,15 @@ class underlying_operations:
|
||||
try:
|
||||
ok_adbkb = False
|
||||
try:
|
||||
ok_adbkb = bool(self.input_text_adbkeyboard(device_id, t, restore_prev=False))
|
||||
ok_adbkb = bool(
|
||||
self.input_text_adbkeyboard(device_id, t, restore_prev=False)
|
||||
)
|
||||
except Exception:
|
||||
ok_adbkb = False
|
||||
try:
|
||||
print(f"[Underlying] paste_text_at: input_text_adbkeyboard -> {ok_adbkb}")
|
||||
print(
|
||||
f"[Underlying] paste_text_at: input_text_adbkeyboard -> {ok_adbkb}"
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
if ok_adbkb:
|
||||
@@ -3157,7 +3167,9 @@ class underlying_operations:
|
||||
|
||||
# 2) 兜底:adb input text(中文可能不稳定)
|
||||
try:
|
||||
print(f"[Underlying] paste_text_at: falling back to input_text for device_id={device_id}")
|
||||
print(
|
||||
f"[Underlying] paste_text_at: falling back to input_text for device_id={device_id}"
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return self.input_text(device_id, t)
|
||||
|
||||
Reference in new issue
Block a user