3f5b4a74262471c52c3c57df5c93e801e1d90893
[hooke.git] / hooke / ui / gui / export.py
1     #PLOT EXPORT AND MANIPULATION COMMANDS
2     def help_export(self):
3         print '''
4 EXPORT
5 Saves the current plot as an image file
6 ---------------
7 Syntax: export [filename] {plot to export}
8
9 The supported formats are PNG and EPS; the file extension of the filename is automatically recognized
10 and correctly exported. Resolution is (for now) fixed at 150 dpi.
11
12 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)
13         '''
14     def do_export(self,args):
15         #FIXME: the bottom plot doesn't have the title
16
17         dest=0
18
19         if len(args)==0:
20             #FIXME: We have to go into the libinput stuff and fix it, for now here's a dummy replacement...
21             #name=linp.safeinput('Filename?',[self.current.path+'.png'])
22             name=raw_input('Filename? ')
23         else:
24             args=args.split()
25             name=args[0]
26             if len(args) > 1:
27                 dest=int(args[1])
28
29         export_image=self.list_of_events['export_image']
30         wx.PostEvent(self.frame, export_image(name=name, dest=dest))