Skip to content

Commit

Permalink
fix sidebar colors not updating; now FPEEditor.set_plot_settings_chan…
Browse files Browse the repository at this point in the history
…ger(func) will wrap 'func' with an inner function that calls a new function, FPEEdtior.set_radiobox_colors, if the input 'data' dict contains the 'colormap' key. because func is out of scope and defined by the predictor, this avoids having to reimplment radiobox color updating in every supervised predictor.
  • Loading branch information
georgeglidden committed Jun 14, 2024
1 parent 372e260 commit 84f2f40
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion diplomat/wx_gui/fpe_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@ def set_frame_exporter(self, func: Optional[Callable[[int, str, Path], Tuple[boo
"""
self._frame_exporter = func

def set_radiobox_colors(self, colormap):
self.video_player.select_box.set_colormap(colormap)

def set_plot_settings_changer(self, func: Optional[Callable[[Mapping[str, Any]], None]]):
"""
Set the plot settings changing function, which allows for adjusting certain video metadata values when they
Expand All @@ -667,7 +670,13 @@ def set_plot_settings_changer(self, func: Optional[Callable[[Mapping[str, Any]],
:param func: Optional function that accepts a string to any mapping (dict), and returns nothing. Can be used
for adjusting video metadata when a user adjusts visual settings in the UI.
"""
self._on_plot_settings_change = func

def func2(data):
if "colormap" in data:
self.set_radiobox_colors(data["colormap"])
func(data)

self._on_plot_settings_change = func2

@property
def history(self) -> History:
Expand Down

0 comments on commit 84f2f40

Please sign in to comment.