Problem Description
In many cases in chaco we have _anytrait_changed methods which define a list of traits of actual interest, checks if the changed trait is in that list, and then calls a certain method. For example:
|
def _anytrait_changed(self, name, old, new): |
|
"""For every trait that defines a visual attribute |
|
we just call _invalidate() when a change is made. |
|
""" |
|
invalidate_traits = [ |
|
"title_font", |
|
"title_spacing", |
|
"title_color", |
|
"title_angle", |
|
"tick_weight", |
|
"tick_color", |
|
"tick_label_font", |
|
"tick_label_color", |
|
"tick_label_rotate_angle", |
|
"tick_label_alignment", |
|
"tick_label_margin", |
|
"tick_label_offset", |
|
"tick_label_position", |
|
"tick_label_formatter", |
|
"tick_in", |
|
"tick_out", |
|
"tick_visible", |
|
"tick_interval", |
|
"tick_generator", |
|
"orientation", |
|
"origin", |
|
"axis_line_visible", |
|
"axis_line_color", |
|
"axis_line_weight", |
|
"axis_line_style", |
|
"small_haxis_style", |
|
"ensure_labels_bounded", |
|
"ensure_ticks_bounded", |
|
] |
|
if name in invalidate_traits: |
|
self._invalidate() |
This is a case where we would want to use metadata in the trait definition and listen based on that. Similar to the recently added requires_redraw (see PR #585 and issue #595)
Problem Description
In many cases in chaco we have
_anytrait_changedmethods which define a list of traits of actual interest, checks if the changed trait is in that list, and then calls a certain method. For example:chaco/chaco/axis.py
Lines 781 to 816 in c758a65
This is a case where we would want to use metadata in the trait definition and listen based on that. Similar to the recently added
requires_redraw(see PR #585 and issue #595)