comiccatcher 0.1.0a2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. comiccatcher-0.1.0a2/DESIGN.md +462 -0
  2. comiccatcher-0.1.0a2/LICENSE +201 -0
  3. comiccatcher-0.1.0a2/PKG-INFO +484 -0
  4. comiccatcher-0.1.0a2/pyproject.toml +41 -0
  5. comiccatcher-0.1.0a2/setup.cfg +4 -0
  6. comiccatcher-0.1.0a2/src/comiccatcher/__init__.py +38 -0
  7. comiccatcher-0.1.0a2/src/comiccatcher/_build_info.py +2 -0
  8. comiccatcher-0.1.0a2/src/comiccatcher/api/__init__.py +0 -0
  9. comiccatcher-0.1.0a2/src/comiccatcher/api/client.py +73 -0
  10. comiccatcher-0.1.0a2/src/comiccatcher/api/download_manager.py +295 -0
  11. comiccatcher-0.1.0a2/src/comiccatcher/api/feed_reconciler.py +596 -0
  12. comiccatcher-0.1.0a2/src/comiccatcher/api/image_manager.py +178 -0
  13. comiccatcher-0.1.0a2/src/comiccatcher/api/library_scanner.py +120 -0
  14. comiccatcher-0.1.0a2/src/comiccatcher/api/local_db.py +323 -0
  15. comiccatcher-0.1.0a2/src/comiccatcher/api/opds_v2.py +133 -0
  16. comiccatcher-0.1.0a2/src/comiccatcher/api/progression.py +94 -0
  17. comiccatcher-0.1.0a2/src/comiccatcher/config.py +313 -0
  18. comiccatcher-0.1.0a2/src/comiccatcher/logger.py +44 -0
  19. comiccatcher-0.1.0a2/src/comiccatcher/main.py +198 -0
  20. comiccatcher-0.1.0a2/src/comiccatcher/models/__init__.py +0 -0
  21. comiccatcher-0.1.0a2/src/comiccatcher/models/feed.py +20 -0
  22. comiccatcher-0.1.0a2/src/comiccatcher/models/feed_page.py +134 -0
  23. comiccatcher-0.1.0a2/src/comiccatcher/models/opds.py +186 -0
  24. comiccatcher-0.1.0a2/src/comiccatcher/models/opds_auth.py +19 -0
  25. comiccatcher-0.1.0a2/src/comiccatcher/resources/app.png +0 -0
  26. comiccatcher-0.1.0a2/src/comiccatcher/resources/app_128.png +0 -0
  27. comiccatcher-0.1.0a2/src/comiccatcher/resources/app_256.png +0 -0
  28. comiccatcher-0.1.0a2/src/comiccatcher/resources/app_32.png +0 -0
  29. comiccatcher-0.1.0a2/src/comiccatcher/resources/app_64.png +0 -0
  30. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/action_delete.svg +6 -0
  31. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/action_read.svg +4 -0
  32. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/action_unread.svg +3 -0
  33. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/back.svg +1 -0
  34. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/book.svg +1 -0
  35. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/chevron_down.svg +3 -0
  36. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/chevron_left.svg +3 -0
  37. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/chevron_right.svg +3 -0
  38. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/chevrons_left.svg +4 -0
  39. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/chevrons_right.svg +4 -0
  40. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/close.svg +1 -0
  41. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/download.svg +1 -0
  42. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/eye.svg +4 -0
  43. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/feeds.svg +1 -0
  44. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/filter.svg +3 -0
  45. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/focus_series.svg +1 -0
  46. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/focus_title.svg +1 -0
  47. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/folder.svg +1 -0
  48. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/fullscreen.svg +1 -0
  49. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/globe.svg +1 -0
  50. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/group_by.svg +11 -0
  51. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/group_misc.svg +1 -0
  52. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/home.svg +1 -0
  53. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/label.svg +1 -0
  54. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/library.svg +7 -0
  55. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/minimize.svg +1 -0
  56. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/paging.svg +4 -0
  57. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/plus.svg +4 -0
  58. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/refresh.svg +1 -0
  59. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/scrolling.svg +5 -0
  60. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/search.svg +1 -0
  61. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/select.svg +4 -0
  62. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/settings.svg +11 -0
  63. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/sort_added.svg +1 -0
  64. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/sort_alpha.svg +1 -0
  65. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/sort_asc.svg +1 -0
  66. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/sort_date.svg +1 -0
  67. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/sort_desc.svg +1 -0
  68. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/view_file.svg +1 -0
  69. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/view_grid.svg +1 -0
  70. comiccatcher-0.1.0a2/src/comiccatcher/resources/icons/view_group.svg +11 -0
  71. comiccatcher-0.1.0a2/src/comiccatcher/ui/__init__.py +0 -0
  72. comiccatcher-0.1.0a2/src/comiccatcher/ui/app_layout.py +1451 -0
  73. comiccatcher-0.1.0a2/src/comiccatcher/ui/base_reader.py +1749 -0
  74. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/__init__.py +0 -0
  75. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/auth_dialog.py +121 -0
  76. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/base_card_delegate.py +372 -0
  77. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/base_ribbon.py +111 -0
  78. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/collapsible_section.py +137 -0
  79. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/feed_browser_model.py +279 -0
  80. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/feed_card_delegate.py +124 -0
  81. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/library_card_delegate.py +67 -0
  82. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/loading_spinner.py +62 -0
  83. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/mini_detail_popover.py +516 -0
  84. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/paging_control.py +129 -0
  85. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/popover_mixin.py +87 -0
  86. comiccatcher-0.1.0a2/src/comiccatcher/ui/components/section_header.py +89 -0
  87. comiccatcher-0.1.0a2/src/comiccatcher/ui/debug_overlay.py +157 -0
  88. comiccatcher-0.1.0a2/src/comiccatcher/ui/flow_layout.py +97 -0
  89. comiccatcher-0.1.0a2/src/comiccatcher/ui/image_data.py +43 -0
  90. comiccatcher-0.1.0a2/src/comiccatcher/ui/image_utils.py +75 -0
  91. comiccatcher-0.1.0a2/src/comiccatcher/ui/local_archive.py +68 -0
  92. comiccatcher-0.1.0a2/src/comiccatcher/ui/local_comicbox.py +273 -0
  93. comiccatcher-0.1.0a2/src/comiccatcher/ui/reader_logic.py +140 -0
  94. comiccatcher-0.1.0a2/src/comiccatcher/ui/theme_manager.py +1164 -0
  95. comiccatcher-0.1.0a2/src/comiccatcher/ui/utils.py +75 -0
  96. comiccatcher-0.1.0a2/src/comiccatcher/ui/view_helpers.py +126 -0
  97. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/__init__.py +0 -0
  98. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/base_browser.py +303 -0
  99. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/base_detail.py +397 -0
  100. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/base_feed_subview.py +192 -0
  101. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/downloads.py +230 -0
  102. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/feed_browser.py +1003 -0
  103. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/feed_detail.py +782 -0
  104. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/feed_list.py +182 -0
  105. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/feed_management.py +579 -0
  106. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/feed_reader.py +207 -0
  107. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/local_detail.py +294 -0
  108. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/local_library.py +1621 -0
  109. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/local_reader.py +204 -0
  110. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/paged_feed_view.py +290 -0
  111. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/scrolled_feed_view.py +903 -0
  112. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/search_root.py +200 -0
  113. comiccatcher-0.1.0a2/src/comiccatcher/ui/views/settings.py +261 -0
  114. comiccatcher-0.1.0a2/src/comiccatcher.egg-info/PKG-INFO +484 -0
  115. comiccatcher-0.1.0a2/src/comiccatcher.egg-info/SOURCES.txt +119 -0
  116. comiccatcher-0.1.0a2/src/comiccatcher.egg-info/dependency_links.txt +1 -0
  117. comiccatcher-0.1.0a2/src/comiccatcher.egg-info/entry_points.txt +2 -0
  118. comiccatcher-0.1.0a2/src/comiccatcher.egg-info/requires.txt +9 -0
  119. comiccatcher-0.1.0a2/src/comiccatcher.egg-info/top_level.txt +1 -0
  120. comiccatcher-0.1.0a2/tests/test_library_view.py +91 -0
  121. comiccatcher-0.1.0a2/tests/test_opds_auth_discovery.py +60 -0
@@ -0,0 +1,462 @@
1
+ # ComicCatcher — Design Document
2
+
3
+ **Status:** Active Development / Beta
4
+ **Framework:** Python 3.10+ · PyQt6 · qasync
5
+ **Objective:** A high-performance native desktop OPDS 2.0 comic reader optimised for self-hosted servers (Codex, Komga, Stump) with an integrated local library browser.
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ 1. [Architecture Overview](#1-architecture-overview)
12
+ 2. [Project Structure](#2-project-structure)
13
+ 3. [Entry Point & Startup](#3-entry-point--startup)
14
+ 4. [Configuration](#4-configuration)
15
+ 5. [Data Models](#5-data-models)
16
+ 6. [API Layer](#6-api-layer)
17
+ 7. [Local Library System](#7-local-library-system)
18
+ 8. [UI Architecture](#8-ui-architecture)
19
+ 9. [Views Reference](#9-views-reference)
20
+ 10. [Base Components](#10-base-components)
21
+ 11. [Theme System](#11-theme-system)
22
+ 12. [Multi-Select & Selection Mode](#12-multi-select--selection-mode)
23
+ 13. [Context Menus](#13-context-menus)
24
+ 14. [Threading & Concurrency](#14-threading--concurrency)
25
+ 15. [Caching Strategy](#15-caching-strategy)
26
+ 16. [Data Flows](#16-data-flows)
27
+ 17. [Navigation & History](#17-navigation--history)
28
+ 18. [Testing](#18-testing)
29
+ 19. [Known Issues & Future Enhancements](#19-known-issues--future-enhancements)
30
+
31
+ ---
32
+
33
+ ## 1. Architecture Overview
34
+
35
+ ComicCatcher is a native desktop application built with **PyQt6**, using **qasync** to integrate Qt's event loop with Python's `asyncio`. All network I/O is non-blocking via `httpx`; blocking work (comicbox metadata extraction, ZIP file reading, disk I/O) is offloaded to threads via `asyncio.to_thread`.
36
+
37
+ ```
38
+ ┌──────────────────────────────────────────────────────────────────┐
39
+ │ Qt Event Loop (qasync) │
40
+ │ │
41
+ │ ┌─────────────┐ ┌─────────────────────────────────────────┐ │
42
+ │ │ Sidebar │ │ Stacked Content Views (9 indices) │ │
43
+ │ │ - Feeds │ │ FeedList / Browser / FeedDetail / ... │ │
44
+ │ │ - Library │ │ LocalLibrary / LocalDetail / ... │ │
45
+ │ │ - Settings │ │ Settings / SearchRoot / ... │ │
46
+ │ └─────────────┘ └─────────────────────────────────────────┘ │
47
+ │ │
48
+ │ ┌──────────────────────────────────────────────────────────┐ │
49
+ │ │ API Layer (async) │ │
50
+ │ │ APIClient → OPDS2Client → FeedReconciler → ImageMgr │ │
51
+ │ └──────────────────────────────────────────────────────────┘ │
52
+ │ │
53
+ │ ┌──────────────────────────────────────────────────────────┐ │
54
+ │ │ Local Library (thread pool) │ │
55
+ │ │ LibraryScanner → LocalLibraryDB (SQLite) → comicbox │ │
56
+ │ └──────────────────────────────────────────────────────────┘ │
57
+ └──────────────────────────────────────────────────────────────────┘
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 2. Project Structure
63
+
64
+ ```
65
+ main.py Entry point, QApplication + qasync loop, GNOME desktop entry
66
+ config.py Persistent config (feeds, settings, paths, device_id)
67
+ logger.py Dual-output logging (console + rotating file)
68
+ pdffile.py Shared PDF helper (MuPDF backend)
69
+
70
+ api/
71
+ client.py httpx.AsyncClient with Bearer / Basic auth
72
+ opds_v2.py OPDS 2.0 feed parser + in-memory JSON cache
73
+ feed_reconciler.py Transforms raw OPDS feeds into unified FeedPage models
74
+ image_manager.py 3-tier image cache: memory → disk (SHA256) → network
75
+ download_manager.py Background CBZ streamer with progress & cancellation
76
+ library_scanner.py Async local directory scanner with comicbox integration
77
+ local_db.py SQLite library database (metadata, progress, grouping)
78
+ progression.py Readium Locator read-position sync with OPDS servers
79
+
80
+ models/
81
+ feed.py FeedProfile (id, name, url, credentials, search history)
82
+ opds.py OPDSFeed, Publication, Group, Link, Metadata (Pydantic v2)
83
+ feed_page.py Unified FeedPage, FeedSection, and FeedItem models
84
+ opds_auth.py OPDS Authentication document models
85
+
86
+ ui/
87
+ app_layout.py MainWindow: sidebar, stacked views, tabbed history, breadcrumbs
88
+ theme_manager.py Theme tokens, SVG icon colorisation, global stylesheet generation
89
+ base_reader.py Shared reader widget (fit modes, overlays, spread layout)
90
+ debug_overlay.py Real-time layout and performance diagnostic overlay
91
+ flow_layout.py Wrapping QLayout for breadcrumb chips
92
+ image_data.py Image encoding utilities and MIME helpers
93
+ image_utils.py Async pixmap loading and scaling helpers
94
+ local_archive.py CBZ (ZIP) introspection and page extraction
95
+ local_comicbox.py comicbox wrapper: metadata extraction and flattening
96
+ reader_logic.py I/O-free reader state machine (fully unit tested)
97
+ utils.py Formatting and date parsing utilities
98
+ view_helpers.py Viewport visibility and async cover fetch helpers
99
+
100
+ components/ Reusable UI building blocks
101
+ auth_dialog.py OAuth2 / Basic Auth credential entry dialog
102
+ base_card_delegate.py Base class for card rendering (paints titles, frames)
103
+ feed_card_delegate.py OPDS-specific card rendering with badge support
104
+ library_card_delegate.py Local-specific card rendering with progress bars
105
+ base_ribbon.py Horizontal carousel for RIBBON sections
106
+ collapsible_section.py Expandable section container with header
107
+ feed_browser_model.py Virtualized QAbstractListModel for grid data
108
+ mini_detail_popover.py Bubble-style metadata summary popover
109
+ paging_control.py Pagination controls for paged views
110
+ popover_mixin.py Mixin for standardized popup/popover positioning
111
+ section_header.py Themed header for feed sections
112
+ loading_spinner.py Indeterminate async progress indicator
113
+
114
+ views/
115
+ feed_list.py Feed selection root view
116
+ feed_management.py Add / edit / delete feeds with connection testing
117
+ feed_browser.py FeedBrowser coordinator (switches between paged/scrolled)
118
+ base_browser.py Standardized header/status/selection logic for browsers
119
+ base_detail.py Shared metadata and action layout for detail views
120
+ base_feed_subview.py Shared base for PagedFeedView and ScrolledFeedView
121
+ paged_feed_view.py Dashboard layout: CollapsibleSections in QScrollArea
122
+ scrolled_feed_view.py Virtual scroll view: section-level QAbstractScrollArea
123
+ feed_detail.py Online publication detail view (metadata, cover, Read/Download)
124
+ feed_reader.py OPDS streaming reader (extends BaseReaderView)
125
+ local_library.py Local library browser with thumbnails and grouping
126
+ local_detail.py Local comic detail / metadata / open to read
127
+ local_reader.py Offline CBZ reader (extends BaseReaderView)
128
+ downloads.py Download progress popover
129
+ search_root.py Search history + pinned search interface
130
+ settings.py App settings (theme, scroll mode, library dir, feeds)
131
+
132
+ resources/
133
+ app.png Application icon
134
+ icons/ Expanded SVG icon set (40+ actions and navigational symbols)
135
+
136
+ tests/
137
+ test_reader_logic_unit.py ReaderSession state machine + fuzz (5 000 ops)
138
+ test_viewport_paging_logic.py ReFit virtual-page maths
139
+ test_download_filename.py Content-Disposition parsing + double-encoding
140
+ test_reader_integration_manifest.py Full manifest parsing
141
+ test_local_archive_cbz.py CBZ extraction
142
+ test_local_comicbox_flatten.py comicbox metadata flattening
143
+ test_config_library_dir.py Cross-platform path resolution
144
+
145
+ ui_flet_archive/ Archived legacy Flet implementation (reference only)
146
+ scripts/ Developer diagnostics and E2E helpers
147
+ DESIGN.md This document
148
+ requirements.txt Production dependencies
149
+ requirements-dev.txt Development dependencies
150
+ pytest.ini pytest config (asyncio_mode = auto)
151
+ ```
152
+
153
+ ---
154
+
155
+ ## 3. Entry Point & Startup
156
+
157
+ **`main.py`** contains the application entry point, setting up the `qasync` event loop and managing the application lifecycle.
158
+
159
+ ---
160
+
161
+ ## 4. Configuration
162
+
163
+ **`ConfigManager`** stores all persistent state in platform-appropriate locations.
164
+
165
+ ---
166
+
167
+ ## 5. Data Models
168
+
169
+ All models use **Pydantic v2** with `model_config = ConfigDict(extra='allow')` so unrecognised OPDS fields are preserved.
170
+
171
+ ### Unified Feed Models (`models/feed_page.py`)
172
+
173
+ Raw OPDS data is reconciled into a unified hierarchy for UI rendering:
174
+
175
+ - **`FeedPage`**: The root container for a single "screen" of a feed, containing sections, facets, search templates, and breadcrumbs.
176
+ - **`FeedSection`**: A logical grouping (e.g., "Newest", "All Series") with its own items, pagination metadata, and layout type (RIBBON or GRID).
177
+ - **`FeedItem`**: A single visual card representing a publication or a navigation folder.
178
+
179
+ ---
180
+
181
+ ## 6. API Layer
182
+
183
+ ### `APIClient` (`api/client.py`)
184
+
185
+ Thin async HTTP wrapper built on `httpx.AsyncClient`.
186
+
187
+ ### `OPDS2Client` (`api/opds_v2.py`)
188
+
189
+ High-level OPDS 2.0 parser with in-memory JSON caching.
190
+
191
+ ### `FeedReconciler` (`api/feed_reconciler.py`)
192
+
193
+ The transformation engine that converts raw `OPDSFeed` objects into `FeedPage` structures. It handles:
194
+ - Detecting "Main" sections for infinite scroll.
195
+ - Normalizing pagination patterns across different server types.
196
+ - **Section Identity**: Generates unique, stable `section_id` strings, appending current page numbers when necessary to prevent collisions in "Infinite Sections" mode.
197
+ - Heuristic-based extraction of series names and issue numbers.
198
+ - Pruning redundant server-side nesting.
199
+
200
+ ### `ImageManager` (`api/image_manager.py`)
201
+
202
+ Three-tier image cache: memory → disk (SHA256) → network.
203
+
204
+ ### `DownloadManager` (`api/download_manager.py`)
205
+
206
+ Background CBZ streamer with sequential task queueing.
207
+
208
+ ---
209
+
210
+ ## 7. Local Library System
211
+
212
+ ### `LibraryScanner` (`api/library_scanner.py`)
213
+
214
+ Async directory scanner with comicbox integration for metadata extraction.
215
+
216
+ ### `LocalLibraryDB` (`api/local_db.py`)
217
+
218
+ SQLite database for library metadata and reading progress.
219
+
220
+ ---
221
+
222
+ ## 8. UI Architecture
223
+
224
+ ### 8.1 Class Hierarchies
225
+
226
+ The UI is structured around a centralized orchestrator (`AppLayout`) and a set of specialized sub-views.
227
+
228
+ #### Feed Browser View Hierarchy
229
+ Supports both "Paged" (Dashboard-style) and "Scrolled" (Virtualized continuous) rendering.
230
+
231
+ ```text
232
+ QWidget (Qt)
233
+ └── BaseFeedSubView (Shared signals, configure_list_view, gather_context_pubs)
234
+ ├── PagedFeedView (Dashboard mode: CollapsibleSections in QScrollArea)
235
+ └── ScrolledFeedView (Continuous mode: section-level virtual scroll)
236
+
237
+ QWidget (Qt)
238
+ └── FeedBrowser (Traffic Cop coordinator)
239
+ ├── Instantiates PagedFeedView
240
+ └── Instantiates ScrolledFeedView
241
+ ```
242
+
243
+ **ScrolledFeedView virtual scroll architecture**
244
+
245
+ Rather than one giant composite `QListView`, `ScrolledFeedView` uses a
246
+ `QAbstractScrollArea` (`_impl`) whose viewport (`_vp`) holds real per-section
247
+ widget pairs positioned by a single vertical `QScrollBar`. This avoids Qt's
248
+ 16 777 215 px (`QWIDGETSIZE_MAX`) content-widget limit entirely.
249
+
250
+ ```
251
+ ScrolledFeedView (QWidget / BaseFeedSubView)
252
+ └── _impl (_ScrollImpl : QAbstractScrollArea) ← provides clipping viewport
253
+ └── _vp (viewport QWidget)
254
+ ├── SectionHeader ─┐ one pair per section,
255
+ ├── BaseCardRibbon ─┘ repositioned on every scroll event (RIBBON sections)
256
+ ├── SectionHeader ─┐
257
+ └── QListView ─┘ height = visible slice only (large GRID section)
258
+ ```
259
+
260
+ Key design points:
261
+
262
+ - **Section-level virtualisation**: only widgets whose section overlaps the
263
+ viewport are shown; others are hidden.
264
+ - **Large GRID sections** (up to 30 k items): the `QListView` widget height is
265
+ capped to the visible slice height. Its internal `verticalScrollBar` is
266
+ synced to `outer_scroll − section.y − header_height`, preserving full
267
+ QListView item-level virtualisation without creating a tall widget.
268
+ - **Height estimation**: `_grid_content_height` approximates content height
269
+ from column count and row height; `_calibrate_grid_heights` corrects this
270
+ from the QListView's actual scroll range after first layout.
271
+ - **Wheel forwarding**: an `eventFilter` on each grid view's viewport
272
+ redirects vertical wheel events to `_sb` (the outer scrollbar).
273
+ - **Page fetching / debouncing / cover loading**: logic is identical to the
274
+ previous implementation, operating on the main grid section's
275
+ `FeedBrowserModel`.
276
+
277
+ #### Main Application Structure
278
+ The top-level shell managing navigation and primary workspaces.
279
+
280
+ ```text
281
+ QMainWindow (Qt)
282
+ └── ComicCatcherApp (main.py)
283
+
284
+ QWidget (Qt)
285
+ └── AppLayout (Central orchestrator: sidebar, header, stacked views)
286
+ └── QStackedWidget (View switching)
287
+ ├── FeedBrowser (OPDS browser)
288
+ ├── LocalLibraryView (Local files)
289
+ ├── SettingsView
290
+ └── ReaderView (Online/Local viewer)
291
+ ```
292
+
293
+ #### Component Hierarchy (Shared UI)
294
+ Reusable building blocks across different view modes.
295
+
296
+ ```text
297
+ QStyledItemDelegate (Qt)
298
+ └── BaseCardDelegate
299
+ ├── FeedCardDelegate (OPDS publication card)
300
+ └── LibraryCardDelegate (Local file card with progress)
301
+
302
+ QAbstractListModel (Qt)
303
+ └── FeedBrowserModel (Virtualized grid data source)
304
+
305
+ QWidget (Qt)
306
+ ├── CollapsibleSection (Expandable section container)
307
+ ├── SectionHeader (Themed header with "See All" support)
308
+ ├── MiniDetailPopover (Bubble-style metadata summary)
309
+ └── QListView (Qt)
310
+ └── BaseCardRibbon (Horizontal carousel)
311
+ ```
312
+
313
+ ### 8.2 MainWindow (`ui/app_layout.py`)
314
+
315
+ The root window containing the sidebar and stacked content views. Uses the `ViewIndex` enum for reliable navigation.
316
+
317
+ ```
318
+ Stack Index (ViewIndex):
319
+ - FEED_LIST: 0
320
+ - LIBRARY: 1
321
+ - SETTINGS: 2
322
+ - LOCAL_DETAIL: 3
323
+ - LOCAL_READER: 4
324
+ - DETAIL: 5
325
+ - READER_ONLINE: 6
326
+ - SEARCH_ROOT: 7
327
+ - FEED_BROWSER: 8
328
+ ```
329
+
330
+ **Standard Navigation:**
331
+ - Single global **Back** button in the header.
332
+ - Smart **Breadcrumbs** distinguishing feed identity from path.
333
+
334
+ ---
335
+
336
+ ## 9. Views Reference
337
+
338
+ ### FeedListView (`views/feed_list.py`)
339
+
340
+ Root screen for feed selection.
341
+
342
+ ### 9.2 FeedBrowser (`ui/views/feed_browser.py`)
343
+
344
+ A high-level "Traffic Cop" that coordinates feed rendering. It does not perform rendering directly; instead, it delegates to specialized sub-views based on the active feed profile's `paging_mode`.
345
+
346
+ - **PagedFeedView**: Traditional dashboard layout with stacked `CollapsibleSection` widgets in a `QScrollArea`. Used for highly structured, mixed-content feeds.
347
+ - **ScrolledFeedView**: High-performance continuous scroll using a section-level virtual scroll area (`QAbstractScrollArea`).
348
+
349
+ #### ScrolledFeedView Scroll Modes
350
+
351
+ `ScrolledFeedView` dynamically selects a strategy based on the `FeedPage` structure:
352
+
353
+ 1. **Virtualized Grid**: Used when a primary content section (`main_section`) is identified with a known `total_items`. The view pre-allocates the entire vertical scroll range, fetching items sparsely as they enter the viewport.
354
+ 2. **Infinite Grid**: Used when a `main_section` is identified but its total length is unknown. New items are fetched from the `next_url` and appended to the existing grid as the user scrolls.
355
+ 3. **Infinite Sections**: Used for feeds that lack a single primary grid but provide a `next_url` (e.g., a dashboard that continues to add new categorical groups). New pages are fetched and their sections (headers + content) are appended to the view.
356
+ 4. **Static Mode**: The fallback for feeds without pagination metadata or those that do not qualify for the automated scrolling modes. Only the first page is rendered.
357
+
358
+ - **Search Integration**: Redirects search queries to the relevant OPDS search template, rendering results via the standard paged/scrolled sub-views.
359
+
360
+ ### FeedDetailView (`views/feed_detail.py`)
361
+
362
+ Full publication metadata and actions (Read/Download) for online comics. Opens **FeedReaderView**.
363
+
364
+ ### FeedReaderView (`views/feed_reader.py`)
365
+
366
+ OPDS streaming reader (extends BaseReaderView).
367
+
368
+ ### LocalLibraryView (`views/local_library.py`)
369
+
370
+ Local comic library browser with grouping support.
371
+
372
+ ### LocalDetailView (`views/local_detail.py`)
373
+
374
+ Detail view for local comics. Opens **LocalReaderView**.
375
+
376
+ ### LocalReaderView (`views/local_reader.py`)
377
+
378
+ Offline CBZ reader (extends BaseReaderView).
379
+
380
+ ---
381
+
382
+ ## 10. Base Components
383
+
384
+ ### `BaseReaderView` (`ui/base_reader.py`)
385
+
386
+ Shared engine for online and local readers. Handles UI overlays, hotkeys, page compositing, and context-aware book transitions.
387
+
388
+ ---
389
+
390
+ ## 11. Theme System
391
+
392
+ **`ThemeManager`** (`ui/theme_manager.py`)
393
+
394
+ Modern "thin-bar" design language with 4px progress bars and themed scrollbars. Supports Light, Dark, OLED, Blue, and Light Blue presets.
395
+
396
+ ---
397
+
398
+ ## 12. Multi-Select & Selection Mode
399
+
400
+ Supports explicit selection mode for bulk downloads and deletions with tiered identity keys.
401
+
402
+ ---
403
+
404
+ ## 13. Context Menus
405
+
406
+ Right-click shortcuts for quick actions (Download, Mark Read/Unread, Delete) across the application.
407
+
408
+ ---
409
+
410
+ ## 14. Threading & Concurrency
411
+
412
+ Leverages `asyncio.to_thread` for blocking I/O and `qasync` for event loop integration.
413
+
414
+ ---
415
+
416
+ ## 15. Caching Strategy
417
+
418
+ Persistent JSON and image caches maintained for the duration of the application session.
419
+
420
+ ---
421
+
422
+ ## 16. Data Flows
423
+
424
+ ### Opening an Online Publication
425
+
426
+ ```
427
+ User clicks PublicationCard
428
+ → on_open_detail(pub, self_url, context_pubs)
429
+ → FeedDetailView.load_publication(pub, url, ..., context_pubs)
430
+ → progression_sync.get_progression(endpoint)
431
+
432
+ User clicks Read
433
+ → on_read_book(pub, manifest_url, context_pubs)
434
+ → FeedReaderView.load_manifest(pub, manifest_url, ..., context_pubs)
435
+ ```
436
+
437
+ ### Opening a Local Comic
438
+
439
+ ```
440
+ User double-clicks comic in LocalLibraryView
441
+ → on_open_local_comic(path, context_paths)
442
+ → LocalDetailView.load_path(path, context_paths)
443
+
444
+ User clicks Read
445
+ → on_read_local_comic(path, context_paths)
446
+ → LocalReaderView.load_cbz(path, context_paths)
447
+ ```
448
+
449
+ ---
450
+
451
+ ## 17. Navigation & History
452
+
453
+ Independent `feed_history` and `search_history` stacks with support for deep-link breadcrumb jumping.
454
+
455
+ ---
456
+
457
+ ## 18. Testing
458
+
459
+ See TESTING.md
460
+
461
+ ---
462
+
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.