- updated German language translation files

- separated the Plotting thread from the transformations threads
This commit is contained in:
Marius Stanciu 2019-09-07 23:16:20 +03:00 committed by Marius
parent bdbe0f59f0
commit 28a86aa661
9 changed files with 4085 additions and 3458 deletions

View File

@ -105,7 +105,7 @@ class App(QtCore.QObject):
# Version and VERSION DATE ###########
# ####################################
version = 8.97
version_date = "2019/09/07"
version_date = "2019/09/09"
beta = True
# current date now
@ -5463,7 +5463,7 @@ class App(QtCore.QObject):
def origin_replot():
def worker_task():
with self.proc_container.new(_("Plotting...")):
with self.proc_container.new('%s...' % _("Plotting")):
for obj in self.collection.get_list():
obj.plot()
self.plotcanvas.fit_view()
@ -6335,7 +6335,7 @@ class App(QtCore.QObject):
self.ui.popMenu.mouse_is_panning = False
if origin_click != True:
if not origin_click:
# if the RMB is clicked and mouse is moving over plot then 'panning_action' is True
if event.button == 2 and event.is_dragging == 1:
self.ui.popMenu.mouse_is_panning = True
@ -6450,20 +6450,23 @@ class App(QtCore.QObject):
self.selection_area_handler(self.pos, pos, self.selection_type)
self.selection_type = None
else:
modifiers = QtWidgets.QApplication.keyboardModifiers()
key_modifier = QtWidgets.QApplication.keyboardModifiers()
# If the CTRL key is pressed when the LMB is clicked then if the object is selected it will
# deselect, and if it's not selected then it will be selected
if modifiers == QtCore.Qt.ControlModifier:
if key_modifier == QtCore.Qt.ShiftModifier:
mod_key = 'Shift'
elif key_modifier == QtCore.Qt.ControlModifier:
mod_key = 'Control'
else:
mod_key = None
if mod_key == self.defaults["global_mselect_key"]:
# If the CTRL key is pressed when the LMB is clicked then if the object is selected it will
# deselect, and if it's not selected then it will be selected
# If there is no active command (self.command_active is None) then we check if we clicked
# on a object by checking the bounding limits against mouse click position
if self.command_active is None:
self.select_objects(key='CTRL')
self.delete_hover_shape()
elif modifiers == QtCore.Qt.ShiftModifier:
# if SHIFT was pressed and LMB is clicked then we have a coordinates copy to clipboard
# therefore things should stay as they are
pass
else:
# If there is no active command (self.command_active is None) then we check if we clicked
# on a object by checking the bounding limits against mouse click position
@ -6559,17 +6562,21 @@ class App(QtCore.QObject):
# self.inform.emit('[selected] %s: %s selected' %
# (str(curr_sel_obj.kind).capitalize(), str(curr_sel_obj.options['name'])))
if curr_sel_obj.kind == 'gerber':
self.inform.emit(_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='green', name=str(curr_sel_obj.options['name'])))
self.inform.emit(
_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='green', name=str(curr_sel_obj.options['name'])))
elif curr_sel_obj.kind == 'excellon':
self.inform.emit(_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='brown', name=str(curr_sel_obj.options['name'])))
self.inform.emit(
_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='brown', name=str(curr_sel_obj.options['name'])))
elif curr_sel_obj.kind == 'cncjob':
self.inform.emit(_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='blue', name=str(curr_sel_obj.options['name'])))
self.inform.emit(
_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='blue', name=str(curr_sel_obj.options['name'])))
elif curr_sel_obj.kind == 'geometry':
self.inform.emit(_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='red', name=str(curr_sel_obj.options['name'])))
self.inform.emit(
_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='red', name=str(curr_sel_obj.options['name'])))
elif self.collection.get_active().options['name'] not in objects_under_the_click_list:
self.collection.set_all_inactive()
@ -6583,17 +6590,21 @@ class App(QtCore.QObject):
# self.inform.emit('[selected] %s: %s selected' %
# (str(curr_sel_obj.kind).capitalize(), str(curr_sel_obj.options['name'])))
if curr_sel_obj.kind == 'gerber':
self.inform.emit(_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='green', name=str(curr_sel_obj.options['name'])))
self.inform.emit(
_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='green', name=str(curr_sel_obj.options['name'])))
elif curr_sel_obj.kind == 'excellon':
self.inform.emit(_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='brown', name=str(curr_sel_obj.options['name'])))
self.inform.emit(
_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='brown', name=str(curr_sel_obj.options['name'])))
elif curr_sel_obj.kind == 'cncjob':
self.inform.emit(_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='blue', name=str(curr_sel_obj.options['name'])))
self.inform.emit(
_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='blue', name=str(curr_sel_obj.options['name'])))
elif curr_sel_obj.kind == 'geometry':
self.inform.emit(_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='red', name=str(curr_sel_obj.options['name'])))
self.inform.emit(
_('[selected]<span style="color:{color};">{name}</span> selected').format(
color='red', name=str(curr_sel_obj.options['name'])))
else:
self.collection.set_all_inactive()

View File

@ -217,7 +217,7 @@ class FlatCAMObj(QtCore.QObject):
with self.app.proc_container.new(_("Offsetting...")):
self.offset(vector_val)
self.app.proc_container.update_view_text('')
with self.app.proc_container.new(_("Plotting...")):
with self.app.proc_container.new('%s...' % _("Plotting")):
self.plot()
self.app.object_changed.emit(self)
@ -232,7 +232,7 @@ class FlatCAMObj(QtCore.QObject):
with self.app.proc_container.new(_("Scaling...")):
self.scale(factor)
self.app.proc_container.update_view_text('')
with self.app.proc_container.new(_("Plotting...")):
with self.app.proc_container.new('%s...' % _("Plotting")):
self.plot()
self.app.object_changed.emit(self)
@ -248,7 +248,7 @@ class FlatCAMObj(QtCore.QObject):
with self.app.proc_container.new(_("Skewing...")):
self.skew(x_angle, y_angle)
self.app.proc_container.update_view_text('')
with self.app.proc_container.new(_("Plotting...")):
with self.app.proc_container.new('%s...' % _("Plotting")):
self.plot()
self.app.object_changed.emit(self)

View File

@ -20,6 +20,8 @@ CAD program, and create G-Code for Isolation routing.
- made threaded the Offset and Scale operations found in the Selected tab of the object
- corrected some issues and made Move Tool to show correctly when it is plotting and when it is offsetting the objects position
- made Set Origin feature, threaded
- updated German language translation files
- separated the Plotting thread from the transformations threads
6.09.2019

100
camlib.py
View File

@ -550,6 +550,10 @@ class Geometry(object):
# the previously commented block is replaced with this block - regression - to solve the bug with multiple
# isolation passes cutting from the copper features
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
geo_iso = []
if offset == 0:
if follow:
@ -2194,6 +2198,9 @@ class Gerber (Geometry):
:return: Identifier of the aperture.
:rtype: str
"""
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
# Found some Gerber with a leading zero in the aperture id and the
# referenced it without the zero, so this is a hack to handle that.
@ -2363,6 +2370,10 @@ class Gerber (Geometry):
gline = ""
try:
for gline in glines:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
line_num += 1
self.source_file += gline + '\n'
@ -4106,6 +4117,10 @@ class Excellon(Geometry):
eline = ""
try:
for eline in elines:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
line_num += 1
# log.debug("%3d %s" % (line_num, str(eline)))
@ -5571,6 +5586,10 @@ class CNCjob(Geometry):
# Points (Group by tool)
points = {}
for drill in exobj.drills:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
if drill['tool'] in tools:
try:
points[drill['tool']].append(drill['point'])
@ -5656,6 +5675,10 @@ class CNCjob(Geometry):
self.postdata['toolC'] = exobj.tools[tool]["C"]
self.tooldia = exobj.tools[tool]["C"]
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
# ###############################################
# ############ Create the data. #################
# ###############################################
@ -5702,6 +5725,10 @@ class CNCjob(Geometry):
start_node = node
while not routing.IsEnd(node):
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
node_list.append(node)
node = assignment.Value(routing.NextVar(node))
else:
@ -5712,6 +5739,10 @@ class CNCjob(Geometry):
# Only if tool has points.
if tool in points:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
# Tool change sequence (optional)
if toolchange:
gcode += self.doformat(p.toolchange_code,toolchangexy=(self.oldx, self.oldy))
@ -5753,6 +5784,10 @@ class CNCjob(Geometry):
loc_nr = 0
for k in node_list:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
locx = locations[k][0]
locy = locations[k][1]
@ -5794,6 +5829,10 @@ class CNCjob(Geometry):
log.debug("Using OR-Tools Basic drill path optimization.")
if exobj.drills:
for tool in tools:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
self.tool=tool
self.postdata['toolC']=exobj.tools[tool]["C"]
self.tooldia = exobj.tools[tool]["C"]
@ -5844,6 +5883,10 @@ class CNCjob(Geometry):
# Only if tool has points.
if tool in points:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
# Tool change sequence (optional)
if toolchange:
gcode += self.doformat(p.toolchange_code,toolchangexy=(self.oldx, self.oldy))
@ -5885,6 +5928,10 @@ class CNCjob(Geometry):
loc_nr = 0
for k in node_list:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
locx = locations[k][0]
locy = locations[k][1]
@ -5928,6 +5975,10 @@ class CNCjob(Geometry):
else:
log.debug("Using Travelling Salesman drill path optimization.")
for tool in tools:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
if exobj.drills:
self.tool = tool
self.postdata['toolC'] = exobj.tools[tool]["C"]
@ -5935,6 +5986,10 @@ class CNCjob(Geometry):
# Only if tool has points.
if tool in points:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
# Tool change sequence (optional)
if toolchange:
gcode += self.doformat(p.toolchange_code, toolchangexy=(self.oldx, self.oldy))
@ -5981,6 +6036,10 @@ class CNCjob(Geometry):
loc_nr = 0
for point in node_list:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
gcode += self.doformat(p.rapid_code, x=point[0], y=point[1])
gcode += self.doformat(p.down_code, x=point[0], y=point[1])
@ -6171,6 +6230,10 @@ class CNCjob(Geometry):
self.app.inform.emit(_("Indexing geometry before generating G-Code..."))
for shape in flat_geometry:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
if shape is not None: # TODO: This shouldn't have happened.
storage.insert(shape)
@ -6244,6 +6307,10 @@ class CNCjob(Geometry):
try:
while True:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
path_count += 1
# Remove before modifying, otherwise deletion will fail.
@ -6490,6 +6557,10 @@ class CNCjob(Geometry):
self.app.inform.emit(_("Indexing geometry before generating G-Code..."))
for shape in flat_geometry:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
if shape is not None: # TODO: This shouldn't have happened.
storage.insert(shape)
@ -6564,6 +6635,10 @@ class CNCjob(Geometry):
pt, geo = storage.nearest(current_pt)
try:
while True:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
path_count += 1
# Remove before modifying, otherwise deletion will fail.
@ -6705,6 +6780,10 @@ class CNCjob(Geometry):
try:
while True:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
path_count += 1
# Remove before modifying, otherwise deletion will fail.
@ -7461,6 +7540,10 @@ class CNCjob(Geometry):
prev_x = first_x
prev_y = first_y
for pt in path[1:]:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
if self.coordinates_type == "G90":
# For Absolute coordinates type G90
next_x = pt[0]
@ -7558,6 +7641,10 @@ class CNCjob(Geometry):
prev_x = first_x
prev_y = first_y
for pt in path[1:]:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
if self.coordinates_type == "G90":
# For Absolute coordinates type G90
next_x = pt[0]
@ -7597,6 +7684,10 @@ class CNCjob(Geometry):
def point2gcode(self, point, old_point=(0, 0)):
gcode = ""
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
path = list(point.coords)
p = self.pp_geometry
@ -7651,6 +7742,10 @@ class CNCjob(Geometry):
cuts = []
travels = []
for g in self.gcode_parsed:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
if g['kind'][0] == 'C': cuts.append(g)
if g['kind'][0] == 'T': travels.append(g)
@ -7660,6 +7755,11 @@ class CNCjob(Geometry):
# Convert the cuts and travels into single geometry objects we can render as svg xml
if travels:
travelsgeom = cascaded_union([geo['geom'] for geo in travels])
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
if cuts:
cutsgeom = cascaded_union([geo['geom'] for geo in cuts])

View File

@ -184,7 +184,7 @@ class ToolMove(FlatCAMTool):
def replot(self, obj_list):
def worker_task():
with self.app.proc_container.new(_("Plotting...")):
with self.app.proc_container.new('%s...' % _("Plotting")):
for sel_obj in obj_list:
sel_obj.plot()

View File

@ -183,12 +183,20 @@ class ToolPDF(FlatCAMTool):
# 1 inch = 72 points => 1 point = 1 / 72 = 0.01388888888 inch
self.point_to_unit_factor = 1 / 72
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
with self.app.proc_container.new(_("Parsing PDF file ...")):
with open(filename, "rb") as f:
pdf = f.read()
stream_nr = 0
for s in re.findall(self.stream_re, pdf):
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
stream_nr += 1
log.debug(" PDF STREAM: %d\n" % stream_nr)
s = s.strip(b'\r\n')
@ -389,10 +397,18 @@ class ToolPDF(FlatCAMTool):
if self.pdf_parsed:
obj_to_delete = []
for object_name in self.pdf_parsed:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
filename = deepcopy(self.pdf_parsed[object_name]['filename'])
pdf_content = deepcopy(self.pdf_parsed[object_name]['pdf'])
obj_to_delete.append(object_name)
for k in pdf_content:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
ap_dict = pdf_content[k]
if ap_dict:
layer_nr = k
@ -470,6 +486,10 @@ class ToolPDF(FlatCAMTool):
lines = pdf_content.splitlines()
for pline in lines:
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
line_nr += 1
log.debug("line %d: %s" % (line_nr, pline))
@ -1328,6 +1348,10 @@ class ToolPDF(FlatCAMTool):
if x in object_dict:
object_dict.pop(x)
if self.app.abort_flag:
# graceful abort requested by the user
raise FlatCAMApp.GracefulException
return object_dict
def bezier_to_points(self, start, c1, c2, stop):

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff