Package theia :: Package helpers :: Module interaction
[hide private]
[frames] | no frames]

Source Code for Module theia.helpers.interaction

 1  '''Module to define interaction functions for theia.''' 
 2   
 3  # Provides: 
 4  #       usage 
 5  #       lhelp 
 6  #   shelp 
 7  #       welcome 
 8  #       errorRecursion 
 9  #       errorAtSpecifiedLocation 
10  #       errorWhereIs 
11  #   errorWhereIsNotFound 
12  #       errorUnknown 
13   
14  usage = "Usage: theia [options] FNAME\n\nArguments:\n"\ 
15          + "  FNAME\t\t .tia format input file name." 
16   
17  lhelp = "specify the FreeCAD library location. If none is specified, theia "\ 
18                  + "finds it using the Unix `whereis` command. If option '-c', "\ 
19                  + "'--no-CAD'  is used, the FreeCAD search and import are skipped "\ 
20                  + "as a whole." 
21   
22  shelp = 'Exclude beams propagating inside optics from text output, terminal'\ 
23          + ' output and CAD rendering files. This also changes the way beams'\ 
24          + ' are referenced to in these files and in the terminal output.' 
25   
26  welcome = u''' 
27  \ttheia (C) 2017 Rapha\u00EBl Duque 
28  \tLicense: GNU GPLv3+ <http://gnu.org/licenses/gpl.html> 
29  \tThis is free software: you are free to change and redistribute it. 
30  \tThere is ABSOLUTELY NO WARRANTY, to the extent permitted by law. 
31  ''' 
32   
33  errorRecursion = ''' 
34   
35  It looks like you reached the maximum recursion depth of your Python 
36  implementation (generally around 1000). The beam tracer builds the beam tree 
37  recursively and in your case the recursion went to far. The order and threshold 
38  simulation parameters were made to prevent this situation. What you can do: 
39   
40  \t1. Make sure you're running with reasonable order and threshold parameters, 
41  \t2. Increase the maximum recursion depth of your Python environment by placing 
42  \t   `sys.setrecursionlimit([whatever you need])`, 
43  \t   right under the `"if __name__ == '__main__'` line in bin/theia, rebuild 
44  \t   theia with `make build-theia` in the project root and rerun your simulation; 
45  \t3. Contact your local administrator to increase the maximum recursion depth 
46  \t   on a system-wide basis and rerun your simulation. 
47  ''' 
48   
49  errorAtSpecifiedLocation = "theia: Error: The FreeCAD library was not found "\ 
50          + "at the specified location %s. Usually it is in /usr/lib/freecad/lib. "\ 
51          + "If you are not sure, omit the '-l', '--FREECAD-lib' option and theia "\ 
52          + "will find the library on its own.\nAborting." 
53   
54  errorWhereIs = "theia: Error: Unix command 'whereis freecad' did not yield "\ 
55          + "any directory. Please make sure you have FreeCAD installed and that "\ 
56          + "library location is in your $PATH.\nAborting" 
57   
58  errorWhereIsNotFound = "theia: Error: It seems that the Unix utility "\ 
59      + "`whereis ` is not installed, thus theia cannot find the FreeCAD "\ 
60      + "libraries.\n"\ 
61      + "Either specify their location with the '-l, --FreeCAD-libs' option, "\ 
62      + "or use the '-c --no-CAD' option to skip the CAD file writing step." 
63   
64  errorUnknown = "theia: Error: %s was used as the source directory for the "\ 
65          + "FreeCAD library but an error occured, make sure your FreeCAD build is "\ 
66          + "correct.\nAborting." 
67