Skip to content

Decompose main_window.py into workflow and UI orchestration modules #21

Description

@dasarne

Parent issue: #17

Goal

Refactor src/ui/main_window.py into smaller orchestration-focused modules while preserving all application workflows and UI behavior.

Current Problems

The file currently combines:

  • menu construction
  • actions
  • dialogs
  • file workflows
  • status handling
  • editor/canvas orchestration
  • settings integration
  • warning handling
  • localization updates
  • navigation glue logic

This results in:

  • very large change surfaces
  • difficult navigation
  • difficult testing
  • hidden coupling
  • difficult typing and maintenance

Proposed Target Structure

src/ui/mainwindow/

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

Architectural Goals

  • Keep orchestration responsibilities explicit
  • Avoid hidden cross-module coupling
  • Keep business logic outside the main window
  • Improve readability and testability
  • Reduce merge conflicts for future work

Suggested Extraction Order

  1. Status bar handling
  2. Menu creation
  3. QAction setup
  4. Dialog management
  5. File workflows
  6. Final orchestration cleanup

Requirements

  • Preserve all shortcuts
  • Preserve workflow behavior
  • Preserve editor/canvas synchronization
  • Preserve localization behavior
  • Keep tests green throughout migration

Acceptance Criteria

  • main_window.py reduced substantially
  • Responsibilities clearly separated
  • Existing workflows preserved
  • Existing tests still pass
  • Reduced coupling and easier future maintenance

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