Skip to content

refactor(architecture): extract ProjectManager class from mainWindow #1379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

MustardBell
Copy link
Contributor

@MustardBell MustardBell commented Jul 29, 2025

Major architectural refactoring to improve code organization:

  • Extracted ProjectManager class from mainWindow.py (~300 lines)
    • Moved project lifecycle methods: loadProject, closeProject, saveDatas
    • Moved timer management: saveTimer, saveTimerNoChanges
    • Moved data management: loadEmptyDatas, loadDatas
    • Moved unsaved changes handling: handleUnsavedChanges
    • Updated all calling code to use projectManager interface

  • manuskript/projectManager.py - Project lifecycle management
  • manuskript/tests/test_projectManager.py - Basic ProjectManager tests (2 tests)
  • manuskript/tests/test_projectManager_timer.py - Comprehensive timer tests (9 tests)

  • manuskript/mainWindow.py - Removed ~300 lines, added projectManager integration
  • manuskript/ui/welcome.py - Updated to use projectManager interface
  • manuskript/settingsWindow.py - Updated timer access via projectManager
  • manuskript/tests/conftest.py - Updated test fixtures for new interface

  • Added 11 new unit tests total covering ProjectManager functionality
  • Comprehensive timer testing with proper Qt mocking
  • All existing tests continue to pass (50 total tests)
  • Tests validate both positive and negative scenarios

  • Reduced mainWindow.py complexity (2000+ -> 1700 lines)
  • Improved separation of concerns
  • Better testability with isolated components
  • Foundation for further architectural improvements

Major architectural refactoring to improve code organization:

- **Extracted ProjectManager class** from mainWindow.py (~300 lines)
  - Moved project lifecycle methods: loadProject, closeProject, saveDatas
  - Moved timer management: saveTimer, saveTimerNoChanges
  - Moved data management: loadEmptyDatas, loadDatas
  - Moved unsaved changes handling: handleUnsavedChanges
  - Updated all calling code to use projectManager interface

- `manuskript/projectManager.py` - Project lifecycle management
- `manuskript/tests/test_projectManager.py` - Basic ProjectManager tests (2 tests)
- `manuskript/tests/test_projectManager_timer.py` - Comprehensive timer tests (9 tests)

- `manuskript/mainWindow.py` - Removed ~300 lines, added projectManager integration
- `manuskript/ui/welcome.py` - Updated to use projectManager interface
- `manuskript/settingsWindow.py` - Updated timer access via projectManager
- `manuskript/tests/conftest.py` - Updated test fixtures for new interface

- Added 11 new unit tests total covering ProjectManager functionality
- Comprehensive timer testing with proper Qt mocking
- All existing tests continue to pass (50 total tests)
- Tests validate both positive and negative scenarios

- Reduced mainWindow.py complexity (2000+ -> 1700 lines)
- Improved separation of concerns
- Better testability with isolated components
- Foundation for further architectural improvements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant