mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-21 00:12:31 +01:00
`sickdays gui` opens a Tk window modelled on the phone's Sick days screen: a Monday-first month calendar (cat-2 fill, a dot for kept lockers, past days faded and inert), a five-switch panel for the clicked day, and the "Marked sick" list with "Kept: ..." lines. A free day is refused with the phone's wording. Each write starts sync_quietly() on a non-daemon thread. The window class is "sickdays" and Escape closes it. sickdays.gui.KeepPanel is the panel on its own, a plain tk.Frame with no root, mainloop, grab or wm_* call, so screen-locker can embed it under its lock-screen grab. `import sickdays` and the rest of the CLI never import tkinter: the CLI loads the gui module by name only for `gui`, and a subprocess test checks this. The tests drive real Tk on a withdrawn root, and CI now runs them under xvfb-run, as gatelock's CI does. Adds a sickdays.desktop launcher, which install.sh installs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PAhbNszs5JKdtnD4uBi3xp
25 lines
871 B
Python
25 lines
871 B
Python
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
"""The Tk sick-day picker, and the switch panel other apps embed.
|
|
|
|
Kept out of :mod:`sickdays` on purpose: every headless gate imports
|
|
``sickdays`` once a minute, and none of them may pull in tkinter. Import
|
|
this module only from the ``sickdays gui`` command or an app that already
|
|
draws with Tk::
|
|
|
|
from sickdays.gui import KeepPanel
|
|
|
|
panel = KeepPanel(surface, today, on_saved=lambda entry: panel.destroy())
|
|
panel.pack()
|
|
|
|
:class:`KeepPanel` is a plain ``tk.Frame`` (no root, no mainloop, no grab),
|
|
so it works in-process under another window's X grab. See its docstring for
|
|
what ``on_saved`` receives. :func:`run` opens the whole window.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from sickdays.gui._panel import KeepPanel
|
|
from sickdays.gui._window import SickDaysApp, run
|
|
|
|
__all__ = ["KeepPanel", "SickDaysApp", "run"]
|