Ran update_copyright.py, updating all the copyright blurbs and adding AUTHORS.
[hooke.git] / hooke / ui / gui / export.py
1 # Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
2 #
3 # This file is part of Hooke.
4 #
5 # Hooke is free software: you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation, either
8 # version 3 of the License, or (at your option) any later version.
9 #
10 # Hooke is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with Hooke.  If not, see
17 # <http://www.gnu.org/licenses/>.
18
19     #PLOT EXPORT AND MANIPULATION COMMANDS
20     def help_export(self):
21         print '''
22 EXPORT
23 Saves the current plot as an image file
24 ---------------
25 Syntax: export [filename] {plot to export}
26
27 The supported formats are PNG and EPS; the file extension of the filename is automatically recognized
28 and correctly exported. Resolution is (for now) fixed at 150 dpi.
29
30 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)
31         '''
32     def do_export(self,args):
33         #FIXME: the bottom plot doesn't have the title
34
35         dest=0
36
37         if len(args)==0:
38             #FIXME: We have to go into the libinput stuff and fix it, for now here's a dummy replacement...
39             #name=linp.safeinput('Filename?',[self.current.path+'.png'])
40             name=raw_input('Filename? ')
41         else:
42             args=args.split()
43             name=args[0]
44             if len(args) > 1:
45                 dest=int(args[1])
46
47         export_image=self.list_of_events['export_image']
48         wx.PostEvent(self.frame, export_image(name=name, dest=dest))