__init__.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. """
  2. 表格线编辑器核心模块
  3. """
  4. import sys
  5. from pathlib import Path
  6. # ✅ 确保父目录在路径中
  7. _parent_dir = Path(__file__).parent.parent
  8. if str(_parent_dir) not in sys.path:
  9. sys.path.insert(0, str(_parent_dir))
  10. # 文件处理
  11. from .file_handlers import create_file_uploader_section
  12. # 显示控件
  13. from .display_controls import (
  14. create_display_settings_section,
  15. create_undo_redo_section,
  16. )
  17. # 分析控件
  18. from .analysis_controls import create_analysis_section
  19. # 保存控件
  20. from .save_controls import create_save_section
  21. # 🆕 批量模板控件
  22. from .batch_template_controls import create_batch_template_section
  23. # 模式设置
  24. from .mode_setup import (
  25. setup_new_annotation_mode,
  26. setup_edit_annotation_mode,
  27. )
  28. # 目录选择器
  29. from .directory_selector import create_directory_selector
  30. # 表格视图
  31. from .table_viewer import render_table_structure_view
  32. # 绘图
  33. from .drawing import (
  34. draw_table_lines_with_numbers,
  35. draw_clean_table_lines,
  36. get_cached_table_lines_image,
  37. clear_table_image_cache,
  38. )
  39. # 状态管理
  40. from .state_manager import (
  41. init_undo_stack,
  42. save_state_for_undo,
  43. undo_last_action,
  44. redo_last_action,
  45. )
  46. # 调整
  47. from .adjustments import create_adjustment_section
  48. # 配置加载
  49. from .config_loader import (
  50. load_structure_from_config,
  51. load_table_editor_config,
  52. parse_table_editor_cli_args,
  53. build_data_source_catalog,
  54. )
  55. # 数据处理
  56. from .data_processor import get_structure_from_ocr
  57. # 图片查看器
  58. from .viewer import show_image_with_scroll
  59. __all__ = [
  60. # 文件处理
  61. 'create_file_uploader_section',
  62. # 显示控件
  63. 'create_display_settings_section',
  64. 'create_undo_redo_section',
  65. # 分析控件
  66. 'create_analysis_section',
  67. # 保存控件
  68. 'create_save_section',
  69. # 🆕 批量模板控件
  70. 'create_batch_template_section',
  71. # 模式设置
  72. 'setup_new_annotation_mode',
  73. 'setup_edit_annotation_mode',
  74. # 目录选择器
  75. 'create_directory_selector',
  76. # 表格视图
  77. 'render_table_structure_view',
  78. # 绘图
  79. 'draw_table_lines_with_numbers',
  80. 'draw_clean_table_lines',
  81. 'get_cached_table_lines_image',
  82. 'clear_table_image_cache',
  83. # 状态管理
  84. 'init_undo_stack',
  85. 'save_state_for_undo',
  86. 'undo_last_action',
  87. 'redo_last_action',
  88. # 调整
  89. 'create_adjustment_section',
  90. # 配置加载
  91. 'load_structure_from_config',
  92. 'load_table_editor_config',
  93. 'parse_table_editor_cli_args',
  94. 'build_data_source_catalog',
  95. # 数据处理
  96. 'get_structure_from_ocr',
  97. # 图片查看器
  98. 'show_image_with_scroll',
  99. ]