CLIM frontend: Write some documentation

This commit is contained in:
contrapunctus 2022-04-27 16:43:22 +05:30
parent 4f2d986fe4
commit e2d32232df
2 changed files with 39 additions and 3 deletions

View File

@ -3149,11 +3149,20 @@ NAME must be a keyword.
INDEX is a 1-indexed integer for the row.
TASK is the name of the task in this row, as a string.
DATE is the date, as integer seconds since the UNIX epoch."))
(defmethod cell-data ((name (eql :index)) (index integer) (task string) (date integer))
(defmethod cell-data ((name (eql :index))
(index integer)
(task string)
(date integer))
index)
(defmethod cell-data ((name (eql :task)) (index integer) (task string) (date integer))
(defmethod cell-data ((name (eql :task))
(index integer)
(task string)
(date integer))
task)
(defmethod cell-data ((name (eql :duration)) (index integer) (task string) (date integer))
(defmethod cell-data ((name (eql :duration))
(index integer)
(task string)
(date integer))
(task-duration-one-day task date))
#+END_SRC
@ -3210,6 +3219,7 @@ FRAME and PANE are the CLIM frame and pane as passed to the display function."))
:END:
#+BEGIN_SRC lisp
(defun task-duration-table-function (table-specification)
"Return a table (a list of lists) based on TABLE-SPECIFICATION."
(loop with date = (timestamp-to-unix (today))
for task in (task-list)
for index from 0

26
cl/manual.org Normal file
View File

@ -0,0 +1,26 @@
* Explanation
:PROPERTIES:
:CUSTOM_ID: explanation
:END:
This is a port of Chronometrist to Common Lisp.
Currently, it contains
1. a read-only plist-group backend
2. an incomplete SQLite backend
3. an incomplete CLIM frontend
** Source code overview
:PROPERTIES:
:CUSTOM_ID: source-code-overview
:END:
*** CLIM frontend
:PROPERTIES:
:CUSTOM_ID: clim-frontend
:END:
The CLIM frontend currently has only one CLIM pane, called the [[file:chronometrist.org::#task-duration-table-pane][task-duration table]]. By default, it displays a list of tasks, and each of their durations for today.
The columns displayed in this table are controlled by [[file:chronometrist.org::#*task-duration-table-spec*][=*task-duration-table-spec*=]], which contains a list of [[file:chronometrist.org::#column-specifier][=column-specifier=]] objects.
Each =column-specifier= has two methods specializing on it, a [[file:chronometrist.org::#cell-data][=cell-data=]] method and a [[file:chronometrist.org::#cell-print][=cell-print=]] method. These determine the data contained by the cells of the column, and how that data is printed in the CLIM pane.
The function =task-duration-table-function= returns the data of the table as a list of lists.