##// 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 removed from the frontend."""
84 removed from the frontend."""
85 self._close_communication()
85 self._close_communication()
86
86
87
87 _keys = ['default_view_name']
88
88 # Properties
89 # Properties
89 @property
90 @property
90 def keys(self):
91 def keys(self):
91 keys = ['default_view_name']
92 """Lazily accumulate _keys from all superclasses and cache them in this class"""
92 keys.extend(self._keys)
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 return keys
101 return keys
94
102
95 @property
103 @property
96 def comm(self):
104 def comm(self):
97 if self._comm is None:
105 if self._comm is None:
@@ -346,12 +354,7 b' class Widget(BaseWidget):'
346 # Private/protected declarations
354 # Private/protected declarations
347 _css = Dict() # Internal CSS property dict
355 _css = Dict() # Internal CSS property dict
348
356
349 # Properties
357 _keys = ['visible', '_css']
350 @property
351 def keys(self):
352 keys = ['visible', '_css']
353 keys.extend(super(Widget, self).keys)
354 return keys
355
358
356 def get_css(self, key, selector=""):
359 def get_css(self, key, selector=""):
357 """Get a CSS property of the widget. Note, this function does not
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