-
Notifications
You must be signed in to change notification settings - Fork 1
Core API and Classes
Thread-safe SQLite data model. Central state hub — all silos, snippets, settings, theme, queues go through this.
Methods:
-
__init__(profile_id=1)— open SQLite conn, WAL mode, load cached settings -
init_db()— create/upgrade schema (presets, settings, temp_presets_v2, archive_temp_presets_v2), run startup .bak backup -
switch_profile(new_profile_id)— close current DB, switch path, reload -
save_data_to_db(text, ui_settings, force)— atomic dirty-state flush -
mark_dirty()— flag state as needing a save (async via auto-save timer) -
reset_data()— reinit in-memory defaults
Data model: Single self.data dict. Per-category stores aliased: temp_presets → temp_presets_all[active_cat], silo_colors → silo_colors_all[active_cat], etc. All _all keys auto-migrate on first access.
Threaded pynput keyboard listener for system-wide hotkeys.
Methods:
-
start()— spawn pynput listener thread -
stop()— halt listener -
update_hotkeys(hk_dict)— re-register hotkey map
Win32 WH_KEYBOARD_LL hook. Intercepts physical VK codes — layout-independent. Works cross-layout (QWERTY/JCUKEN/AZERTY). Used for layout_shortcuts.py dispatch.
QLocalServer on named pipe FastPrompter_Server_V15. UUID token auth via %TEMP%/fastprompter_ipc.token.
Methods:
-
setup()— start listening (recovers stale socket names with removeServer) -
close()— stop server -
_handle_command()— process SHOW command from second instance
Helper:
-
try_connect_to_server()— probe running instance (returns QLocalSocket or None)
WAV playback for UI clicks, typewriter keys, timer alarms.
Methods:
-
play_ui_click(),play_tick_sound(),play_typewriter(),play_sound(name)— dispatch audio - Volume controlled by
sound_volumesetting (0-10)
Work/break state machine with configurable intervals.
Constants: PHASE_WORK, PHASE_BREAK
Methods:
-
start_work(),start_break(),pause(),reset()— lifecycle -
tick(elapsed)— advance timer, yield phase transitions -
describe()— human-readable state string -
from_dict(data)/to_dict()— JSON serialization
Generic countdown timer. Color-coded urgency, sound on fire, snooze.
Timer attributes: name, description, target (datetime), sound, volume, color_mode, color
Methods:
-
remaining()— seconds until target -
snooze(minutes)— push target forward -
display_color()— urgency color (green/yellow/red) -
collect_due(timers)— return due timer list -
next_due(timers)— soonest timer -
save_timers(data)/load_timers(data)— serialization
Human-readable duration parsing.
-
parse_duration(text)— "2h 30m" → seconds -
format_remaining(seconds, short=False, minutes=False)— "2h 30m" → "2h" or "4d 11h 05m" -
format_duration(seconds)— full format string
Cross-silo hashtag extraction + search.
-
extract_tags(text)— return set of#tagstrings -
index_silo(cat, slot, text)— tag → silo index -
search(tag)— all silos containing tag across categories
Ctrl+W / Alt+W template insertion.
-
insert_divider(editor, template, upward)— insert horizontal rule, strip duplicate bullets on split -
simulate(editor, upward)— preview insert position
Ctrl+E header insertion. Configurable: rule line, gap, bullet, alignment, timestamp stamp.
-
format_header(editor, config)— format current line as header
| Module | Role |
|---|---|
engine.py |
Finite state machine: DISARMED → ARMED → WATCHING → SENDING |
cdp.py |
Chrome CDP attach + evaluate + read-back verification (Electron apps) |
win32.py |
Win32 window probe — foreground, caret, focus detection |
probes.py |
Multi-probe state combinators + combined matrix |
queue.py |
QueueItem, SendIntent, pinning, per-queue key, persistence |
sender.py |
CDP + Win32 keystroke injection with read-back verification |
skills.py |
Prompt skill wrappers — prefix/template transforms |
adapter.py |
Abstract probe adapter interface |
limit_scan.py |
Cross-agent limit scanner + auto-timer creation |
QMainWindow. Mixin composition (declaration order):
- FormattingMixin — markdown formatting shortcuts
- HotkeyMixin — hotkey binding interface
- ScalingMixin — DPI/font scaling
- SearchMixin — search bar over silos
- SendSelectionMixin — send text via watcher
- SnippetOpsMixin — silo ops (trash, duplicate, reorder)
- ThemeMixin — app stylesheet, vintage presets
- TrayMixin — system tray icon + menu
- WatcherMixin — watcher engine integration
- WindowMixin — frameless window + snapping
Key properties: _font_size, _font_family, _ui_scale, _button_scale, _sidebar_right, _always_on_top, _normal_window
Key methods:
-
init_ui()— build window, header toolbar, splitter, editor, sidebar, status bar -
setup_single_instance_server()— IPC init -
register_all_hotkeys()— bind pynput + PyQt shortcuts -
apply_font()/apply_theme()— cascade font/theme changes -
place_window()— restore saved geometry or apply default snap -
_switch_to_slot(slot, initial)— load silo into editor, save cursor state -
capture_silo_state()/restore_silo_state()— per-silo cursor/scroll/fold/heat persistence
Extended QPlainTextEdit. Markdown editing canvas.
Features:
- MarkdownHighlighter — live syntax coloring
- LineNumberArea — gutter: line numbers + fold arrows (▾) + margin marks
-
fold_header(block_num)/unfold_header(block_num)— section collapse -
queue_current_line()— anchor watcher item to block -
set_queue_anchor(block, id)— queue line anchoring -
collect_line_marks()/apply_line_marks()— per-line margin mark persistence -
collect_line_heat()/apply_line_heat()— recency heatmap -
block_for_queue_item(id)— find block by queue anchor -
toggle_checkbox()—- [ ]↔- [x] -
toggle_hide_markup(checked)— conceal ** * ~~ ` markers (T-603) - Image pills —
→ 150px clickable button
Sidebar silo list + F1-F10 buttons.
Classes:
-
SnippetWidget— sidebar panel: category tabs + silo list -
DraggableSiloButton— individual silo button (pin, tick, color, file icon, drag) -
WheelPager— scroll-synced pager for silo list -
DropVerticalWidget— drop zone for hierarchy nesting
Features:
- Up to 100 silos per tab
- Pins, ticks, recency heatmap, hierarchy (drag to nest)
- Sidebar gaps — user-defined spacer bars (Ctrl+drag to move)
- Multi-select — Shift=range, Ctrl=toggle, batch delete/save/clear
- Number-box mode — project switcher as numbered button row (T-607)
Per-silo file drawer. Opens below editor.
-
load_files(cat, slot)— read folder contents -
add_files(paths)— copy external files into silo folder -
apply_template(name)— create folder structure (IN/OUT/DOCS/Assets/Drafts) - Image preview, link mode, drag-and-drop
- Silo backup — Ctrl+click 📁 exports silo text
Pure-text markdown table builder. No Qt tables — works on plain markdown.
- Tab/Shift+Tab: walk cells; Tab off last → new row
- Enter: new row (not split)
- Cell editing via inline markdown
Pure-text markdown kanban board. Cards are markdown list items.
- Alt+↑/↓: move card up/down
- Alt+←/→: move card to adjacent column
- Enter on empty board line: new card
- Click checkbox: toggle done
Visual screen zone picker. 7 layout presets (TL, TR, BL, BR, Center, Full, Cursor). Click zone to snap.
Read-only viewer for .saipen/ STATE, BOARD, LOG files.
- Open via Ctrl+Shift+C or toolbar
- Auto-detect
.saipen/in project path - Live refresh button
User-defined window position presets. Up to 10 saved geometries as screen fractions.
- Save current geometry, rename, reorder, re-capture
- Apply from Ctrl+Q picker page
- Per-monitor fraction saves (survives monitor change)
Floating notification toast for timer alarms. Win95 3D bevels, theme colors, snooze button.
Drag-and-drop toolbar customization. Visible gap widgets. Reset button.
When header < 700px: hidden buttons collected in » popup. Every formatting, navigation, tool still reachable.
Context manager: with edit_block(widget): ... wraps begin/endEditBlock. Prevents Qt freeze from unterminated editing operations.
FastPrompter Wiki — Built with SAIPEN Protocol | GitHub Repo