PySide6 app for capturing quick memories via voice or text, organized on a kanban board (On Docket → In Progress → Complete). Complete column is collapsible with 7d/30d/All date filters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
107 lines
2.6 KiB
Python
107 lines
2.6 KiB
Python
"""CLI entry point: single-instance dispatch and app launch."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import sys
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(
|
|
prog="my-memory",
|
|
description="Low-friction capture app for thoughts, text, and voice",
|
|
)
|
|
parser.add_argument(
|
|
"--capture",
|
|
action="store_true",
|
|
help="Signal running instance to open capture window",
|
|
)
|
|
parser.add_argument(
|
|
"--board",
|
|
action="store_true",
|
|
help="Signal running instance to open the kanban board",
|
|
)
|
|
parser.add_argument(
|
|
"--download-model",
|
|
action="store_true",
|
|
help="Pre-download the Whisper model and exit",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
if args.download_model:
|
|
_download_model()
|
|
return
|
|
|
|
# Must create QApplication before using any Qt networking
|
|
from PySide6.QtWidgets import QApplication
|
|
|
|
_app = QApplication.instance() or QApplication(sys.argv)
|
|
|
|
if args.capture:
|
|
_send_capture()
|
|
return
|
|
|
|
if args.board:
|
|
_send_board()
|
|
return
|
|
|
|
_run_app()
|
|
|
|
|
|
def _send_capture() -> None:
|
|
"""Send capture signal to running instance."""
|
|
from my_memory.app import send_capture_signal
|
|
|
|
if send_capture_signal():
|
|
return
|
|
|
|
print("No running instance found. Starting new instance...")
|
|
_run_app(show_capture=True)
|
|
|
|
|
|
def _send_board() -> None:
|
|
"""Send board signal to running instance."""
|
|
from my_memory.app import send_board_signal
|
|
|
|
if send_board_signal():
|
|
return
|
|
|
|
print("No running instance found. Starting new instance...")
|
|
_run_app(show_board=True)
|
|
|
|
|
|
def _run_app(show_capture: bool = False, show_board: bool = False) -> None:
|
|
"""Start the main application."""
|
|
from my_memory.app import MyMemoryApp
|
|
from my_memory.config import Config
|
|
|
|
config = Config.load()
|
|
app = MyMemoryApp(config)
|
|
|
|
if not app.ensure_single_instance():
|
|
print("Another instance is already running.", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
if show_capture:
|
|
app.show_capture_window()
|
|
if show_board:
|
|
app.show_board_window()
|
|
|
|
sys.exit(app.run())
|
|
|
|
|
|
def _download_model() -> None:
|
|
"""Pre-download the Whisper model."""
|
|
from my_memory.config import Config
|
|
from my_memory.transcriber import Transcriber
|
|
|
|
config = Config.load()
|
|
print(f"Downloading Whisper model '{config.whisper.model_size}'...")
|
|
transcriber = Transcriber(config.whisper)
|
|
transcriber.download_model()
|
|
print("Model downloaded successfully.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|