Commit cbe161f9 authored by sumpfralle's avatar sumpfralle

improve defaults of configuration initialization

handle some more exceptions gracefully


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@625 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 2fb2f1a1
...@@ -116,6 +116,11 @@ def get_data_file_location(filename): ...@@ -116,6 +116,11 @@ def get_data_file_location(filename):
log.error(os.linesep.join(lines)) log.error(os.linesep.join(lines))
return None return None
def report_exception():
log.error("An unexpected exception occoured: please send the " \
+ "text below to the developers of PyCAM. Thanks a lot!\n" \
+ traceback.format_exc())
class ProjectGui: class ProjectGui:
...@@ -697,7 +702,12 @@ class ProjectGui: ...@@ -697,7 +702,12 @@ class ProjectGui:
if self.gui_is_active: if self.gui_is_active:
return return
self.gui_is_active = True self.gui_is_active = True
try:
result = func(self, *args, **kwargs) result = func(self, *args, **kwargs)
except:
# catch possible exceptions and report them
report_exception()
result = None
self.gui_is_active = False self.gui_is_active = False
while self._batch_queue: while self._batch_queue:
batch_func, batch_args, batch_kwargs = self._batch_queue[0] batch_func, batch_args, batch_kwargs = self._batch_queue[0]
...@@ -2520,9 +2530,7 @@ class ProjectGui: ...@@ -2520,9 +2530,7 @@ class ProjectGui:
toolpath = pycam.Toolpath.Generator.generate_toolpath_from_settings( toolpath = pycam.Toolpath.Generator.generate_toolpath_from_settings(
self.model, toolpath_settings, callback=draw_callback) self.model, toolpath_settings, callback=draw_callback)
except: except:
log.error("An unexpected exception occoured: please send the " \ report_exception()
+ "text below to the developers of PyCAM. Thanks a lot!\n" \
+ traceback.format_exc())
return False return False
log.info("Toolpath generation time: %f" % (time.time() - start_time)) log.info("Toolpath generation time: %f" % (time.time() - start_time))
......
...@@ -148,6 +148,13 @@ y_low: 0.0 ...@@ -148,6 +148,13 @@ y_low: 0.0
y_high: 0.0 y_high: 0.0
z_low: 0.0 z_low: 0.0
z_high: 0.0 z_high: 0.0
[TaskDefault]
name: Default
enabled: yes
tool: 0
process: 0
bounds: 0
""" """
DEFAULT_CONFIG = """ DEFAULT_CONFIG = """
......
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