How projecthamster/hamster works
Project type and purpose
• This is a standalone, single-module desktop time-tracking application (“Hamster”) written in Python 3 and GTK3.
• It provides a background daemon (the service), a command-line client, and a GUI client, all coordinated via D-Bus, persisting data in a local SQLite database.
File-structure analysis
• Top-level folders:
• help/ & po/ – Mallard help pages and translation files
• src/ – all Python code
· hamster-cli.py, hamster-service.py, hamster-windows-service.py – entry points
· src/hamster/ – core module
– lib/ – core libraries (configuration, charting, i18n, D-Bus helpers, parsing, etc.)
– storage/ – database layer (SQLite access)
– widgets/ – GUI widgets (activity entry, overview, reports, etc.)
• waf & wscript – build and installation scripts
• tests/ – unit tests
• Key configuration: D-Bus interfaces, UI definitions (.ui), gschema, Flatpak YAML.
README insights
• Confirms the D-Bus client-server architecture (daemon + clients).
• Lists dependencies (Python-GI/GTK, D-Bus, intltool, etc.).
• Describes development workflow: launching service & CLI for live testing, backing up the DB, packaging via Waf/Flatpak.
Diagramming the architecture
• User interfaces
– CLI client (hamster-cli.py)
– GUI client (GTK widgets via python src/hamster/)
• Client library (src/hamster/client.py + lib/*)
• IPC layer (D-Bus)
• Service daemon (hamster-service.py)
• Storage layer (src/hamster/storage + SQLite database file)
• Build/packaging subsystem (Waf, Flatpak)
• External dependencies (GTK3, Python3 runtime, intltool, OS D-Bus)
1. UI → Client library → D-Bus API → Service daemon
2. Service daemon → Storage layer (read/write SQLite)
3. Service daemon → D-Bus → UI (events/updates)
4. Build system → bundles code + assets → OS packages / Flatpak
c. Architectural patterns and principles:
• Client-server via D-Bus for decoupling UI and data logic
• Layered separation: presentation (UI), application (client lib & daemon), persistence (storage)
• Extensibility via modular lib/ and widgets/ subpackages
d. Key technologies and libraries:
• Python 3.6+, PyGObject (GTK3, Cairo), Python-DBus
• SQLite for local persistence
• Waf build system, Flatpak packaging, intltool / gettext for i18n