Commit 52175090 authored by sumpfralle's avatar sumpfralle

adapted commandline handling to new settings structure


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@277 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 7c07e5f5
...@@ -776,7 +776,12 @@ class ProjectGui: ...@@ -776,7 +776,12 @@ class ProjectGui:
pass pass
def process_one_task(self, task_index): def process_one_task(self, task_index):
try:
task = self.task_list[task_index] task = self.task_list[task_index]
except IndexError:
# this shoudl only happen, if we were called in batch mode (command line)
print >>sys.stderr, "The given task ID (%d) does not exist. Valid values are: %s." % (task_index, range(len(self.task_list)))
return
self.generate_toolpath(task["tool"], task["process"]) self.generate_toolpath(task["tool"], task["process"])
def process_multiple_tasks(self, task_list=None): def process_multiple_tasks(self, task_list=None):
......
...@@ -23,10 +23,10 @@ if __name__ == "__main__": ...@@ -23,10 +23,10 @@ if __name__ == "__main__":
help="use the (old) Tk interface") help="use the (old) Tk interface")
parser.add_option("-c", "--config", dest="config_file", parser.add_option("-c", "--config", dest="config_file",
default=None, action="store", type="string", default=None, action="store", type="string",
help="load a file with processing settings (requires the GTK interface)") help="load a settings file (requires the GTK interface)")
parser.add_option("", "--template", dest="config_template", parser.add_option("", "--task", dest="task",
default=None, action="store", type="string", default=None, action="store", type="int",
help="enable a specific processing settings template - e.g. 'Rough', 'Semi-finish' or 'Finish' (requires the GTK interface)") help="choose a specific task from settings by number (requires the GTK interface)")
parser.add_option("", "--disable-ode", dest="ode_disabled", parser.add_option("", "--disable-ode", dest="ode_disabled",
default=False, action="store_true", help="disable experimental ODE collision detection") default=False, action="store_true", help="disable experimental ODE collision detection")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
...@@ -55,6 +55,7 @@ if __name__ == "__main__": ...@@ -55,6 +55,7 @@ if __name__ == "__main__":
if GuiCommon.check_dependencies(deps_tk): if GuiCommon.check_dependencies(deps_tk):
from pycam.Gui.SimpleGui import SimpleGui from pycam.Gui.SimpleGui import SimpleGui
gui_class = SimpleGui gui_class = SimpleGui
options.gtk_gui = False
else: else:
gui_class = None gui_class = None
else: else:
...@@ -69,6 +70,7 @@ if __name__ == "__main__": ...@@ -69,6 +70,7 @@ if __name__ == "__main__":
if GuiCommon.check_dependencies(deps_gtk): if GuiCommon.check_dependencies(deps_gtk):
from pycam.Gui.Project import ProjectGui from pycam.Gui.Project import ProjectGui
gui_class = ProjectGui gui_class = ProjectGui
options.gtk_gui = True
else: else:
gui_class = None gui_class = None
# exit if no interface is found # exit if no interface is found
...@@ -100,15 +102,19 @@ if __name__ == "__main__": ...@@ -100,15 +102,19 @@ if __name__ == "__main__":
gui.load_model(TestModel()) gui.load_model(TestModel())
else: else:
gui.open(inputfile) gui.open(inputfile)
# load processing config file # load settings file
# only available for the GTK interface # only available for the GTK interface
if options.gtk_gui: if options.gtk_gui:
if options.config_file: if options.config_file:
gui.open_processing_settings_file(options.config_file) gui.open_settings_file(options.config_file)
if options.config_template:
gui.switch_processing_config(section=options.config_template)
if outputfile and not options.display: if outputfile and not options.display:
# an output filename is given and no gui is explicitly requested # an output filename is given and no gui is explicitly requested
if options.gtk_gui:
if not options.task is None:
gui.process_one_task(options.task)
else:
gui.process_multiple_tasks()
else:
gui.generateToolpath() gui.generateToolpath()
if outputfile: if outputfile:
gui.save_toolpath(outputfile) gui.save_toolpath(outputfile)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment