chiark / gitweb /
Fix resources, imports and indentations.
[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
13 from optparse import OptionParser
14
15 from util import profile
16
17 __author__ = 'Daid'
18 __credits__ = """
19 David Braam (daid303@gmail.com)
20 Enrique Perez (perez_enrique@yahoo.com)
21 Adrian Bowyer <http://forums.reprap.org/profile.php?12,13>
22 Brendan Erwin <http://forums.reprap.org/profile.php?12,217>
23 Greenarrow <http://forums.reprap.org/profile.php?12,81>
24 Ian England <http://forums.reprap.org/profile.php?12,192>
25 John Gilmore <http://forums.reprap.org/profile.php?12,364>
26 Jonwise <http://forums.reprap.org/profile.php?12,716>
27 Kyle Corbitt <http://forums.reprap.org/profile.php?12,90>
28 Michael Duffin <http://forums.reprap.org/profile.php?12,930>
29 Marius Kintel <http://reprap.soup.io/>
30 Nophead <http://www.blogger.com/profile/12801535866788103677>
31 PJR <http://forums.reprap.org/profile.php?12,757>
32 Reece.Arnott <http://forums.reprap.org/profile.php?12,152>
33 Wade <http://forums.reprap.org/profile.php?12,489>
34 Xsainnz <http://forums.reprap.org/profile.php?12,563>
35 Zach Hoeken <http://blog.zachhoeken.com/>
36 Ilya Kulakov (kulakov.ilya@gmail.com)
37
38 Organizations:
39 Ultimaker <http://www.ultimaker.com>
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",
47                 help="Load settings from a profile ini file")
48         parser.add_option("-P", "--project", action="store_true", dest="openprojectplanner",
49                 help="Open the project planner")
50         parser.add_option("-F", "--flat", action="store_true", dest="openflatslicer",
51                 help="Open the 2D SVG slicer (unfinished)")
52         parser.add_option("-r", "--print", action="store", type="string", dest="printfile",
53                 help="Open the printing interface, instead of the normal cura interface.")
54         parser.add_option("-p", "--profile", action="store", type="string", dest="profile",
55                 help="Internal option, do not use!")
56         parser.add_option("-s", "--slice", action="store_true", dest="slice",
57                 help="Slice the given files instead of opening them in Cura")
58         (options, args) = parser.parse_args()
59         if options.profile != None:
60                 profile.loadGlobalProfileFromString(options.profile)
61         if options.profileini != None:
62                 profile.loadGlobalProfile(options.profileini)
63         if options.openprojectplanner != None:
64                 from gui import projectPlanner
65
66                 projectPlanner.main()
67                 return
68         if options.openflatslicer != None:
69                 from gui import flatSlicerWindow
70
71                 flatSlicerWindow.main()
72                 return
73         if options.printfile != None:
74                 from gui import printWindow
75
76                 printWindow.startPrintInterface(options.printfile)
77                 return
78
79         if options.slice != None:
80                 from util import sliceRun
81
82                 sliceRun.runSlice(args)
83         else:
84                 if len(args) > 0:
85                         profile.putPreference('lastFile', ';'.join(args))
86                 from gui import splashScreen
87
88                 splashScreen.showSplash(mainWindowRunCallback)
89
90
91 def mainWindowRunCallback(splash):
92         from gui import mainWindow
93
94         mainWindow.main(splash)
95
96 if __name__ == '__main__':
97         main()