Coverage for gws-app/gws/base/model/widget.py: 100%
11 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
1"""Base class for field widgets."""
3import gws
6class Props(gws.Props):
7 type: str
8 readOnly: bool
9 uid: str
12class Config(gws.Config):
13 """Configuration for the widget."""
15 readOnly: bool = False
16 """The widget displays the value without allowing edits."""
19class Object(gws.ModelWidget):
20 """Base model widget.
22 Provides the ``readOnly`` flag and the props common to all widgets.
23 """
25 readOnly: bool
26 """The widget displays the value without allowing edits."""
28 def configure(self):
29 self.readOnly = self.cfg('readOnly', default=False)
31 def props(self, user):
32 return Props(type=self.extType, readOnly=self.readOnly, uid=self.uid)