- finished preparing for internationalization for the files: camlib and objectColletion

This commit is contained in:
Marius Stanciu
2019-03-08 17:04:53 +02:00
parent 4422aee5df
commit a4ae0f65ca
3 changed files with 76 additions and 76 deletions

View File

@@ -76,7 +76,7 @@ class KeySensitiveListView(QtWidgets.QTreeView):
# file drop from outside application # file drop from outside application
if drop_indicator == QtWidgets.QAbstractItemView.OnItem: if drop_indicator == QtWidgets.QAbstractItemView.OnItem:
if self.filename == "": if self.filename == "":
self.app.inform.emit("Open cancelled.") self.app.inform.emit(_tr("Open cancelled."))
else: else:
if self.filename.lower().rpartition('.')[-1] in self.app.grb_list: if self.filename.lower().rpartition('.')[-1] in self.app.grb_list:
self.app.worker_task.emit({'fcn': self.app.open_gerber, self.app.worker_task.emit({'fcn': self.app.open_gerber,
@@ -398,7 +398,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
"setData() --> Could not remove the old object name from auto-completer model list") "setData() --> Could not remove the old object name from auto-completer model list")
obj.build_ui() obj.build_ui()
self.app.inform.emit("Object renamed from %s to %s" % (old_name, new_name)) self.app.inform.emit(_tr("Object renamed from %s to %s") % (old_name, new_name))
return True return True
@@ -692,16 +692,16 @@ class ObjectCollection(QtCore.QAbstractItemModel):
obj = current.indexes()[0].internalPointer().obj obj = current.indexes()[0].internalPointer().obj
if obj.kind == 'gerber': if obj.kind == 'gerber':
self.app.inform.emit('[selected]<span style="color:%s;">%s</span> selected' % self.app.inform.emit(_tr('[selected]<span style="color:%s;">%s</span> selected') %
('green', str(obj.options['name']))) ('green', str(obj.options['name'])))
elif obj.kind == 'excellon': elif obj.kind == 'excellon':
self.app.inform.emit('[selected]<span style="color:%s;">%s</span> selected' % self.app.inform.emit(_tr('[selected]<span style="color:%s;">%s</span> selected') %
('brown', str(obj.options['name']))) ('brown', str(obj.options['name'])))
elif obj.kind == 'cncjob': elif obj.kind == 'cncjob':
self.app.inform.emit('[selected]<span style="color:%s;">%s</span> selected' % self.app.inform.emit(_tr('[selected]<span style="color:%s;">%s</span> selected') %
('blue', str(obj.options['name']))) ('blue', str(obj.options['name'])))
elif obj.kind == 'geometry': elif obj.kind == 'geometry':
self.app.inform.emit('[selected]<span style="color:%s;">%s</span> selected' % self.app.inform.emit(_tr('[selected]<span style="color:%s;">%s</span> selected') %
('red', str(obj.options['name']))) ('red', str(obj.options['name'])))
except IndexError: except IndexError:
@@ -732,7 +732,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
try: try:
a_idx.build_ui() a_idx.build_ui()
except Exception as e: except Exception as e:
self.app.inform.emit("[ERROR] Cause of error: %s" % str(e)) self.app.inform.emit(_tr("[ERROR] Cause of error: %s") % str(e))
raise raise
def get_list(self): def get_list(self):

View File

@@ -14,7 +14,7 @@ CAD program, and create G-Code for Isolation routing.
- fixed issue when doing th CTRL (or SHIFT) + LMB, the focus is automatically moved to Project Tab - fixed issue when doing th CTRL (or SHIFT) + LMB, the focus is automatically moved to Project Tab
- further work in internationalization, added a fallback to English language in case there is no translation for a string - further work in internationalization, added a fallback to English language in case there is no translation for a string
- fix for issue #262: when doing Edit-> Save & Close Editor on a Geometry that is not generated through first entering into an Editor, the geometry disappear - fix for issue #262: when doing Edit-> Save & Close Editor on a Geometry that is not generated through first entering into an Editor, the geometry disappear
- - finished preparing for internationalization for the files: camlib and objectColletion
7.03.2019 7.03.2019

136
camlib.py
View File

@@ -206,7 +206,7 @@ class Geometry(object):
if isinstance(self.solid_geometry, list): if isinstance(self.solid_geometry, list):
return len(self.solid_geometry) == 0 return len(self.solid_geometry) == 0
self.app.inform.emit("[ERROR_NOTCL] self.solid_geometry is neither BaseGeometry or list.") self.app.inform.emit(_tr("[ERROR_NOTCL] self.solid_geometry is neither BaseGeometry or list."))
return return
def subtract_polygon(self, points): def subtract_polygon(self, points):
@@ -1393,9 +1393,9 @@ class Geometry(object):
self.tools[tool]['solid_geometry'] = mirror_geom(self.tools[tool]['solid_geometry']) self.tools[tool]['solid_geometry'] = mirror_geom(self.tools[tool]['solid_geometry'])
else: else:
self.solid_geometry = mirror_geom(self.solid_geometry) self.solid_geometry = mirror_geom(self.solid_geometry)
self.app.inform.emit('[success]Object was mirrored ...') self.app.inform.emit(_tr('[success]Object was mirrored ...'))
except AttributeError: except AttributeError:
self.app.inform.emit("[ERROR_NOTCL] Failed to mirror. No object selected") self.app.inform.emit(_tr("[ERROR_NOTCL] Failed to mirror. No object selected"))
def rotate(self, angle, point): def rotate(self, angle, point):
""" """
@@ -1431,9 +1431,9 @@ class Geometry(object):
self.tools[tool]['solid_geometry'] = rotate_geom(self.tools[tool]['solid_geometry']) self.tools[tool]['solid_geometry'] = rotate_geom(self.tools[tool]['solid_geometry'])
else: else:
self.solid_geometry = rotate_geom(self.solid_geometry) self.solid_geometry = rotate_geom(self.solid_geometry)
self.app.inform.emit('[success]Object was rotated ...') self.app.inform.emit(_tr('[success]Object was rotated ...'))
except AttributeError: except AttributeError:
self.app.inform.emit("[ERROR_NOTCL] Failed to rotate. No object selected") self.app.inform.emit(_tr("[ERROR_NOTCL] Failed to rotate. No object selected"))
def skew(self, angle_x, angle_y, point): def skew(self, angle_x, angle_y, point):
""" """
@@ -1467,9 +1467,9 @@ class Geometry(object):
self.tools[tool]['solid_geometry'] = skew_geom(self.tools[tool]['solid_geometry']) self.tools[tool]['solid_geometry'] = skew_geom(self.tools[tool]['solid_geometry'])
else: else:
self.solid_geometry = skew_geom(self.solid_geometry) self.solid_geometry = skew_geom(self.solid_geometry)
self.app.inform.emit('[success]Object was skewed ...') self.app.inform.emit(_tr('[success]Object was skewed ...'))
except AttributeError: except AttributeError:
self.app.inform.emit("[ERROR_NOTCL] Failed to skew. No object selected") self.app.inform.emit(_tr("[ERROR_NOTCL] Failed to skew. No object selected"))
# if type(self.solid_geometry) == list: # if type(self.solid_geometry) == list:
# self.solid_geometry = [affinity.skew(g, angle_x, angle_y, origin=(px, py)) # self.solid_geometry = [affinity.skew(g, angle_x, angle_y, origin=(px, py))
@@ -2645,8 +2645,8 @@ class Gerber (Geometry):
pass pass
last_path_aperture = current_aperture last_path_aperture = current_aperture
else: else:
self.app.inform.emit("[WARNING] Coordinates missing, line ignored: %s" % str(gline)) self.app.inform.emit(_tr("[WARNING] Coordinates missing, line ignored: %s") % str(gline))
self.app.inform.emit("[WARNING_NOTCL] GERBER file might be CORRUPT. Check the file !!!") self.app.inform.emit(_tr("[WARNING_NOTCL] GERBER file might be CORRUPT. Check the file !!!"))
elif current_operation_code == 2: elif current_operation_code == 2:
if len(path) > 1: if len(path) > 1:
@@ -2675,9 +2675,9 @@ class Gerber (Geometry):
geo = Polygon(path) geo = Polygon(path)
except ValueError: except ValueError:
log.warning("Problem %s %s" % (gline, line_num)) log.warning("Problem %s %s" % (gline, line_num))
self.app.inform.emit("[ERROR] Region does not have enough points. " self.app.inform.emit(_tr("[ERROR] Region does not have enough points. "
"File will be processed but there are parser errors. " "File will be processed but there are parser errors. "
"Line number: %s" % str(line_num)) "Line number: %s") % str(line_num))
else: else:
if last_path_aperture is None: if last_path_aperture is None:
log.warning("No aperture defined for curent path. (%d)" % line_num) log.warning("No aperture defined for curent path. (%d)" % line_num)
@@ -2705,8 +2705,8 @@ class Gerber (Geometry):
if linear_x is not None and linear_y is not None: if linear_x is not None and linear_y is not None:
path = [[linear_x, linear_y]] # Start new path path = [[linear_x, linear_y]] # Start new path
else: else:
self.app.inform.emit("[WARNING] Coordinates missing, line ignored: %s" % str(gline)) self.app.inform.emit(_tr("[WARNING] Coordinates missing, line ignored: %s") % str(gline))
self.app.inform.emit("[WARNING_NOTCL] GERBER file might be CORRUPT. Check the file !!!") self.app.inform.emit(_tr("[WARNING_NOTCL] GERBER file might be CORRUPT. Check the file !!!"))
# Flash # Flash
# Not allowed in region mode. # Not allowed in region mode.
@@ -3029,7 +3029,7 @@ class Gerber (Geometry):
log.error("Gerber PARSING FAILED. Line %d: %s" % (line_num, gline)) log.error("Gerber PARSING FAILED. Line %d: %s" % (line_num, gline))
loc = 'Gerber Line #%d Gerber Line Content: %s\n' % (line_num, gline) + repr(err) loc = 'Gerber Line #%d Gerber Line Content: %s\n' % (line_num, gline) + repr(err)
self.app.inform.emit("[ERROR]Gerber Parser ERROR.\n%s:" % loc) self.app.inform.emit(_tr("[ERROR]Gerber Parser ERROR.\n%s:") % loc)
@staticmethod @staticmethod
def create_flash_geometry(location, aperture, steps_per_circle=None): def create_flash_geometry(location, aperture, steps_per_circle=None):
@@ -3207,7 +3207,7 @@ class Gerber (Geometry):
try: try:
xfactor = float(xfactor) xfactor = float(xfactor)
except: except:
self.app.inform.emit("[ERROR_NOTCL] Scale factor has to be a number: integer or float.") self.app.inform.emit(_tr("[ERROR_NOTCL] Scale factor has to be a number: integer or float."))
return return
if yfactor is None: if yfactor is None:
@@ -3216,7 +3216,7 @@ class Gerber (Geometry):
try: try:
yfactor = float(yfactor) yfactor = float(yfactor)
except: except:
self.app.inform.emit("[ERROR_NOTCL] Scale factor has to be a number: integer or float.") self.app.inform.emit(_tr("[ERROR_NOTCL] Scale factor has to be a number: integer or float."))
return return
if point is None: if point is None:
@@ -3245,7 +3245,7 @@ class Gerber (Geometry):
except Exception as e: except Exception as e:
log.debug('FlatCAMGeometry.scale() --> %s' % str(e)) log.debug('FlatCAMGeometry.scale() --> %s' % str(e))
self.app.inform.emit("[success]Gerber Scale done.") self.app.inform.emit(_tr("[success]Gerber Scale done."))
## solid_geometry ??? ## solid_geometry ???
@@ -3278,8 +3278,8 @@ class Gerber (Geometry):
try: try:
dx, dy = vect dx, dy = vect
except TypeError: except TypeError:
self.app.inform.emit("[ERROR_NOTCL]An (x,y) pair of values are needed. " self.app.inform.emit(_tr("[ERROR_NOTCL]An (x,y) pair of values are needed. "
"Probable you entered only one value in the Offset field.") "Probable you entered only one value in the Offset field."))
return return
def offset_geom(obj): def offset_geom(obj):
@@ -3302,7 +3302,7 @@ class Gerber (Geometry):
except Exception as e: except Exception as e:
log.debug('FlatCAMGeometry.offset() --> %s' % str(e)) log.debug('FlatCAMGeometry.offset() --> %s' % str(e))
self.app.inform.emit("[success]Gerber Offset done.") self.app.inform.emit(_tr("[success]Gerber Offset done."))
def mirror(self, axis, point): def mirror(self, axis, point):
""" """
@@ -3678,7 +3678,7 @@ class Excellon(Geometry):
# and we need to exit from here # and we need to exit from here
if self.detect_gcode_re.search(eline): if self.detect_gcode_re.search(eline):
log.warning("This is GCODE mark: %s" % eline) log.warning("This is GCODE mark: %s" % eline)
self.app.inform.emit('[ERROR_NOTCL] This is GCODE mark: %s' % eline) self.app.inform.emit(_tr('[ERROR_NOTCL] This is GCODE mark: %s') % eline)
return return
# Header Begin (M48) # # Header Begin (M48) #
@@ -4207,8 +4207,8 @@ class Excellon(Geometry):
log.info("Zeros: %s, Units %s." % (self.zeros, self.units)) log.info("Zeros: %s, Units %s." % (self.zeros, self.units))
except Exception as e: except Exception as e:
log.error("Excellon PARSING FAILED. Line %d: %s" % (line_num, eline)) log.error("Excellon PARSING FAILED. Line %d: %s" % (line_num, eline))
msg = "[ERROR_NOTCL] An internal error has ocurred. See shell.\n" msg = _tr("[ERROR_NOTCL] An internal error has ocurred. See shell.\n")
msg += '[ERROR] Excellon Parser error.\nParsing Failed. Line %d: %s\n' % (line_num, eline) msg += _tr('[ERROR] Excellon Parser error.\nParsing Failed. Line %d: %s\n') % (line_num, eline)
msg += traceback.format_exc() msg += traceback.format_exc()
self.app.inform.emit(msg) self.app.inform.emit(msg)
@@ -4285,9 +4285,9 @@ class Excellon(Geometry):
for drill in self.drills: for drill in self.drills:
# poly = drill['point'].buffer(self.tools[drill['tool']]["C"]/2.0) # poly = drill['point'].buffer(self.tools[drill['tool']]["C"]/2.0)
if drill['tool'] is '': if drill['tool'] is '':
self.app.inform.emit("[WARNING] Excellon.create_geometry() -> a drill location was skipped " self.app.inform.emit(_tr("[WARNING] Excellon.create_geometry() -> a drill location was skipped "
"due of not having a tool associated.\n" "due of not having a tool associated.\n"
"Check the resulting GCode.") "Check the resulting GCode."))
log.debug("Excellon.create_geometry() -> a drill location was skipped " log.debug("Excellon.create_geometry() -> a drill location was skipped "
"due of not having a tool associated") "due of not having a tool associated")
continue continue
@@ -4821,7 +4821,7 @@ class CNCjob(Geometry):
try: try:
value = getattr(self, command) value = getattr(self, command)
except AttributeError: except AttributeError:
self.app.inform.emit("[ERROR] There is no such parameter: %s" % str(match)) self.app.inform.emit(_tr("[ERROR] There is no such parameter: %s") % str(match))
log.debug("CNCJob.parse_custom_toolchange_code() --> AttributeError ") log.debug("CNCJob.parse_custom_toolchange_code() --> AttributeError ")
return 'fail' return 'fail'
text = text.replace(match, str(value)) text = text.replace(match, str(value))
@@ -4886,15 +4886,15 @@ class CNCjob(Geometry):
:rtype: None :rtype: None
""" """
if drillz > 0: if drillz > 0:
self.app.inform.emit("[WARNING] The Cut Z parameter has positive value. " self.app.inform.emit(_tr("[WARNING] The Cut Z parameter has positive value. "
"It is the depth value to drill into material.\n" "It is the depth value to drill into material.\n"
"The Cut Z parameter needs to have a negative value, assuming it is a typo " "The Cut Z parameter needs to have a negative value, assuming it is a typo "
"therefore the app will convert the value to negative. " "therefore the app will convert the value to negative. "
"Check the resulting CNC code (Gcode etc).") "Check the resulting CNC code (Gcode etc)."))
self.z_cut = -drillz self.z_cut = -drillz
elif drillz == 0: elif drillz == 0:
self.app.inform.emit("[WARNING] The Cut Z parameter is zero. " self.app.inform.emit(_tr("[WARNING] The Cut Z parameter is zero. "
"There will be no cut, skipping %s file" % exobj.options['name']) "There will be no cut, skipping %s file") % exobj.options['name'])
return 'fail' return 'fail'
else: else:
self.z_cut = drillz self.z_cut = drillz
@@ -4907,8 +4907,8 @@ class CNCjob(Geometry):
else: else:
self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")] self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")]
if len(self.xy_toolchange) < 2: if len(self.xy_toolchange) < 2:
self.app.inform.emit("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be " self.app.inform.emit(_tr("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be "
"in the format (x, y) \nbut now there is only one value, not two. ") "in the format (x, y) \nbut now there is only one value, not two. "))
return 'fail' return 'fail'
except Exception as e: except Exception as e:
log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> %s" % str(e)) log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> %s" % str(e))
@@ -5109,7 +5109,7 @@ class CNCjob(Geometry):
else: else:
log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> " log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> "
"The loaded Excellon file has no drills ...") "The loaded Excellon file has no drills ...")
self.app.inform.emit('[ERROR_NOTCL]The loaded Excellon file has no drills ...') self.app.inform.emit(_tr('[ERROR_NOTCL]The loaded Excellon file has no drills ...'))
return 'fail' return 'fail'
log.debug("The total travel distance with OR-TOOLS Metaheuristics is: %s" % str(measured_distance)) log.debug("The total travel distance with OR-TOOLS Metaheuristics is: %s" % str(measured_distance))
@@ -5199,12 +5199,12 @@ class CNCjob(Geometry):
else: else:
log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> " log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> "
"The loaded Excellon file has no drills ...") "The loaded Excellon file has no drills ...")
self.app.inform.emit('[ERROR_NOTCL]The loaded Excellon file has no drills ...') self.app.inform.emit(_tr('[ERROR_NOTCL]The loaded Excellon file has no drills ...'))
return 'fail' return 'fail'
log.debug("The total travel distance with OR-TOOLS Basic Algorithm is: %s" % str(measured_distance)) log.debug("The total travel distance with OR-TOOLS Basic Algorithm is: %s" % str(measured_distance))
else: else:
self.app.inform.emit("[ERROR_NOTCL] Wrong optimization type selected.") self.app.inform.emit(_tr("[ERROR_NOTCL] Wrong optimization type selected."))
return 'fail' return 'fail'
else: else:
log.debug("Using Travelling Salesman drill path optimization.") log.debug("Using Travelling Salesman drill path optimization.")
@@ -5250,7 +5250,7 @@ class CNCjob(Geometry):
else: else:
log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> " log.debug("camlib.CNCJob.generate_from_excellon_by_tool() --> "
"The loaded Excellon file has no drills ...") "The loaded Excellon file has no drills ...")
self.app.inform.emit('[ERROR_NOTCL]The loaded Excellon file has no drills ...') self.app.inform.emit(_tr('[ERROR_NOTCL]The loaded Excellon file has no drills ...'))
return 'fail' return 'fail'
log.debug("The total travel distance with Travelling Salesman Algorithm is: %s" % str(measured_distance)) log.debug("The total travel distance with Travelling Salesman Algorithm is: %s" % str(measured_distance))
@@ -5338,8 +5338,8 @@ class CNCjob(Geometry):
else: else:
self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")] self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")]
if len(self.xy_toolchange) < 2: if len(self.xy_toolchange) < 2:
self.app.inform.emit("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be " self.app.inform.emit(_tr("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be "
"in the format (x, y) \nbut now there is only one value, not two. ") "in the format (x, y) \nbut now there is only one value, not two. "))
return 'fail' return 'fail'
except Exception as e: except Exception as e:
log.debug("camlib.CNCJob.generate_from_multitool_geometry() --> %s" % str(e)) log.debug("camlib.CNCJob.generate_from_multitool_geometry() --> %s" % str(e))
@@ -5349,36 +5349,36 @@ class CNCjob(Geometry):
self.f_plunge = self.app.defaults["geometry_f_plunge"] self.f_plunge = self.app.defaults["geometry_f_plunge"]
if self.z_cut is None: if self.z_cut is None:
self.app.inform.emit("[ERROR_NOTCL] Cut_Z parameter is None or zero. Most likely a bad combinations of " self.app.inform.emit(_tr("[ERROR_NOTCL] Cut_Z parameter is None or zero. Most likely a bad combinations of "
"other parameters.") "other parameters."))
return 'fail' return 'fail'
if self.z_cut > 0: if self.z_cut > 0:
self.app.inform.emit("[WARNING] The Cut Z parameter has positive value. " self.app.inform.emit(_tr("[WARNING] The Cut Z parameter has positive value. "
"It is the depth value to cut into material.\n" "It is the depth value to cut into material.\n"
"The Cut Z parameter needs to have a negative value, assuming it is a typo " "The Cut Z parameter needs to have a negative value, assuming it is a typo "
"therefore the app will convert the value to negative." "therefore the app will convert the value to negative."
"Check the resulting CNC code (Gcode etc).") "Check the resulting CNC code (Gcode etc)."))
self.z_cut = -self.z_cut self.z_cut = -self.z_cut
elif self.z_cut == 0: elif self.z_cut == 0:
self.app.inform.emit("[WARNING] The Cut Z parameter is zero. " self.app.inform.emit(_tr("[WARNING] The Cut Z parameter is zero. "
"There will be no cut, skipping %s file" % self.options['name']) "There will be no cut, skipping %s file") % self.options['name'])
return 'fail' return 'fail'
if self.z_move is None: if self.z_move is None:
self.app.inform.emit("[ERROR_NOTCL] Travel Z parameter is None or zero.") self.app.inform.emit(_tr("[ERROR_NOTCL] Travel Z parameter is None or zero."))
return 'fail' return 'fail'
if self.z_move < 0: if self.z_move < 0:
self.app.inform.emit("[WARNING] The Travel Z parameter has negative value. " self.app.inform.emit(_tr("[WARNING] The Travel Z parameter has negative value. "
"It is the height value to travel between cuts.\n" "It is the height value to travel between cuts.\n"
"The Z Travel parameter needs to have a positive value, assuming it is a typo " "The Z Travel parameter needs to have a positive value, assuming it is a typo "
"therefore the app will convert the value to positive." "therefore the app will convert the value to positive."
"Check the resulting CNC code (Gcode etc).") "Check the resulting CNC code (Gcode etc)."))
self.z_move = -self.z_move self.z_move = -self.z_move
elif self.z_move == 0: elif self.z_move == 0:
self.app.inform.emit("[WARNING] The Z Travel parameter is zero. " self.app.inform.emit(_tr("[WARNING] The Z Travel parameter is zero. "
"This is dangerous, skipping %s file" % self.options['name']) "This is dangerous, skipping %s file") % self.options['name'])
return 'fail' return 'fail'
## Index first and last points in paths ## Index first and last points in paths
@@ -5507,14 +5507,14 @@ class CNCjob(Geometry):
""" """
if not isinstance(geometry, Geometry): if not isinstance(geometry, Geometry):
self.app.inform.emit("[ERROR]Expected a Geometry, got %s" % type(geometry)) self.app.inform.emit(_tr("[ERROR]Expected a Geometry, got %s") % type(geometry))
return 'fail' return 'fail'
log.debug("Generate_from_geometry_2()") log.debug("Generate_from_geometry_2()")
# if solid_geometry is empty raise an exception # if solid_geometry is empty raise an exception
if not geometry.solid_geometry: if not geometry.solid_geometry:
self.app.inform.emit("[ERROR_NOTCL]Trying to generate a CNC Job " self.app.inform.emit(_tr("[ERROR_NOTCL]Trying to generate a CNC Job "
"from a Geometry object without solid_geometry.") "from a Geometry object without solid_geometry."))
temp_solid_geometry = [] temp_solid_geometry = []
@@ -5552,9 +5552,9 @@ class CNCjob(Geometry):
# if the offset is less than half of the total length or less than half of the total width of the # if the offset is less than half of the total length or less than half of the total width of the
# solid geometry it's obvious we can't do the offset # solid geometry it's obvious we can't do the offset
if -offset > ((c - a) / 2) or -offset > ((d - b) / 2): if -offset > ((c - a) / 2) or -offset > ((d - b) / 2):
self.app.inform.emit("[ERROR_NOTCL]The Tool Offset value is too negative to use " self.app.inform.emit(_tr("[ERROR_NOTCL]The Tool Offset value is too negative to use "
"for the current_geometry.\n" "for the current_geometry.\n"
"Raise the value (in module) and try again.") "Raise the value (in module) and try again."))
return 'fail' return 'fail'
# hack: make offset smaller by 0.0000000001 which is insignificant difference but allow the job # hack: make offset smaller by 0.0000000001 which is insignificant difference but allow the job
# to continue # to continue
@@ -5609,8 +5609,8 @@ class CNCjob(Geometry):
else: else:
self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")] self.xy_toolchange = [float(eval(a)) for a in toolchangexy.split(",")]
if len(self.xy_toolchange) < 2: if len(self.xy_toolchange) < 2:
self.app.inform.emit("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be " self.app.inform.emit(_tr("[ERROR]The Toolchange X,Y field in Edit -> Preferences has to be "
"in the format (x, y) \nbut now there is only one value, not two. ") "in the format (x, y) \nbut now there is only one value, not two. "))
return 'fail' return 'fail'
except Exception as e: except Exception as e:
log.debug("camlib.CNCJob.generate_from_geometry_2() --> %s" % str(e)) log.debug("camlib.CNCJob.generate_from_geometry_2() --> %s" % str(e))
@@ -5620,36 +5620,36 @@ class CNCjob(Geometry):
self.f_plunge = self.app.defaults["geometry_f_plunge"] self.f_plunge = self.app.defaults["geometry_f_plunge"]
if self.z_cut is None: if self.z_cut is None:
self.app.inform.emit("[ERROR_NOTCL] Cut_Z parameter is None or zero. Most likely a bad combinations of " self.app.inform.emit(_tr("[ERROR_NOTCL] Cut_Z parameter is None or zero. Most likely a bad combinations of "
"other parameters.") "other parameters."))
return 'fail' return 'fail'
if self.z_cut > 0: if self.z_cut > 0:
self.app.inform.emit("[WARNING] The Cut Z parameter has positive value. " self.app.inform.emit(_tr("[WARNING] The Cut Z parameter has positive value. "
"It is the depth value to cut into material.\n" "It is the depth value to cut into material.\n"
"The Cut Z parameter needs to have a negative value, assuming it is a typo " "The Cut Z parameter needs to have a negative value, assuming it is a typo "
"therefore the app will convert the value to negative." "therefore the app will convert the value to negative."
"Check the resulting CNC code (Gcode etc).") "Check the resulting CNC code (Gcode etc)."))
self.z_cut = -self.z_cut self.z_cut = -self.z_cut
elif self.z_cut == 0: elif self.z_cut == 0:
self.app.inform.emit("[WARNING] The Cut Z parameter is zero. " self.app.inform.emit(_tr("[WARNING] The Cut Z parameter is zero. "
"There will be no cut, skipping %s file" % geometry.options['name']) "There will be no cut, skipping %s file") % geometry.options['name'])
return 'fail' return 'fail'
if self.z_move is None: if self.z_move is None:
self.app.inform.emit("[ERROR_NOTCL] Travel Z parameter is None or zero.") self.app.inform.emit(_tr("[ERROR_NOTCL] Travel Z parameter is None or zero."))
return 'fail' return 'fail'
if self.z_move < 0: if self.z_move < 0:
self.app.inform.emit("[WARNING] The Travel Z parameter has negative value. " self.app.inform.emit(_tr("[WARNING] The Travel Z parameter has negative value. "
"It is the height value to travel between cuts.\n" "It is the height value to travel between cuts.\n"
"The Z Travel parameter needs to have a positive value, assuming it is a typo " "The Z Travel parameter needs to have a positive value, assuming it is a typo "
"therefore the app will convert the value to positive." "therefore the app will convert the value to positive."
"Check the resulting CNC code (Gcode etc).") "Check the resulting CNC code (Gcode etc)."))
self.z_move = -self.z_move self.z_move = -self.z_move
elif self.z_move == 0: elif self.z_move == 0:
self.app.inform.emit("[WARNING] The Z Travel parameter is zero. " self.app.inform.emit(_tr("[WARNING] The Z Travel parameter is zero. "
"This is dangerous, skipping %s file" % self.options['name']) "This is dangerous, skipping %s file") % self.options['name'])
return 'fail' return 'fail'
## Index first and last points in paths ## Index first and last points in paths
@@ -5774,7 +5774,7 @@ class CNCjob(Geometry):
if not kwargs: if not kwargs:
log.debug("camlib.generate_from_solderpaste_geo() --> No tool in the solderpaste geometry.") log.debug("camlib.generate_from_solderpaste_geo() --> No tool in the solderpaste geometry.")
self.app.inform.emit("[ERROR_NOTCL] There is no tool data in the SolderPaste geometry.") self.app.inform.emit(_tr("[ERROR_NOTCL] There is no tool data in the SolderPaste geometry."))
# this is the tool diameter, it is used as such to accommodate the postprocessor who need the tool diameter # this is the tool diameter, it is used as such to accommodate the postprocessor who need the tool diameter