Skip to content

recent_projects

Manages the recent-projects card list on the startup page. Provides persistent tracking of recently opened projects (max 5) and quick-access actions (write, read, open launcher).

Structure

recent_projects/
    controller/
        recent_projects_controller.py     RecentProjectsController - card list and actions
        recent_projects_manager.py        RecentProjectsManager - JSON persistence (static)
    view/
        project_card.py                   ProjectCard - card widget with action buttons

Usage

from src.modules.plant_design.startup_system.bound_subsystems.recent_projects.controller.recent_projects_controller import (
    RecentProjectsController,
)

recent = RecentProjectsController(main_stack, app_state)

# Display recent project cards on startup page
recent.load_recent_projects()

Persistence API (static)

from src.modules.plant_design.startup_system.bound_subsystems.recent_projects.controller.recent_projects_manager import (
    RecentProjectsManager,
)

# Track a project
RecentProjectsManager.add_recent_project("Kraftwerk_1234567")

# Get ordered list (most recent first, max 5)
project_ids = RecentProjectsManager.get_recent_projects()

# Query
count = RecentProjectsManager.get_recent_count()
has_any = RecentProjectsManager.has_recent_projects()

# Remove / clear
RecentProjectsManager.remove_recent_project("Kraftwerk_1234567")
RecentProjectsManager.clear_recent_projects()

Key Classes

RecentProjectsController

Manages the recent-projects card list. Uses ProjectRepository for metadata display and PlantDesignSession (lazy-initialized) for write-access. Card actions: write (with request dialog), read (metadata only, currently hidden), launcher (delegates via signal). Handles full PD lifecycle including return cleanup after session close.

RecentProjectsManager

All-static class for JSON persistence of recent project IDs. Stores up to 5 projects ordered by recency with auto-deduplication. Uses the PathDef system (RecentProjectsPaths.JsonFile) for file location.

ProjectCard

Card widget displaying a project ID label with write, read, and launcher action buttons. Read and launcher buttons are currently hidden/disabled.

Signals

Signal Source Args Description
request_open_launcher RecentProjectsController - User wants to open the full launcher view

Dependencies

  • src.modules.plant_design.startup_system.bound_subsystems.project_repository - ProjectRepository for metadata
  • src.modules.plant_design.startup_system.bound_subsystems.pd_session_orchestration - PlantDesignSession for write-access
  • src.modules.plant_design.pd_runtime_system - PDMainController (launched on project open)
  • src.shared_services.path_management - PathDef-based path resolution
  • src.modules.plant_design.startup_system.constants.paths - RecentProjectsPaths