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

1"""Base class for field widgets.""" 

2 

3import gws 

4 

5 

6class Props(gws.Props): 

7 type: str 

8 readOnly: bool 

9 uid: str 

10 

11 

12class Config(gws.Config): 

13 """Configuration for the widget.""" 

14 

15 readOnly: bool = False 

16 """The widget displays the value without allowing edits.""" 

17 

18 

19class Object(gws.ModelWidget): 

20 """Base model widget. 

21 

22 Provides the ``readOnly`` flag and the props common to all widgets. 

23 """ 

24 

25 readOnly: bool 

26 """The widget displays the value without allowing edits.""" 

27 

28 def configure(self): 

29 self.readOnly = self.cfg('readOnly', default=False) 

30 

31 def props(self, user): 

32 return Props(type=self.extType, readOnly=self.readOnly, uid=self.uid)