From 0b62dbeacc0aeb3c1f359bb75fc85cd034f1dd38 Mon Sep 17 00:00:00 2001 From: nyanpasu64 Date: Mon, 8 Apr 2019 07:00:30 -0700 Subject: [PATCH] Document PresentationModel --- corrscope/gui/model_bind.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/corrscope/gui/model_bind.py b/corrscope/gui/model_bind.py index 49d4841..6609d3d 100644 --- a/corrscope/gui/model_bind.py +++ b/corrscope/gui/model_bind.py @@ -52,6 +52,15 @@ class PresentationModel(qc.QObject): Qt's built-in model-view framework expects all models to take the form of a database-style numbered [row, column] structure, whereas my model takes the form of a key-value struct exposed as a form. + + Each GUI BoundWidget generally reads/writes `widget.pmodel[widget.path]`. + + To access cfg.foo.bar, set BoundWidget's path to read/write + pmodel["foo.bar"] or pmodel["foo__bar"]. + + To create a GUI field not directly mapping to `cfg`, + define a property named "foo__baz", then set BoundWidget's path to read/write + pmodel["foo.baz"] or pmodel["foo__baz"]. """ # These fields are specific to each subclass, and assigned there.