Skip to content

Refactor oversized UI modules into maintainable submodule structure #17

Description

@dasarne

Background

The following UI modules have grown significantly and now contain multiple responsibilities:

  • src/ui/editor_panel.py
  • src/ui/canvas_panel.py
  • src/ui/main_window.py

This already conflicts with the architectural guidance documented in AGENTS.md:

  • separation of concerns
  • reusable services
  • maintainable UI structure
  • rendering isolation
  • testability

Goals

Refactor the UI architecture into smaller focused modules while preserving all existing functionality and UX behavior.

Proposed Structure

Editor

src/ui/editor/

  • editor_widget.py
  • editor_selection.py
  • editor_highlighting.py
  • editor_comments.py
  • editor_undo.py
  • editor_search.py

Canvas

src/ui/canvas/

  • canvas_widget.py
  • canvas_rendering.py
  • canvas_selection.py
  • canvas_navigation.py
  • canvas_layers.py
  • canvas_cache.py

Main Window

src/ui/mainwindow/

  • main_window.py
  • menus.py
  • actions.py
  • statusbar.py
  • file_workflows.py
  • dialog_management.py

Requirements

  • Preserve all existing UX behavior
  • Preserve editor responsiveness
  • Preserve rendering performance
  • Avoid unnecessary reparsing or allocations
  • Keep rendering logic isolated from application logic
  • Avoid introducing hidden global state
  • Keep tests green during the migration
  • Refactor incrementally in reviewable steps

Acceptance Criteria

  • Large monolithic UI files reduced substantially
  • Responsibilities clearly separated
  • Existing tests still pass
  • No UX regressions
  • Easier navigation and maintainability
  • Foundation prepared for stricter typing and future UI tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions