Sat, 23 Sep 2017 10:27:49 +0200
Added more default options
Code cleanup
15 | 1 | #!/usr/bin/env python |
2 | ||
3 | # This file is part of the Printrun suite. | |
4 | # | |
5 | # Printrun is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
7 | # the Free Software Foundation, either version 3 of the License, or | |
8 | # (at your option) any later version. | |
9 | # | |
10 | # Printrun 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 General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with Printrun. If not, see <http://www.gnu.org/licenses/>. | |
17 | ||
18 | import sys | |
19 | import wx | |
20 | import getopt | |
21 | ||
22 | from printrun.stlplater import StlPlater | |
23 | ||
24 | if __name__ == '__main__': | |
25 | ||
26 | from printrun.printcore import __version__ as printcore_version | |
27 | ||
28 | usage = "Usage:\n"+\ | |
29 | " plater [OPTION]\n"+\ | |
30 | " plater FILES\n\n"+\ | |
31 | "Options:\n"+\ | |
32 | " -V, --version\t\t\tPrint program's version number and exit\n"+\ | |
33 | " -h, --help\t\t\tPrint this help message and exit\n" | |
34 | ||
35 | try: | |
36 | opts, args = getopt.getopt(sys.argv[1:], "hV", ["help", "version"]) | |
37 | except getopt.GetoptError, err: | |
38 | print str(err) | |
39 | print usage | |
40 | sys.exit(2) | |
41 | for o, a in opts: | |
42 | if o in ('-V','--version'): | |
43 | print "printrun "+printcore_version | |
44 | sys.exit(0) | |
45 | elif o in ('-h', '--help'): | |
46 | print usage | |
47 | sys.exit(0) | |
48 | ||
49 | app = wx.App(False) | |
50 | main = StlPlater(filenames = sys.argv[1:]) | |
51 | main.Show() | |
52 | app.MainLoop() |