- most of the logging (except in the Editors) is now done by the AppLogging class

This commit is contained in:
Marius Stanciu
2022-01-31 02:14:14 +02:00
committed by Marius
parent fa25644f8f
commit 056ff05e29
39 changed files with 373 additions and 371 deletions

View File

@@ -1486,7 +1486,7 @@ class Gerber(Geometry):
# Flash should not happen here
if current_operation_code == 3:
log.error("Trying to flash within arc. (%d)" % line_num)
self.app.log.error("Trying to flash within arc. (%d)" % line_num)
continue
if quadrant_mode == 'MULTI':
@@ -1531,7 +1531,7 @@ class Gerber(Geometry):
]
valid = False
log.debug("I: %f J: %f" % (i, j))
# self.app.log.debug("I: %f J: %f" % (i, j))
for center in center_candidates:
radius = np.sqrt(i ** 2 + j ** 2)
@@ -1547,14 +1547,14 @@ class Gerber(Geometry):
start = np.arctan2(-j, -i) # Start angle
stop = np.arctan2(-center[1] + circular_y, -center[0] + circular_x) # Stop angle
angle = abs(arc_angle(start, stop, arcdir[current_interpolation_mode]))
log.debug("ARC START: %f, %f CENTER: %f, %f STOP: %f, %f" %
(current_x, current_y, center[0], center[1], circular_x, circular_y))
log.debug("START Ang: %f, STOP Ang: %f, DIR: %s, ABS: %.12f <= %.12f: %s" %
(start * 180 / np.pi, stop * 180 / np.pi, arcdir[current_interpolation_mode],
angle * 180 / np.pi, np.pi / 2 * 180 / np.pi, angle <= (np.pi + 1e-6) / 2))
# self.app.log.debug("ARC START: %f, %f CENTER: %f, %f STOP: %f, %f" %
# (current_x, current_y, center[0], center[1], circular_x, circular_y))
# self.app.log.debug("START Ang: %f, STOP Ang: %f, DIR: %s, ABS: %.12f <= %.12f: %s" %
# (start * 180 / np.pi, stop * 180 / np.pi, arcdir[current_interpolation_mode],
# angle * 180 / np.pi, np.pi / 2 * 180 / np.pi, angle <= (np.pi + 1e-6) / 2))
if angle <= (np.pi + 1e-6) / 2:
log.debug("########## ACCEPTING ARC ############")
# self.app.log.debug("########## ACCEPTING ARC ############")
this_arc = arc(center, radius, start, stop,
arcdir[current_interpolation_mode],
self.steps_per_circle)
@@ -1744,8 +1744,7 @@ class Gerber(Geometry):
if is_excellon_gx2 is True:
return 'drill'
@staticmethod
def create_flash_geometry(location, aperture, steps_per_circle=None):
def create_flash_geometry(self, location, aperture, steps_per_circle=None):
# self.app.log.debug('Flashing @%s, Aperture: %s' % (location, aperture))
@@ -1799,10 +1798,10 @@ class Gerber(Geometry):
loc = location.coords[0]
flash_geo = aperture['macro'].make_geometry(aperture['modifiers'])
if flash_geo.is_empty:
log.warning("Empty geometry for Aperture Macro: %s" % str(aperture['macro'].name))
self.app.log.warning("Empty geometry for Aperture Macro: %s" % str(aperture['macro'].name))
return affinity.translate(flash_geo, xoff=loc[0], yoff=loc[1])
log.warning("Unknown aperture type: %s" % aperture['type'])
self.app.log.warning("Unknown aperture type: %s" % aperture['type'])
return None
def create_geometry(self):

View File

@@ -217,7 +217,7 @@ class HPGL2:
# ###################
match = self.comment_re.search(gline)
if match:
log.debug(str(match.group(1)))
self.app.log.debug(str(match.group(1)))
continue
# search for the initialization
@@ -410,13 +410,13 @@ class HPGL2:
continue
# ## Line did not match any pattern. Warn user.
log.warning("Line ignored (%d): %s" % (line_num, gline))
self.app.log.warning("Line ignored (%d): %s" % (line_num, gline))
if not geo_buffer and not self.solid_geometry:
log.error("Object is not HPGL2 file or empty. Aborting Object creation.")
self.app.log.error("Object is not HPGL2 file or empty. Aborting Object creation.")
return 'fail'
log.warning("Joining %d polygons." % len(geo_buffer))
self.app.log.warning("Joining %d polygons." % len(geo_buffer))
self.app.inform.emit('%s: %d.' % (_("Gerber processing. Joining polygons"), len(geo_buffer)))
new_poly = unary_union(geo_buffer)
@@ -427,7 +427,7 @@ class HPGL2:
traceback.print_tb(tb)
print(traceback.format_exc())
log.error("HPGL2 PARSING FAILED. Line %d: %s" % (line_num, gline))
self.app.log.error("HPGL2 PARSING FAILED. Line %d: %s" % (line_num, gline))
loc = '%s #%d %s: %s\n' % (_("HPGL2 Line"), line_num, _("HPGL2 Line Content"), gline) + repr(err)
self.app.inform.emit('[ERROR] %s\n%s:' % (_("HPGL2 Parser ERROR"), loc))