diff --git a/lc_mcp/aalc_patches.py b/lc_mcp/aalc_patches.py index c516eb5..8d94c1f 100644 --- a/lc_mcp/aalc_patches.py +++ b/lc_mcp/aalc_patches.py @@ -1953,6 +1953,10 @@ def install_theme_pack_systems(log=print, env=None, route=None, route_name='路 except Exception as e: log('[lc_mcp] 卡包按体系加分跳过: 无法导入 %s' % e) return None + try: + from module.automation import auto + except Exception: + auto = None # 单测没有 automation 模块: 只少「拖拽没确认再拖一次」的兜底 original = getattr(mirror_mod, 'select_theme_pack', None) theme_list = getattr(theme_pack_mod, 'theme_list', None) try: @@ -1995,7 +1999,29 @@ def install_theme_pack_systems(log=print, env=None, route=None, route_name='路 THEME_PACK_BOOSTED.update(info) return result - with _override(theme_list, 'get_effective_theme_pack_list', get_effective_theme_pack_list): + # 2026-11-22: 5 层选卡包卡了 40 分钟。上游用 mouse_drag_down(pack) 把卡包"拉下来"确认, + # 卡包模板的匹配点常落在放大镜上, 从那里往下拖不生效; 拖完还停在选包页就下移 80px 再拖一次。 + real_drag = getattr(auto, 'mouse_drag_down', None) if auto is not None else None + + def mouse_drag_down(x, y, *a, **kw): + if real_drag is None: + return None + real_drag(x, y, *a, **kw) + try: + still = auto.find_element(THEME_PACK_REFRESH, take_screenshot=True) + except Exception: + still = None + if still: + log('[lc_mcp] 卡包拖拽没确认, 下移 80px 再拖一次 (%d,%d)' % (x, y + 80)) + decisions.record('theme_pack', None, 'drag_retry', pos=[int(x), int(y)]) + real_drag(x, y + 80, *a, **kw) + return None + + if auto is None: + with _override(theme_list, 'get_effective_theme_pack_list', get_effective_theme_pack_list): + return original(*args, **kwargs) + with _override(theme_list, 'get_effective_theme_pack_list', get_effective_theme_pack_list), \ + _override(auto, 'mouse_drag_down', mouse_drag_down): return original(*args, **kwargs) select_theme_pack.__wrapped__ = original