pyqt_reactive.core.path_cache

Unified Path Cache System

Provides shared path caching functionality for both TUI and PyQt GUI implementations. Persists last used paths across application runs for improved user experience.

Functions

cache_browser_path(key, path)

Backward compatibility alias for TUI code.

cache_dialog_path(key, path)

Backward compatibility alias for PyQt code.

cache_path(key, path)

Convenience function to cache a path.

get_cached_browser_path(key[, fallback])

Backward compatibility alias for TUI code.

get_cached_dialog_path(key[, fallback])

Backward compatibility alias for PyQt code.

get_cached_path(key)

Convenience function to get cached path.

get_initial_path(key[, fallback])

Convenience function to get initial path with fallback.

get_path_cache()

Get global path cache instance.

Classes

PathCacheKey(*values)

Enumeration of path cache keys for different UI contexts.

UnifiedPathCache([cache_file])

Unified path cache for persisting directory paths across application sessions.

class pyqt_reactive.core.path_cache.PathCacheKey(*values)[source]

Enumeration of path cache keys for different UI contexts.

Used to maintain separate cached paths for different file operations across both TUI and PyQt GUI implementations.

FILE_SELECTION = 'file_selection'
DIRECTORY_SELECTION = 'directory_selection'
PLATE_IMPORT = 'plate_import'
CONFIG_EXPORT = 'config_export'
GENERAL = 'general'
FUNCTION_PATTERNS = 'function_patterns'
PIPELINE_FILES = 'pipeline_files'
STEP_SETTINGS = 'step_settings'
DEBUG_FILES = 'debug_files'
CODE_EDITOR = 'code_editor'
PLATE_BROWSER = 'plate_browser'
FUNCTION_BROWSER = 'function_browser'
PIPELINE_BROWSER = 'pipeline_browser'
EXPORT_BROWSER = 'export_browser'
CONFIG_BROWSER = 'config_browser'
ANALYSIS_BROWSER = 'analysis_browser'
class pyqt_reactive.core.path_cache.UnifiedPathCache(cache_file: Path | None = None)[source]

Unified path cache for persisting directory paths across application sessions.

Provides consistent caching behavior for both TUI browser widgets and PyQt GUI file dialogs.

__init__(cache_file: Path | None = None)[source]

Initialize path cache.

Parameters:

cache_file – Optional custom cache file location

get_cached_path(key: PathCacheKey) Path | None[source]

Get cached path for a specific key.

Parameters:

key – PathCacheKey identifying the context

Returns:

Cached Path if exists and valid, None otherwise

set_cached_path(key: PathCacheKey, path: Path) None[source]

Set cached path for a specific key.

Parameters:
  • key – PathCacheKey identifying the context

  • path – Path to cache

get_initial_path(key: PathCacheKey, fallback: Path | None = None) Path[source]

Get initial path with intelligent fallback hierarchy.

Parameters:
  • key – PathCacheKey identifying the context

  • fallback – Optional fallback path if cached path unavailable

Returns:

Best available path (cached > fallback > home directory)

clear_cache() None[source]

Clear all cached paths.

remove_cached_path(key: PathCacheKey) None[source]

Remove specific cached path.

Parameters:

key – PathCacheKey to remove

pyqt_reactive.core.path_cache.get_path_cache() UnifiedPathCache[source]

Get global path cache instance.

pyqt_reactive.core.path_cache.cache_path(key: PathCacheKey, path: Path) None[source]

Convenience function to cache a path.

Parameters:
  • key – PathCacheKey identifying the context

  • path – Path to cache

pyqt_reactive.core.path_cache.get_cached_path(key: PathCacheKey) Path | None[source]

Convenience function to get cached path.

Parameters:

key – PathCacheKey identifying the context

Returns:

Cached Path if exists and valid, None otherwise

pyqt_reactive.core.path_cache.get_initial_path(key: PathCacheKey, fallback: Path | None = None) Path[source]

Convenience function to get initial path with fallback.

Parameters:
  • key – PathCacheKey identifying the context

  • fallback – Optional fallback path

Returns:

Best available path (cached > fallback > home directory)

pyqt_reactive.core.path_cache.cache_browser_path(key: PathCacheKey, path: Path) None[source]

Backward compatibility alias for TUI code.

pyqt_reactive.core.path_cache.cache_dialog_path(key: PathCacheKey, path: Path) None[source]

Backward compatibility alias for PyQt code.

pyqt_reactive.core.path_cache.get_cached_browser_path(key: PathCacheKey, fallback: Path | None = None) Path[source]

Backward compatibility alias for TUI code.

pyqt_reactive.core.path_cache.get_cached_dialog_path(key: PathCacheKey, fallback: Path | None = None) Path[source]

Backward compatibility alias for PyQt code.