diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-11-16 19:15:20 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-11-16 19:15:20 -0500 |
commit | 779793c74698e40fe11ceeb0debc826beed9d786 (patch) | |
tree | b913cdee562759e8de6561c0be0f6a0a1db6a97b /docs/Code_Overview.md | |
parent | 34f58f28160d5e13bcd68d96f92ebde5f608110a (diff) | |
download | kutter-779793c74698e40fe11ceeb0debc826beed9d786.tar.gz kutter-779793c74698e40fe11ceeb0debc826beed9d786.tar.xz kutter-779793c74698e40fe11ceeb0debc826beed9d786.zip |
docs: Update Code_Overview.md with information on get_status()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'docs/Code_Overview.md')
-rw-r--r-- | docs/Code_Overview.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/Code_Overview.md b/docs/Code_Overview.md index 1ccec14b..170185b7 100644 --- a/docs/Code_Overview.md +++ b/docs/Code_Overview.md @@ -286,6 +286,17 @@ The following may also be useful: `printer.lookup_object("pins").setup_pin("pwm", config.get("my_pin"))`. The returned object can then be commanded at run-time. +* If the printer object defines a `get_status()` method then the + module can export [status information](Status_Reference.md) via + [macros](Command_Templates.md) and via the + [API Server](API_Server.md). The `get_status()` method must return a + Python dictionary with keys that are strings and values that are + integers, floats, strings, lists, dictionaries, True, False, or + None. Tuples (and named tuples) may also be used (these appear as + lists when accessed via the API Server). Lists and dictionaries that + are exported must be treated as "immutable" - if their contents + change then a new object must be returned from `get_status()`, + otherwise the API Server will not detect those changes. * If the module needs access to system timing or external file descriptors then use `printer.get_reactor()` to obtain access to the global "event reactor" class. This reactor class allows one to |