From: W. Trevor King Date: Wed, 12 May 2010 20:03:11 +0000 (-0400) Subject: More commands moved from hooke_cli to hooke.ui.gui.plotcommands stub X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fa715f7a35e904e373b21dac128d0347a507f164;p=hooke.git More commands moved from hooke_cli to hooke.ui.gui.plotcommands stub --- diff --git a/hooke/hooke_cli.py b/hooke/hooke_cli.py index 95c8ea1..be217a8 100644 --- a/hooke/hooke_cli.py +++ b/hooke/hooke_cli.py @@ -67,55 +67,3 @@ class HookeCli(cmd.Cmd, object): #load default list, if possible self.do_loadlist(self.config['defaultlist']) - -#HELPER FUNCTIONS -#Everything sending an event should be here - def _measure_N_points(self, N, whatset=1): - ''' - general helper function for N-points measures - ''' - wx.PostEvent(self.frame,self.list_of_events['measure_points'](num_of_points=N, set=whatset)) - while 1: - try: - points=self.frame.events_from_gui.get() - break - except Empty: - pass - return points - - def _get_displayed_plot(self,dest=0): - ''' - returns the currently displayed plot. - ''' - wx.PostEvent(self.frame, self.list_of_events['get_displayed_plot'](dest=dest)) - while 1: - try: - displayed_plot=self.events_from_gui.get() - except Empty: - pass - if displayed_plot: - break - return displayed_plot - - def _send_plot(self,plots): - ''' - sends a plot to the GUI - ''' - wx.PostEvent(self.frame, self.list_of_events['plot_graph'](plots=plots)) - return - - def _find_plotmanip(self, name): - ''' - returns a plot manipulator function from its name - ''' - return self.plotmanip[self.config['plotmanips'].index(name)] - - def _clickize(self, xvector, yvector, index): - ''' - returns a ClickedPoint() object from an index and vectors of x, y coordinates - ''' - point=ClickedPoint() - point.index=index - point.absolute_coords=xvector[index],yvector[index] - point.find_graph_coords(xvector,yvector) - return point diff --git a/hooke/ui/gui/plotcommands.py b/hooke/ui/gui/plotcommands.py index 4991994..7dd67d6 100644 --- a/hooke/ui/gui/plotcommands.py +++ b/hooke/ui/gui/plotcommands.py @@ -107,3 +107,55 @@ Syntax: plot ''' show_plots=self.list_of_events['show_plots'] wx.PostEvent(self.frame, show_plots()) + +#HELPER FUNCTIONS +#Everything sending an event should be here + def _measure_N_points(self, N, whatset=1): + ''' + general helper function for N-points measures + ''' + wx.PostEvent(self.frame,self.list_of_events['measure_points'](num_of_points=N, set=whatset)) + while 1: + try: + points=self.frame.events_from_gui.get() + break + except Empty: + pass + return points + + def _get_displayed_plot(self,dest=0): + ''' + returns the currently displayed plot. + ''' + wx.PostEvent(self.frame, self.list_of_events['get_displayed_plot'](dest=dest)) + while 1: + try: + displayed_plot=self.events_from_gui.get() + except Empty: + pass + if displayed_plot: + break + return displayed_plot + + def _send_plot(self,plots): + ''' + sends a plot to the GUI + ''' + wx.PostEvent(self.frame, self.list_of_events['plot_graph'](plots=plots)) + return + + def _find_plotmanip(self, name): + ''' + returns a plot manipulator function from its name + ''' + return self.plotmanip[self.config['plotmanips'].index(name)] + + def _clickize(self, xvector, yvector, index): + ''' + returns a ClickedPoint() object from an index and vectors of x, y coordinates + ''' + point=ClickedPoint() + point.index=index + point.absolute_coords=xvector[index],yvector[index] + point.find_graph_coords(xvector,yvector) + return point