printrun-src/plater.py

Wed, 20 Jan 2021 11:37:03 +0100

author
mdd
date
Wed, 20 Jan 2021 11:37:03 +0100
changeset 48
3c27b4ee6fec
parent 45
c82943fb205f
permissions
-rwxr-xr-x

reimplemented lasercutter changes

45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
1 #!/usr/bin/env python3
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
2
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
3 # This file is part of the Printrun suite.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
4 #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
5 # Printrun is free software: you can redistribute it and/or modify
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
6 # it under the terms of the GNU General Public License as published by
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
7 # the Free Software Foundation, either version 3 of the License, or
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
8 # (at your option) any later version.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
9 #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
10 # Printrun is distributed in the hope that it will be useful,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
13 # GNU General Public License for more details.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
14 #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
16 # along with Printrun. If not, see <http://www.gnu.org/licenses/>.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
17
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
18 import os
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
19 import sys
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
20 import wx
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
21 import getopt
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
22
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
23 from printrun.stlplater import StlPlater
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
24
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
25 if __name__ == '__main__':
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
26
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
27 from printrun.printcore import __version__ as printcore_version
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
28
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
29 os.environ['GDK_BACKEND'] = 'x11'
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
30
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
31 usage = "Usage:\n"+\
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
32 " plater [OPTION]\n"+\
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
33 " plater FILES\n\n"+\
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
34 "Options:\n"+\
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
35 " -V, --version\t\t\tPrint program's version number and exit\n"+\
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
36 " -h, --help\t\t\tPrint this help message and exit\n" \
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
37 " --no-gl\t\t\tUse 2D implementation, that seems unusable"
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
38
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
39 try:
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
40 opts, args = getopt.getopt(sys.argv[1:], "hV", ["help", "version", 'no-gl'])
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
41 except getopt.GetoptError as err:
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
42 print(str(err))
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
43 print(usage)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
44 sys.exit(2)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
45 for o, a in opts:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
46 if o in ('-V','--version'):
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
47 print("printrun "+printcore_version)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
48 sys.exit(0)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
49 elif o in ('-h', '--help'):
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
50 print(usage)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
51 sys.exit(0)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
52
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
53 app = wx.App(False)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
54 main = StlPlater(filenames = sys.argv[1:])
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
55 main.Show()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
56 app.MainLoop()

mercurial