printrun-src/plater.py

changeset 45
c82943fb205f
parent 15
0bbb006204fc
equal deleted inserted replaced
44:310be640a303 45:c82943fb205f
1 #!/usr/bin/env python 1 #!/usr/bin/env python3
2 2
3 # This file is part of the Printrun suite. 3 # This file is part of the Printrun suite.
4 # 4 #
5 # Printrun is free software: you can redistribute it and/or modify 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 6 # it under the terms of the GNU General Public License as published by
13 # GNU General Public License for more details. 13 # GNU General Public License for more details.
14 # 14 #
15 # You should have received a copy of the GNU General Public License 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/>. 16 # along with Printrun. If not, see <http://www.gnu.org/licenses/>.
17 17
18 import os
18 import sys 19 import sys
19 import wx 20 import wx
20 import getopt 21 import getopt
21 22
22 from printrun.stlplater import StlPlater 23 from printrun.stlplater import StlPlater
23 24
24 if __name__ == '__main__': 25 if __name__ == '__main__':
25 26
26 from printrun.printcore import __version__ as printcore_version 27 from printrun.printcore import __version__ as printcore_version
27 28
29 os.environ['GDK_BACKEND'] = 'x11'
30
28 usage = "Usage:\n"+\ 31 usage = "Usage:\n"+\
29 " plater [OPTION]\n"+\ 32 " plater [OPTION]\n"+\
30 " plater FILES\n\n"+\ 33 " plater FILES\n\n"+\
31 "Options:\n"+\ 34 "Options:\n"+\
32 " -V, --version\t\t\tPrint program's version number and exit\n"+\ 35 " -V, --version\t\t\tPrint program's version number and exit\n"+\
33 " -h, --help\t\t\tPrint this help message and exit\n" 36 " -h, --help\t\t\tPrint this help message and exit\n" \
37 " --no-gl\t\t\tUse 2D implementation, that seems unusable"
34 38
35 try: 39 try:
36 opts, args = getopt.getopt(sys.argv[1:], "hV", ["help", "version"]) 40 opts, args = getopt.getopt(sys.argv[1:], "hV", ["help", "version", 'no-gl'])
37 except getopt.GetoptError, err: 41 except getopt.GetoptError as err:
38 print str(err) 42 print(str(err))
39 print usage 43 print(usage)
40 sys.exit(2) 44 sys.exit(2)
41 for o, a in opts: 45 for o, a in opts:
42 if o in ('-V','--version'): 46 if o in ('-V','--version'):
43 print "printrun "+printcore_version 47 print("printrun "+printcore_version)
44 sys.exit(0) 48 sys.exit(0)
45 elif o in ('-h', '--help'): 49 elif o in ('-h', '--help'):
46 print usage 50 print(usage)
47 sys.exit(0) 51 sys.exit(0)
48 52
49 app = wx.App(False) 53 app = wx.App(False)
50 main = StlPlater(filenames = sys.argv[1:]) 54 main = StlPlater(filenames = sys.argv[1:])
51 main.Show() 55 main.Show()

mercurial