chiark / gitweb /
Add uppercase STL and HEX to file dialog filters for linux/MacOS
[cura.git] / Cura / skeinforge_application / skeinforge_plugins / analyze.py
1 """
2 This page is in the table of contents.
3 Analyze is a script to access the plugins which analyze a gcode file.
4
5 The plugin buttons which are commonly used are bolded and the ones which are rarely used have normal font weight.
6
7 ==Gcodes==
8 An explanation of the gcodes is at:
9 http://reprap.org/bin/view/Main/Arduino_GCode_Interpreter
10
11 and at:
12 http://reprap.org/bin/view/Main/MCodeReference
13
14 A gode example is at:
15 http://forums.reprap.org/file.php?12,file=565
16
17 """
18
19 from __future__ import absolute_import
20 #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
21 import __init__
22
23 from fabmetheus_utilities import archive
24 from fabmetheus_utilities import settings
25 from skeinforge_application.skeinforge_utilities import skeinforge_analyze
26 import sys
27
28
29 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
30 __date__ = '$Date: 2008/21/04 $'
31 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
32
33
34 def addToMenu(master, menu, repository, window):
35         "Add a tool plugin menu."
36         analyzeFilePath = archive.getSkeinforgePluginsPath('analyze.py')
37         pluginsDirectoryPath = skeinforge_analyze.getPluginsDirectoryPath()
38         settings.addPluginsParentToMenu(pluginsDirectoryPath, menu, analyzeFilePath, skeinforge_analyze.getPluginFileNames())
39
40 def getNewRepository():
41         'Get new repository.'
42         return skeinforge_analyze.AnalyzeRepository()
43
44 def writeOutput(fileName):
45         "Analyze a gcode file."
46         repository = getNewRepository()
47         repository.fileNameInput.value = fileName
48         repository.execute()
49         settings.startMainLoopFromConstructor(repository)
50
51
52 def main():
53         "Display the analyze dialog."
54         if len(sys.argv) > 1:
55                 writeOutput(' '.join(sys.argv[1 :]))
56         else:
57                 settings.startMainLoopFromConstructor(getNewRepository())
58
59 if __name__ == "__main__":
60         main()