##// END OF EJS Templates
Make the widget keys property traverse the superclasses and accumulate the _keys attributes....
Jason Grout -
Show More
@@ -84,14 +84,22 b' class BaseWidget(LoggingConfigurable):'
84 84 removed from the frontend."""
85 85 self._close_communication()
86 86
87
87 _keys = ['default_view_name']
88
88 89 # Properties
89 90 @property
90 91 def keys(self):
91 keys = ['default_view_name']
92 keys.extend(self._keys)
92 """Lazily accumulate _keys from all superclasses and cache them in this class"""
93 keys=[]
94 for c in self.__class__.mro():
95 if hasattr(c, '_keys'):
96 keys.extend(getattr(c,'_keys'))
97 else:
98 break
99 # cache so future lookups are fast
100 self.__class__.x = keys
93 101 return keys
94
102
95 103 @property
96 104 def comm(self):
97 105 if self._comm is None:
@@ -346,12 +354,7 b' class Widget(BaseWidget):'
346 354 # Private/protected declarations
347 355 _css = Dict() # Internal CSS property dict
348 356
349 # Properties
350 @property
351 def keys(self):
352 keys = ['visible', '_css']
353 keys.extend(super(Widget, self).keys)
354 return keys
357 _keys = ['visible', '_css']
355 358
356 359 def get_css(self, key, selector=""):
357 360 """Get a CSS property of the widget. Note, this function does not
General Comments 0
You need to be logged in to leave comments. Login now