PySDM_examples.utils.widgets.freezer

 1class Freezer:
 2    def __init__(self, widgets):
 3        self.widgets = widgets
 4
 5    def observe(self, *_):
 6        pass
 7
 8    @property
 9    def value(self):
10        return self
11
12    def __enter__(self):
13        for widget in self.widgets:
14            widget.disabled = True
15        return self
16
17    def __exit__(self, *args, **kwargs):
18        for widget in self.widgets:
19            widget.disabled = False
class Freezer:
 2class Freezer:
 3    def __init__(self, widgets):
 4        self.widgets = widgets
 5
 6    def observe(self, *_):
 7        pass
 8
 9    @property
10    def value(self):
11        return self
12
13    def __enter__(self):
14        for widget in self.widgets:
15            widget.disabled = True
16        return self
17
18    def __exit__(self, *args, **kwargs):
19        for widget in self.widgets:
20            widget.disabled = False
Freezer(widgets)
3    def __init__(self, widgets):
4        self.widgets = widgets
widgets
def observe(self, *_):
6    def observe(self, *_):
7        pass
value
 9    @property
10    def value(self):
11        return self