From f9520619c9b5f7fd37d5566e8575776d48343a7c Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 28 Apr 2011 08:34:14 -0400 Subject: [PATCH] Clean up and adjust names of commands requiring curve updates in the GUI. --- hooke/ui/gui/__init__.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/hooke/ui/gui/__init__.py b/hooke/ui/gui/__init__.py index b7d4fa3..a49fe27 100644 --- a/hooke/ui/gui/__init__.py +++ b/hooke/ui/gui/__init__.py @@ -519,16 +519,7 @@ class HookeFrame (wx.Frame): self.execute_command( command=self._command_by_name('get playlist')) - def _postprocess_zero_block_surface_contact_point( - self, command, args={}, results=[]): - """Update the curve, since the available columns may have changed. - """ - if isinstance(results[-1], Success): - self.execute_command( - command=self._command_by_name('get curve')) - - def _postprocess_add_block_force_array( - self, command, args={}, results=[]): + def _update_curve(self, command, args={}, results=[]): """Update the curve, since the available columns may have changed. """ if isinstance(results[-1], Success): @@ -536,7 +527,6 @@ class HookeFrame (wx.Frame): command=self._command_by_name('get curve')) - # Command panel interface def select_command(self, _class, method, command): @@ -821,6 +811,15 @@ class HookeFrame (wx.Frame): self._restore_perspective(name) +# setup per-command versions of HookeFrame._update_curve +for _command in ['convert_distance_to_force', + 'polymer_fit_peaks', + 'remove_cantilever_from_extension', + 'zero_surface_contact_point', + ]: + setattr(HookeFrame, '_postprocess_%s' % _command, HookeFrame._update_curve) +del _command + class HookeApp (wx.App): """A :class:`wx.App` wrapper around :class:`HookeFrame`. -- 2.26.2