Tue, 19 Jan 2021 20:25:47 +0100
NeoCube laser cutting improvements
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 getopt | |
20 | ||
21 | try: | |
22 | import wx # NOQA | |
23 | except: | |
24 | print("wxPython is not installed. This program requires wxPython to run.") | |
25 | if sys.version_info.major >= 3: | |
26 | print("""\ | |
27 | As you are currently running python3, this is most likely because wxPython is | |
28 | not yet available for python3. You should try running with python2 instead.""") | |
29 | sys.exit(-1) | |
30 | else: | |
31 | raise | |
32 | ||
33 | from printrun.pronterface import PronterApp | |
34 | ||
35 | if __name__ == '__main__': | |
36 | ||
37 | from printrun.printcore import __version__ as printcore_version | |
38 | ||
39 | usage = "Usage:\n"+\ | |
40 | " pronterface [OPTION]\n\n"+\ | |
41 | "Options:\n"+\ | |
42 | " -V, --version\t\t\tPrint program's version number and exit\n"+\ | |
43 | " -h, --help\t\t\tPrint this help message and exit\n"+\ | |
44 | " -a, --autoconnect\t\tAutomatically try to connect to printer on startup\n"+\ | |
45 | " -c, --conf\t\t\tLoad this file on startup instead of .pronsolerc; you may chain config files, if so settings auto-save will use the last specified file\n"+\ | |
46 | " -e, --execute\t\t\tExecutes command after configuration/.pronsolerc is loaded; macros/settings from these commands are not autosaved" | |
47 | ||
48 | try: | |
49 | opts, args = getopt.getopt(sys.argv[1:], "hVcea", ["help", "version", "conf", "execute", "autoconnect"]) | |
50 | except getopt.GetoptError, err: | |
51 | print str(err) | |
52 | print usage | |
53 | sys.exit(2) | |
54 | for o, a in opts: | |
55 | if o in ('-V','--version'): | |
56 | print "printrun "+printcore_version | |
57 | sys.exit(0) | |
58 | elif o in ('-h', '--help'): | |
59 | print usage | |
60 | sys.exit(0) | |
61 | ||
62 | app = PronterApp(False) | |
63 | try: | |
64 | app.MainLoop() | |
65 | except KeyboardInterrupt: | |
66 | pass | |
67 | del app |