Refactor import statements for douyin_screenshot_manager to use dynamic loading

- Updated multiple files to replace static imports of `douyin_screenshot_manager` with dynamic imports using `importlib`. This change enhances flexibility and prevents import errors when the module is unavailable.
- Added fallback mechanisms in `fudai_core.py` to ensure the application continues to function even if certain dependencies are missing, improving robustness.
- Adjusted error handling to provide clearer feedback during initialization failures, particularly for OCR-related components.
This commit is contained in:
Your Name committed 2026-01-01 19:42:03 +08:00
1 parent c7b5d6be0f
commit 148cdf56c2
13 files changed
+192 -275

No files matched your search

+4 -2
View File
@@ -1041,7 +1041,8 @@ def main():
ttk.Label(debug_counts_frame, textvariable=debug_async_failure_var, foreground="red").pack(side=LEFT, padx=(4, 8))
def on_reset_async_counters():
try:
from douyin.handlers import douyin_screenshot_manager
import importlib
douyin_screenshot_manager = importlib.import_module("douyin.handlers.douyin_screenshot_manager")
douyin_screenshot_manager.reset_async_save_counters()
debug_async_success_var.set(0)
debug_async_failure_var.set(0)
@@ -1052,7 +1053,8 @@ def main():
# 周期性更新计数器(2秒)
def _update_async_counters():
try:
from douyin.handlers import douyin_screenshot_manager
import importlib
douyin_screenshot_manager = importlib.import_module("douyin.handlers.douyin_screenshot_manager")
s, f = douyin_screenshot_manager.get_async_save_counters()
debug_async_success_var.set(s)
debug_async_failure_var.set(f)