chiark / gitweb /
Move the validators from gui to util, they do not have gui specific code.
[cura.git] / Cura / cura.py
1 #!/usr/bin/python
2 """
3 This page is in the table of contents.
4 ==Overview==
5 ===Introduction===
6 Cura is a GPL tool chain to forge a gcode skein for a model. Based on Skeinforge.
7
8 The slicing code is the same as Skeinforge. But the UI has been revamped to be... sane.
9
10 """
11 from __future__ import absolute_import
12 import __init__
13
14 import sys
15 import platform
16 from optparse import OptionParser
17
18 from util import profile
19
20 __author__ = 'Daid'
21 __credits__ = """
22 Enrique Perez (perez_enrique@yahoo.com)
23 Adrian Bowyer <http://forums.reprap.org/profile.php?12,13>
24 Brendan Erwin <http://forums.reprap.org/profile.php?12,217>
25 Greenarrow <http://forums.reprap.org/profile.php?12,81>
26 Ian England <http://forums.reprap.org/profile.php?12,192>
27 John Gilmore <http://forums.reprap.org/profile.php?12,364>
28 Jonwise <http://forums.reprap.org/profile.php?12,716>
29 Kyle Corbitt <http://forums.reprap.org/profile.php?12,90>
30 Michael Duffin <http://forums.reprap.org/profile.php?12,930>
31 Marius Kintel <http://reprap.soup.io/>
32 Nophead <http://www.blogger.com/profile/12801535866788103677>
33 PJR <http://forums.reprap.org/profile.php?12,757>
34 Reece.Arnott <http://forums.reprap.org/profile.php?12,152>
35 Wade <http://forums.reprap.org/profile.php?12,489>
36 Xsainnz <http://forums.reprap.org/profile.php?12,563>
37 Zach Hoeken <http://blog.zachhoeken.com/>
38
39 Organizations:
40 Art of Illusion <http://www.artofillusion.org/>"""
41
42 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
43
44 def main():
45         parser = OptionParser(usage="usage: %prog [options] <filename>.stl")
46         parser.add_option("-i", "--ini", action="store", type="string", dest="profileini", help="Load settings from a profile ini file")
47         parser.add_option("-P", "--project", action="store_true", dest="openprojectplanner", help="Open the project planner")
48         parser.add_option("-F", "--flat", action="store_true", dest="openflatslicer", help="Open the 2D SVG slicer (unfinished)")
49         parser.add_option("-r", "--print", action="store", type="string", dest="printfile", help="Open the printing interface, instead of the normal cura interface.")
50         parser.add_option("-p", "--profile", action="store", type="string", dest="profile", help="Internal option, do not use!")
51         parser.add_option("-s", "--slice", action="store_true", dest="slice", help="Slice the given files instead of opening them in Cura")
52         (options, args) = parser.parse_args()
53         if options.profile != None:
54                 profile.loadGlobalProfileFromString(options.profile)
55         if options.profileini != None:
56                 profile.loadGlobalProfile(options.profileini)
57         if options.openprojectplanner != None:
58                 from gui import projectPlanner
59                 projectPlanner.main()
60                 return
61         if options.openflatslicer != None:
62                 from gui import flatSlicerWindow
63                 flatSlicerWindow.main()
64                 return
65         if options.printfile != None:
66                 from gui import printWindow
67                 printWindow.startPrintInterface(options.printfile)
68                 return
69
70         if options.slice != None:
71                 from util import sliceRun
72                 sliceRun.runSlice(args)
73         else:
74                 if len(args) > 0:
75                         profile.putPreference('lastFile', ';'.join(args))
76                 from gui import splashScreen
77                 splashScreen.showSplash(mainWindowRunCallback)
78
79 def mainWindowRunCallback():
80         from gui import mainWindow
81         mainWindow.main()
82
83 if __name__ == '__main__':
84         main()
85