| 34 | |
| 35 | |
| 36 | class DictBox(Box): |
| 37 | def keys(self, dotted: bool = False): |
| 38 | if not dotted: |
| 39 | return super().keys() |
| 40 | |
| 41 | if not self._box_config["box_dots"]: |
| 42 | raise Exception( |
| 43 | "Cannot return dotted keys as this Box does not have `box_dots` enabled" |
| 44 | ) |
| 45 | |
| 46 | keys = set() |
| 47 | for key, value in self.items(): |
| 48 | added = False |
| 49 | if isinstance(key, str): |
| 50 | if isinstance(value, Box): |
| 51 | for sub_key in value.keys(dotted=True): |
| 52 | keys.add(f"{key}.{sub_key}") |
| 53 | added = True |
| 54 | if not added: |
| 55 | keys.add(key) |
| 56 | return sorted(keys, key=lambda x: str(x)) |
| 57 | |
| 58 | |
| 59 | class QPropertyMapper(QObject): |