From 1077f20a950caf0783da981b0c5ebd8e6ad009ef Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 12 May 2010 14:52:20 -0400 Subject: [PATCH] Moved export command from hooke_cli -> hooke.ui.gui.export stub. --- hooke/hooke_cli.py | 35 ----------------------------------- hooke/ui/gui/export.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 35 deletions(-) create mode 100644 hooke/ui/gui/export.py diff --git a/hooke/hooke_cli.py b/hooke/hooke_cli.py index 2930abf..fddb648 100644 --- a/hooke/hooke_cli.py +++ b/hooke/hooke_cli.py @@ -399,38 +399,3 @@ Syntax: plot ''' show_plots=self.list_of_events['show_plots'] wx.PostEvent(self.frame, show_plots()) - - - - #PLOT EXPORT AND MANIPULATION COMMANDS - def help_export(self): - print ''' -EXPORT -Saves the current plot as an image file ---------------- -Syntax: export [filename] {plot to export} - -The supported formats are PNG and EPS; the file extension of the filename is automatically recognized -and correctly exported. Resolution is (for now) fixed at 150 dpi. - -If you have a multiple plot, the optional plot to export argument tells Hooke which plot you want to export. If 0, the top plot is exported. If 1, the bottom plot is exported (Exporting both plots is still to implement) - ''' - def do_export(self,args): - #FIXME: the bottom plot doesn't have the title - - dest=0 - - if len(args)==0: - #FIXME: We have to go into the libinput stuff and fix it, for now here's a dummy replacement... - #name=linp.safeinput('Filename?',[self.current.path+'.png']) - name=raw_input('Filename? ') - else: - args=args.split() - name=args[0] - if len(args) > 1: - dest=int(args[1]) - - export_image=self.list_of_events['export_image'] - wx.PostEvent(self.frame, export_image(name=name, dest=dest)) - - diff --git a/hooke/ui/gui/export.py b/hooke/ui/gui/export.py new file mode 100644 index 0000000..3f5b4a7 --- /dev/null +++ b/hooke/ui/gui/export.py @@ -0,0 +1,30 @@ + #PLOT EXPORT AND MANIPULATION COMMANDS + def help_export(self): + print ''' +EXPORT +Saves the current plot as an image file +--------------- +Syntax: export [filename] {plot to export} + +The supported formats are PNG and EPS; the file extension of the filename is automatically recognized +and correctly exported. Resolution is (for now) fixed at 150 dpi. + +If you have a multiple plot, the optional plot to export argument tells Hooke which plot you want to export. If 0, the top plot is exported. If 1, the bottom plot is exported (Exporting both plots is still to implement) + ''' + def do_export(self,args): + #FIXME: the bottom plot doesn't have the title + + dest=0 + + if len(args)==0: + #FIXME: We have to go into the libinput stuff and fix it, for now here's a dummy replacement... + #name=linp.safeinput('Filename?',[self.current.path+'.png']) + name=raw_input('Filename? ') + else: + args=args.split() + name=args[0] + if len(args) > 1: + dest=int(args[1]) + + export_image=self.list_of_events['export_image'] + wx.PostEvent(self.frame, export_image(name=name, dest=dest)) -- 2.26.2