- made sure that the GCode Editor does not have a misleading Cancel option when closing the tab
- made sure that some other part of the program outputs the log messages to the Tcl Shell if the Verbose Log options is set in Preferences
This commit is contained in:
@@ -61,7 +61,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
feedrate=3.0, feedrate_rapid=3.0, z_cut=-0.002, tooldia=0.0,
|
||||
spindlespeed=None):
|
||||
|
||||
log.debug("Creating CNCJob object...")
|
||||
self.app.log.debug("Creating CNCJob object...")
|
||||
|
||||
self.decimals = self.app.decimals
|
||||
|
||||
@@ -956,7 +956,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
except (ObjectDeleted, AttributeError):
|
||||
self.probing_shapes.clear(update=True)
|
||||
except Exception as e:
|
||||
log.debug("CNCJobObject.plot_probing_geo() --> %s" % str(e))
|
||||
self.app.log.debug("CNCJobObject.plot_probing_geo() --> %s" % str(e))
|
||||
else:
|
||||
self.probing_shapes.clear(update=True)
|
||||
|
||||
@@ -977,7 +977,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
pts_union = MultiPoint(pts)
|
||||
voronoi_union = voronoi_diagram(geom=pts_union, envelope=env)
|
||||
except Exception as e:
|
||||
log.debug("CNCJobObject.generate_voronoi_geometry() --> %s" % str(e))
|
||||
self.app.log.debug("CNCJobObject.generate_voronoi_geometry() --> %s" % str(e))
|
||||
for pt_index in range(len(pts)):
|
||||
new_pts[pt_index] = affinity.translate(
|
||||
new_pts[pt_index], random.random() * 1e-09, random.random() * 1e-09)
|
||||
@@ -1419,7 +1419,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
try:
|
||||
self.app.inform_shell.emit('\t\t\t: ' + line.decode('utf-8').strip().upper())
|
||||
except Exception as e:
|
||||
log.debug("CNCJobObject.send_grbl_command() --> %s" % str(e))
|
||||
self.app.log.debug("CNCJobObject.send_grbl_command() --> %s" % str(e))
|
||||
if 'ok' in line:
|
||||
result = grbl_out
|
||||
|
||||
@@ -1442,7 +1442,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
try:
|
||||
self.app.inform_shell.emit(' : ' + line.decode('utf-8').strip().upper())
|
||||
except Exception as e:
|
||||
log.debug("CNCJobObject.send_grbl_block() --> %s" % str(e))
|
||||
self.app.log.debug("CNCJobObject.send_grbl_block() --> %s" % str(e))
|
||||
|
||||
def on_grbl_get_parameter(self, param):
|
||||
if '$' in param:
|
||||
@@ -1607,7 +1607,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
# do nothing here because the Probing GCode for GRBL is obtained differently
|
||||
return
|
||||
else:
|
||||
log.debug("CNCJobObject.probing_gcode() -> controller not supported")
|
||||
self.app.log.debug("CNCJobObject.probing_gcode() -> controller not supported")
|
||||
return
|
||||
|
||||
# #############################################################################################################
|
||||
@@ -1730,7 +1730,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
try:
|
||||
self.gcode_viewer_tab.load_text(gco, move_to_start=True, clear_text=True)
|
||||
except Exception as e:
|
||||
log.debug('FlatCAMCNCJob.on_edit_probing_gcode() -->%s' % str(e))
|
||||
self.app.log.debug('FlatCAMCNCJob.on_edit_probing_gcode() -->%s' % str(e))
|
||||
return
|
||||
|
||||
self.gcode_viewer_tab.t_frame.show()
|
||||
@@ -1794,7 +1794,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
else:
|
||||
return
|
||||
except IOError:
|
||||
log.error("Failed to open height map file: %s" % filename)
|
||||
self.app.log.error("Failed to open height map file: %s" % filename)
|
||||
self.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Failed to open height map file"), filename))
|
||||
return
|
||||
|
||||
@@ -2049,7 +2049,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
# self.gcode_editor_tab.load_text(self.app.gcode_edited.getvalue(), move_to_start=True, clear_text=True)
|
||||
self.gcode_editor_tab.load_text(self.app.gcode_edited, move_to_start=True, clear_text=True)
|
||||
except Exception as e:
|
||||
log.debug('FlatCAMCNCJob.on_review_code_click() -->%s' % str(e))
|
||||
self.app.log.debug('FlatCAMCNCJob.on_review_code_click() -->%s' % str(e))
|
||||
return
|
||||
|
||||
self.gcode_editor_tab.t_frame.show()
|
||||
@@ -2090,7 +2090,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
:return: A string with a GCode header
|
||||
"""
|
||||
|
||||
log.debug("FlatCAMCNCJob.gcode_header()")
|
||||
self.app.log.debug("FlatCAMCNCJob.gcode_header()")
|
||||
time_str = "{:%A, %d %B %Y at %H:%M}".format(datetime.now())
|
||||
marlin = False
|
||||
hpgl = False
|
||||
@@ -2113,21 +2113,21 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
probe_pp = True
|
||||
break
|
||||
except KeyError:
|
||||
# log.debug("FlatCAMCNCJob.gcode_header() error: --> %s" % str(e))
|
||||
# self.app.log.debug("FlatCAMCNCJob.gcode_header() error: --> %s" % str(e))
|
||||
pass
|
||||
|
||||
try:
|
||||
if 'marlin' in self.options['ppname_e'].lower() or 'repetier' in self.options['ppname_e'].lower():
|
||||
marlin = True
|
||||
except KeyError:
|
||||
# log.debug("FlatCAMCNCJob.gcode_header(): --> There is no such self.option: %s" % str(e))
|
||||
# self.app.log.debug("FlatCAMCNCJob.gcode_header(): --> There is no such self.option: %s" % str(e))
|
||||
pass
|
||||
|
||||
try:
|
||||
if "toolchange_probe" in self.options['ppname_e'].lower():
|
||||
probe_pp = True
|
||||
except KeyError:
|
||||
# log.debug("FlatCAMCNCJob.gcode_header(): --> There is no such self.option: %s" % str(e))
|
||||
# self.app.log.debug("FlatCAMCNCJob.gcode_header(): --> There is no such self.option: %s" % str(e))
|
||||
pass
|
||||
|
||||
if marlin is True:
|
||||
|
||||
@@ -119,7 +119,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
|
||||
"""
|
||||
FlatCAMObj.set_ui(self, ui)
|
||||
|
||||
log.debug("ExcellonObject.set_ui()")
|
||||
self.app.log.debug("ExcellonObject.set_ui()")
|
||||
|
||||
self.units = self.app.defaults['units'].upper()
|
||||
|
||||
@@ -730,7 +730,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
|
||||
excellon_code += "X{xform}Y{yform}\n".format(xform=exc_x_formatted,
|
||||
yform=exc_y_formatted)
|
||||
except Exception as e:
|
||||
log.debug(str(e))
|
||||
self.app.log.debug('ExcellonObject.export_excellon() drills -> %s' % str(e))
|
||||
|
||||
# slots processing
|
||||
try:
|
||||
@@ -830,10 +830,10 @@ class ExcellonObject(FlatCAMObj, Excellon):
|
||||
xstop=stop_slot_x_formatted, ystop=stop_slot_y_formatted
|
||||
)
|
||||
except Exception as e:
|
||||
log.debug(str(e))
|
||||
self.app.log.debug('ExcellonObject.export_excellon() slots -> %s' % str(e))
|
||||
|
||||
if not has_drills and not has_slots:
|
||||
log.debug("FlatCAMObj.ExcellonObject.export_excellon() --> Excellon Object is empty: no drills, no slots.")
|
||||
self.app.log.debug("ExcellonObject.export_excellon() --> Excellon Object is empty: no drills, no slots.")
|
||||
return 'fail'
|
||||
|
||||
return slots_in_file, excellon_code
|
||||
@@ -882,7 +882,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
|
||||
|
||||
if tools == "all":
|
||||
tools = [i[0] for i in sorted_tools] # List if ordered tool names.
|
||||
log.debug("Tools 'all' and sorted are: %s" % str(tools))
|
||||
self.app.log.debug("Tools 'all' and sorted are: %s" % str(tools))
|
||||
|
||||
if len(tools) == 0:
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Please select one or more tools from the list and try again."))
|
||||
@@ -990,7 +990,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
|
||||
|
||||
if tools == "all":
|
||||
tools = [i[0] for i in sorted_tools] # List if ordered tool names.
|
||||
log.debug("Tools 'all' and sorted are: %s" % str(tools))
|
||||
self.app.log.debug("Tools 'all' and sorted are: %s" % str(tools))
|
||||
|
||||
if len(tools) == 0:
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Please select one or more tools from the list and try again."))
|
||||
@@ -1074,7 +1074,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
|
||||
self.generate_milling_slots(use_thread=False, plot=True)
|
||||
|
||||
def convert_units(self, units):
|
||||
log.debug("FlatCAMObj.ExcellonObject.convert_units()")
|
||||
self.app.log.debug("ExcellonObject.convert_units()")
|
||||
|
||||
Excellon.convert_units(self, units)
|
||||
|
||||
@@ -1233,7 +1233,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
|
||||
|
||||
self.shapes.redraw()
|
||||
except (ObjectDeleted, AttributeError) as e:
|
||||
log.debug("ExcellonObject.plot() -> %s" % str(e))
|
||||
self.app.log.debug("ExcellonObject.plot() -> %s" % str(e))
|
||||
self.shapes.clear(update=True)
|
||||
|
||||
if multicolored:
|
||||
|
||||
@@ -99,7 +99,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
tools_diameters = [eval(a) for a in tools_string if a != '']
|
||||
self.options["tools_mill_tooldia"] = tools_diameters[0] if tools_diameters else 0.0
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMObj.GeometryObject.init() --> %s" % str(e))
|
||||
self.app.log.debug("FlatCAMObj.GeometryObject.init() --> %s" % str(e))
|
||||
|
||||
self.options["startz"] = self.app.defaults["geometry_startz"]
|
||||
|
||||
@@ -319,7 +319,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
# self.update_ui()
|
||||
except Exception as e:
|
||||
# when the tools table is empty there will be this error but once the table is populated it will go away
|
||||
log.debug(str(e))
|
||||
self.app.log.debug('GeometryObject.build_ui() -> %s' % str(e))
|
||||
|
||||
# disable the Plot column in Tool Table if the geometry is SingleGeo as it is not needed
|
||||
# and can create some problems
|
||||
@@ -423,7 +423,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
# this one adds the 'name' key and the self.ui.name_entry widget in the self.form_fields dict
|
||||
FlatCAMObj.set_ui(self, ui)
|
||||
|
||||
log.debug("GeometryObject.set_ui()")
|
||||
self.app.log.debug("GeometryObject.set_ui()")
|
||||
|
||||
assert isinstance(self.ui, GeometryObjectUI), \
|
||||
"Expected a GeometryObjectUI, got %s" % type(self.ui)
|
||||
@@ -539,8 +539,8 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
float(eval(dia)) for dia in temp_tools if dia != ''
|
||||
]
|
||||
except Exception as e:
|
||||
log.error("GeometryObject.set_ui() -> At least one tool diameter needed. "
|
||||
"Verify in Edit -> Preferences -> Geometry General -> Tool dia. %s" % str(e))
|
||||
self.app.log.error("GeometryObject.set_ui() -> At least one tool diameter needed. "
|
||||
"Verify in Edit -> Preferences -> Geometry General -> Tool dia. %s" % str(e))
|
||||
return
|
||||
|
||||
self.tooluid += 1
|
||||
@@ -583,7 +583,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
# self.old_toolchangeg_state = self.default_data['toolchange']
|
||||
|
||||
if not isinstance(self.ui, GeometryObjectUI):
|
||||
log.debug("Expected a GeometryObjectUI, got %s" % type(self.ui))
|
||||
self.app.log.debug("Expected a GeometryObjectUI, got %s" % type(self.ui))
|
||||
return
|
||||
|
||||
# #############################################################################################################
|
||||
@@ -810,7 +810,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
self.ui.tool_offset_entry.hide()
|
||||
self.ui.tool_offset_lbl.hide()
|
||||
except Exception as e:
|
||||
log.debug("set_tool_offset_visibility() --> " + str(e))
|
||||
self.app.log.debug("set_tool_offset_visibility() --> " + str(e))
|
||||
return
|
||||
|
||||
def on_offset_value_edited(self):
|
||||
@@ -1085,7 +1085,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
self.ui_connect()
|
||||
return
|
||||
except Exception as e:
|
||||
log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e))
|
||||
self.app.log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e))
|
||||
self.ui_connect()
|
||||
return
|
||||
|
||||
@@ -1111,7 +1111,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
self.ui_connect()
|
||||
return
|
||||
except Exception as e:
|
||||
log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e))
|
||||
self.app.log.debug("Tool missing. Add a tool in Geo Tool Table. %s" % str(e))
|
||||
self.ui_connect()
|
||||
return
|
||||
|
||||
@@ -1128,7 +1128,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
self.ui_connect()
|
||||
return
|
||||
except Exception as e:
|
||||
log.debug("Tool missing in ui_update_v_shape(). Add a tool in Geo Tool Table. %s" % str(e))
|
||||
self.app.log.debug("Tool missing in ui_update_v_shape(). Add a tool in Geo Tool Table. %s" % str(e))
|
||||
return
|
||||
|
||||
# #########################################################################################################
|
||||
@@ -1149,12 +1149,12 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
if key == 'tool_type' and value == 'V':
|
||||
self.on_update_cutz()
|
||||
except Exception as e:
|
||||
log.debug("GeometryObject.update_ui() -> %s " % str(e))
|
||||
self.app.log.debug("GeometryObject.update_ui() -> %s " % str(e))
|
||||
|
||||
self.ui_connect()
|
||||
|
||||
def on_tool_add(self, clicked_state, dia=None, new_geo=None):
|
||||
log.debug("GeometryObject.on_add_tool()")
|
||||
self.app.log.debug("GeometryObject.on_add_tool()")
|
||||
|
||||
self.ui_disconnect()
|
||||
|
||||
@@ -1473,7 +1473,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
self.builduiSig.emit()
|
||||
return
|
||||
except Exception as e:
|
||||
log.debug("on_tool_copy() --> " + str(e))
|
||||
self.app.log.debug("on_tool_copy() --> " + str(e))
|
||||
# deselect the table
|
||||
# self.ui.geo_tools_table.clearSelection()
|
||||
else:
|
||||
@@ -1490,7 +1490,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
self.tools[int(max_uid)] = deepcopy(temp_tools[tooluid])
|
||||
temp_tools.clear()
|
||||
except Exception as e:
|
||||
log.debug("on_tool_copy() --> " + str(e))
|
||||
self.app.log.debug("on_tool_copy() --> " + str(e))
|
||||
|
||||
# if there are no more tools in geo tools table then hide the tool offset
|
||||
if not self.tools:
|
||||
@@ -1574,7 +1574,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
self.builduiSig.emit()
|
||||
return
|
||||
except Exception as e:
|
||||
log.debug("on_tool_delete() --> " + str(e))
|
||||
self.app.log.debug("on_tool_delete() --> " + str(e))
|
||||
# deselect the table
|
||||
# self.ui.geo_tools_table.clearSelection()
|
||||
else:
|
||||
@@ -1752,7 +1752,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
try:
|
||||
self.form_fields[form_key].set_value(dict_storage[form_key])
|
||||
except Exception as e:
|
||||
log.debug(str(e))
|
||||
self.app.log.debug('GeometryObject.update_form() -> %s' % str(e))
|
||||
|
||||
# this is done here because those buttons control through OptionalInputSelection if some entry's are Enabled
|
||||
# or not. But due of using the ui_disconnect() status is no longer updated and I had to do it here
|
||||
@@ -1763,7 +1763,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
def on_apply_param_to_all_clicked(self):
|
||||
if self.ui.geo_tools_table.rowCount() == 0:
|
||||
# there is no tool in tool table so we can't save the GUI elements values to storage
|
||||
log.debug("GeometryObject.gui_form_to_storage() --> no tool in Tools Table, aborting.")
|
||||
self.app.log.debug("GeometryObject.gui_form_to_storage() --> no tool in Tools Table, aborting.")
|
||||
return
|
||||
|
||||
self.ui_disconnect()
|
||||
@@ -1828,7 +1828,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
|
||||
if self.ui.geo_tools_table.rowCount() == 0:
|
||||
# there is no tool in tool table so we can't save the GUI elements values to storage
|
||||
log.debug("GeometryObject.gui_form_to_storage() --> no tool in Tools Table, aborting.")
|
||||
self.app.log.debug("GeometryObject.gui_form_to_storage() --> no tool in Tools Table, aborting.")
|
||||
return
|
||||
|
||||
widget_changed = self.sender()
|
||||
@@ -1838,7 +1838,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
if widget_idx == 1 or widget_idx == 3:
|
||||
self.on_update_cutz()
|
||||
except Exception as e:
|
||||
log.debug("GeometryObject.gui_form_to_storage() -- wdg index -> %s" % str(e))
|
||||
self.app.log.debug("GeometryObject.gui_form_to_storage() -- wdg index -> %s" % str(e))
|
||||
|
||||
# the original connect() function of the OptionalInputSelection is no longer working because of the
|
||||
# ui_diconnect() so I use this 'hack'
|
||||
@@ -1969,7 +1969,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
# points = GeometryObject.get_pts(geo)
|
||||
# msp.add_lwpolyline(points)
|
||||
except Exception as e:
|
||||
log.debug(str(e))
|
||||
self.app.log.debug(str(e))
|
||||
|
||||
return dwg
|
||||
|
||||
@@ -2130,7 +2130,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
# pass
|
||||
|
||||
def on_generatecnc_button_click(self):
|
||||
log.debug("Generating CNCJob from Geometry ...")
|
||||
self.app.log.debug("Generating CNCJob from Geometry ...")
|
||||
self.app.defaults.report_usage("geometry_on_generatecnc_button")
|
||||
|
||||
# this reads the values in the UI form to the self.options dictionary
|
||||
@@ -2214,7 +2214,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
xmax = self.options['xmax']
|
||||
ymax = self.options['ymax']
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMObj.GeometryObject.mtool_gen_cncjob() --> %s\n" % str(e))
|
||||
self.app.log.debug("FlatCAMObj.GeometryObject.mtool_gen_cncjob() --> %s\n" % str(e))
|
||||
|
||||
msg = '[ERROR] %s' % _("An internal error has occurred. See shell.\n")
|
||||
msg += '%s' % str(e)
|
||||
@@ -2228,7 +2228,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
# Object initialization function for app.app_obj.new_object()
|
||||
# RUNNING ON SEPARATE THREAD!
|
||||
def job_init_single_geometry(job_obj, app_obj):
|
||||
log.debug("Creating a CNCJob out of a single-geometry")
|
||||
self.app.log.debug("Creating a CNCJob out of a single-geometry")
|
||||
assert job_obj.kind == 'cncjob', "Initializer expected a CNCJobObject, got %s" % type(job_obj)
|
||||
|
||||
job_obj.options['xmin'] = xmin
|
||||
@@ -2341,7 +2341,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
tool_no=tool_cnt, is_first=is_first)
|
||||
|
||||
if res == 'fail':
|
||||
log.debug("GeometryObject.mtool_gen_cncjob() --> generate_from_geometry2() failed")
|
||||
self.app.log.debug("GeometryObject.mtool_gen_cncjob() --> generate_from_geometry2() failed")
|
||||
return 'fail'
|
||||
|
||||
dia_cnc_dict['gcode'] = res
|
||||
@@ -2377,7 +2377,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
# Object initialization function for app.app_obj.new_object()
|
||||
# RUNNING ON SEPARATE THREAD!
|
||||
def job_init_multi_geometry(job_obj, app_obj):
|
||||
log.debug("Creating a CNCJob out of a multi-geometry")
|
||||
self.app.log.debug("Creating a CNCJob out of a multi-geometry")
|
||||
assert job_obj.kind == 'cncjob', "Initializer expected a CNCJobObject, got %s" % type(job_obj)
|
||||
|
||||
job_obj.options['xmin'] = xmin
|
||||
@@ -2496,7 +2496,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
is_first=is_first, is_last=is_last,
|
||||
toolchange=True)
|
||||
if res == 'fail':
|
||||
log.debug("GeometryObject.mtool_gen_cncjob() --> generate_from_geometry2() failed")
|
||||
self.app.log.debug("GeometryObject.mtool_gen_cncjob() --> generate_from_geometry2() failed")
|
||||
return 'fail'
|
||||
else:
|
||||
dia_cnc_dict['gcode'] = res
|
||||
@@ -2784,7 +2784,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
except grace:
|
||||
return "fail"
|
||||
except Exception as e:
|
||||
log.debug("Could not Paint the polygons. %s" % str(e))
|
||||
self.app.log.debug("Could not Paint the polygons. %s" % str(e))
|
||||
mssg = '[ERROR] %s\n%s' % (_("Could not do Paint. Try a different combination of parameters. "
|
||||
"Or a different method of Paint"), str(e))
|
||||
self.app.inform.emit(mssg)
|
||||
@@ -2810,7 +2810,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
log.debug("FlatCAMObj.GeometryObject.scale()")
|
||||
self.app.log.debug("FlatCAMObj.GeometryObject.scale()")
|
||||
|
||||
try:
|
||||
xfactor = float(xfactor)
|
||||
@@ -2898,7 +2898,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
log.debug("FlatCAMObj.GeometryObject.offset()")
|
||||
self.app.log.debug("FlatCAMObj.GeometryObject.offset()")
|
||||
|
||||
try:
|
||||
dx, dy = vect
|
||||
@@ -2963,7 +2963,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
self.app.inform.emit('[success] %s' % _("Done."))
|
||||
|
||||
def convert_units(self, units):
|
||||
log.debug("FlatCAMObj.GeometryObject.convert_units()")
|
||||
self.app.log.debug("FlatCAMObj.GeometryObject.convert_units()")
|
||||
|
||||
self.ui_disconnect()
|
||||
|
||||
@@ -3231,7 +3231,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
if not self.app.exc_areas.exclusion_areas_storage:
|
||||
self.app.exc_areas.clear_shapes()
|
||||
except Exception as err:
|
||||
log.debug('GeometryObject.area_disconnect() -> %s' % str(err))
|
||||
self.app.log.debug('GeometryObject.area_disconnect() -> %s' % str(err))
|
||||
|
||||
def plot_element(self, element, color=None, visible=None):
|
||||
|
||||
@@ -3419,7 +3419,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
try:
|
||||
new_options[option] = deepcopy(geo_obj.options[option])
|
||||
except Exception as e:
|
||||
log.warning("Failed to copy option %s. Error: %s" % (str(option), str(e)))
|
||||
self.app.log.warning("Failed to copy option %s. Error: %s" % (str(option), str(e)))
|
||||
|
||||
# Expand lists
|
||||
if type(geo_obj) is list:
|
||||
@@ -3434,7 +3434,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
||||
try:
|
||||
new_solid_geometry += deepcopy(geo_obj.solid_geometry)
|
||||
except Exception as e:
|
||||
log.debug("GeometryObject.merge() --> %s" % str(e))
|
||||
self.app.log.debug("GeometryObject.merge() --> %s" % str(e))
|
||||
|
||||
# find the tool_uid maximum value in the geo_final
|
||||
try:
|
||||
|
||||
@@ -741,7 +741,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
try:
|
||||
geom = self.isolation_geometry(offset, geometry=geometry, iso_type=env_iso_type, passes=nr_passes)
|
||||
except Exception as e:
|
||||
log.debug('GerberObject.isolate().generate_envelope() --> %s' % str(e))
|
||||
self.app.log.debug('GerberObject.isolate().generate_envelope() --> %s' % str(e))
|
||||
return 'fail'
|
||||
|
||||
if invert:
|
||||
@@ -760,10 +760,10 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
elif isinstance(geom, LinearRing) and geom is not None:
|
||||
geom = Polygon(geom.coords[::-1])
|
||||
else:
|
||||
log.debug("GerberObject.isolate().generate_envelope() Error --> Unexpected Geometry %s" %
|
||||
self.app.log.debug("GerberObject.isolate().generate_envelope() Error --> Unexpected Geometry %s" %
|
||||
type(geom))
|
||||
except Exception as e:
|
||||
log.debug("GerberObject.isolate().generate_envelope() Error --> %s" % str(e))
|
||||
self.app.log.debug("GerberObject.isolate().generate_envelope() Error --> %s" % str(e))
|
||||
return 'fail'
|
||||
return geom
|
||||
|
||||
@@ -789,7 +789,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
float(eval(dia)) for dia in temp_tools if dia != ''
|
||||
]
|
||||
except Exception as e:
|
||||
log.error("GerberObject.follow_geo -> At least one tool diameter needed. -> %s" % str(e))
|
||||
self.app.log.error("GerberObject.follow_geo -> At least one tool diameter needed. -> %s" % str(e))
|
||||
return 'fail'
|
||||
|
||||
# Propagate options
|
||||
@@ -874,7 +874,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
self.clear_plot_apertures()
|
||||
self.mark_shapes.enabled = False
|
||||
except Exception as e:
|
||||
log.debug(" GerberObject.on_aperture_visibility_changed() --> %s" % str(e))
|
||||
self.app.log.debug(" GerberObject.on_aperture_visibility_changed() --> %s" % str(e))
|
||||
|
||||
def convert_units(self, units):
|
||||
"""
|
||||
@@ -890,10 +890,10 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
# units conversion to get a conversion should be done only once even if we found multiple
|
||||
# units declaration inside a Gerber file (it can happen to find also the obsolete declaration)
|
||||
if self.conversion_done is True:
|
||||
log.debug("Gerber units conversion cancelled. Already done.")
|
||||
self.app.log.debug("Gerber units conversion cancelled. Already done.")
|
||||
return
|
||||
|
||||
log.debug("FlatCAMObj.GerberObject.convert_units()")
|
||||
self.app.log.debug("FlatCAMObj.GerberObject.convert_units()")
|
||||
|
||||
Gerber.convert_units(self, units)
|
||||
|
||||
@@ -999,7 +999,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
except (ObjectDeleted, AttributeError):
|
||||
self.shapes.clear(update=True)
|
||||
except Exception as e:
|
||||
log.debug("GerberObject.plot() --> %s" % str(e))
|
||||
self.app.log.debug("GerberObject.plot() --> %s" % str(e))
|
||||
|
||||
# experimental plot() when the solid_geometry is stored in the self.apertures
|
||||
def plot_aperture(self, only_flashes=False, run_thread=False, **kwargs):
|
||||
@@ -1060,7 +1060,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
except (ObjectDeleted, AttributeError):
|
||||
app_obj.clear_plot_apertures()
|
||||
except Exception as e:
|
||||
log.debug("GerberObject.plot_aperture() --> %s" % str(e))
|
||||
self.app.log.debug("GerberObject.plot_aperture() --> %s" % str(e))
|
||||
|
||||
if run_thread:
|
||||
self.app.worker_task.emit({'fcn': job_thread, 'params': [self]})
|
||||
@@ -1083,7 +1083,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
try:
|
||||
self.mark_shapes.remove(shape_key)
|
||||
except Exception as e:
|
||||
log.debug("GerberObject.clear_plot_apertures() -> %s" % str(e))
|
||||
self.app.log.debug("GerberObject.clear_plot_apertures() -> %s" % str(e))
|
||||
|
||||
self.mark_shapes_storage[aperture] = []
|
||||
self.mark_shapes.redraw()
|
||||
@@ -1177,7 +1177,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
:param factor: factor to be applied onto the Gerber coordinates
|
||||
:return: Gerber_code
|
||||
"""
|
||||
log.debug("GerberObject.export_gerber() --> Generating the Gerber code from the selected Gerber file")
|
||||
self.app.log.debug("GerberObject.export_gerber() --> Generating the Gerber code from the selected Gerber file")
|
||||
|
||||
def tz_format(x, y, fac):
|
||||
x_c = x * fac
|
||||
@@ -1330,7 +1330,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
|
||||
# gerber_code += "D02*\n"
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMObj.GerberObject.export_gerber() 'follow' --> %s" % str(e))
|
||||
self.app.log.debug("FlatCAMObj.GerberObject.export_gerber() 'follow' --> %s" % str(e))
|
||||
if 'clear' in geo_elem:
|
||||
geo = geo_elem['clear']
|
||||
if not geo.is_empty:
|
||||
@@ -1364,7 +1364,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
gerber_code += 'G37*\n'
|
||||
gerber_code += '%LPD*%\n'
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMObj.GerberObject.export_gerber() '0' aperture --> %s" % str(e))
|
||||
self.app.log.debug("FlatCAMObj.GerberObject.export_gerber() '0' aperture --> %s" % str(e))
|
||||
|
||||
for apid in self.apertures:
|
||||
if apid == '0':
|
||||
@@ -1415,7 +1415,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
|
||||
# gerber_code += "D02*\n"
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMObj.GerberObject.export_gerber() 'follow' --> %s" % str(e))
|
||||
self.app.log.debug("FlatCAMObj.GerberObject.export_gerber() 'follow' --> %s" % str(e))
|
||||
|
||||
try:
|
||||
if 'clear' in geo_elem:
|
||||
@@ -1519,10 +1519,10 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
# gerber_code += "D02*\n"
|
||||
gerber_code += '%LPD*%\n'
|
||||
except Exception as e:
|
||||
log.debug("FlatCAMObj.GerberObject.export_gerber() 'clear' --> %s" % str(e))
|
||||
self.app.log.debug("FlatCAMObj.GerberObject.export_gerber() 'clear' --> %s" % str(e))
|
||||
|
||||
if not self.apertures:
|
||||
log.debug("FlatCAMObj.GerberObject.export_gerber() --> Gerber Object is empty: no apertures.")
|
||||
self.app.log.debug("FlatCAMObj.GerberObject.export_gerber() --> Gerber Object is empty: no apertures.")
|
||||
return 'fail'
|
||||
|
||||
return gerber_code
|
||||
@@ -1560,7 +1560,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
||||
try:
|
||||
grb_final.options[option] = grb.options[option]
|
||||
except KeyError:
|
||||
log.warning("Failed to copy option.", option)
|
||||
self.app.log.warning("Failed to copy option.", option)
|
||||
|
||||
try:
|
||||
for geos in grb.solid_geometry:
|
||||
|
||||
Reference in New Issue
Block a user