- done a regression on Tool Tab default text. It somehow delete Tools in certain scenarios so I got rid of it

- fixed bug in multigeometry geometry not having the bounds in self.options and crashing the GCode generation
- fixed bug that crashed whole application in case that the GCode editor is activated on a Tool gcode that is defective.
This commit is contained in:
Marius Stanciu 2019-02-06 00:16:14 +02:00 committed by Marius S
parent 2ea2ed0cb0
commit 299a6585a7
7 changed files with 79 additions and 35 deletions

View File

@ -6367,34 +6367,34 @@ The normal flow when working in FlatCAM is the following:</span></p>
self.ui.selected_scroll_area.setWidget(sel_title)
tool_title = QtWidgets.QTextEdit(
'<b>Shortcut Key List</b>')
tool_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
tool_title.setFrameStyle(QtWidgets.QFrame.NoFrame)
# font = self.sel_title.font()
# font.setPointSize(12)
# self.sel_title.setFont(font)
tool_text = '''
<p><span style="font-size:14px"><strong>Tool Tab - Choose an Item in Tools Menu</strong></span></p>
<p><span style="font-size:10px"><strong>Details</strong>:<br />
Some of the functionality of FlatCAM have been implemented as tools (a sort of plugins). </span></p>
<p><span style="font-size:10px">Most of the tools are accessible through&nbsp;the Tools menu or by using the associated shortcut keys.<br />
Each such a tool, if it needs an object to be used as a source it will provide the way to select this object(s) through a series of comboboxes. The result of using a tool is either a Geometry, an information that can be used in the app or it can be a file that can be saved.</span></p>
<ol>
</ol>
<p><span style="font-size:10px">A list of key shortcuts is available through an menu entry in <strong>Help -&gt; Shortcuts List</strong>&nbsp;or through it&#39;s own key shortcut: &#39;`&#39; (key left to 1).</span></p>
'''
tool_title.setText(tool_text)
tool_title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
self.ui.tool_scroll_area.setWidget(tool_title)
# tool_title = QtWidgets.QTextEdit(
# '<b>Shortcut Key List</b>')
# tool_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
# tool_title.setFrameStyle(QtWidgets.QFrame.NoFrame)
# # font = self.sel_title.font()
# # font.setPointSize(12)
# # self.sel_title.setFont(font)
#
# tool_text = '''
# <p><span style="font-size:14px"><strong>Tool Tab - Choose an Item in Tools Menu</strong></span></p>
#
# <p><span style="font-size:10px"><strong>Details</strong>:<br />
# Some of the functionality of FlatCAM have been implemented as tools (a sort of plugins). </span></p>
#
# <p><span style="font-size:10px">Most of the tools are accessible through&nbsp;the Tools menu or by using the associated shortcut keys.<br />
# Each such a tool, if it needs an object to be used as a source it will provide the way to select this object(s) through a series of comboboxes. The result of using a tool is either a Geometry, an information that can be used in the app or it can be a file that can be saved.</span></p>
#
# <ol>
# </ol>
#
# <p><span style="font-size:10px">A list of key shortcuts is available through an menu entry in <strong>Help -&gt; Shortcuts List</strong>&nbsp;or through it&#39;s own key shortcut: &#39;`&#39; (key left to 1).</span></p>
#
# '''
#
# tool_title.setText(tool_text)
# tool_title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
#
# self.ui.tool_scroll_area.setWidget(tool_title)
def setup_obj_classes(self):
"""

View File

@ -3064,7 +3064,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
)
grid1.addWidget(segy_label, 21, 0)
self.segy_entry = FCEntry()
grid1.addWidget(self.segy_entry, 22, 1)
grid1.addWidget(self.segy_entry, 21, 1)
self.layout.addStretch()

View File

@ -3349,6 +3349,11 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
job_obj.multigeo = True
job_obj.cnc_tools.clear()
job_obj.options['xmin'] = xmin
job_obj.options['ymin'] = ymin
job_obj.options['xmax'] = xmax
job_obj.options['ymax'] = ymax
try:
job_obj.z_pdepth = float(self.options["z_pdepth"])
except ValueError:
@ -4301,9 +4306,14 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
self.app.ui.code_editor.clear()
# then append the text from GCode to the text editor
for line in self.app.gcode_edited:
proc_line = str(line).strip('\n')
self.app.ui.code_editor.append(proc_line)
try:
for line in self.app.gcode_edited:
proc_line = str(line).strip('\n')
self.app.ui.code_editor.append(proc_line)
except Exception as e:
log.debug('FlatCAMCNNJob.on_modifygcode_button_click() -->%s' % str(e))
self.app.inform.emit('[ERROR]FlatCAMCNNJob.on_modifygcode_button_click() -->%s' % str(e))
return
self.app.ui.code_editor.moveCursor(QtGui.QTextCursor.Start)

View File

@ -875,8 +875,8 @@ class ObjectCollection(QtCore.QAbstractItemModel):
self.set_inactive(name)
def on_list_selection_change(self, current, previous):
FlatCAMApp.App.log.debug("on_list_selection_change()")
FlatCAMApp.App.log.debug("Current: %s, Previous %s" % (str(current), str(previous)))
# FlatCAMApp.App.log.debug("on_list_selection_change()")
# FlatCAMApp.App.log.debug("Current: %s, Previous %s" % (str(current), str(previous)))
try:
obj = current.indexes()[0].internalPointer().obj

View File

@ -12,6 +12,9 @@ CAD program, and create G-Code for Isolation routing.
6.02.2019
- fixed the units calculators crash FlatCAM when using comma as decimal separator
- done a regression on Tool Tab default text. It somehow delete Tools in certain scenarios so I got rid of it
- fixed bug in multigeometry geometry not having the bounds in self.options and crashing the GCode generation
- fixed bug that crashed whole application in case that the GCode editor is activated on a Tool gcode that is defective.
5.02.3019

View File

@ -829,7 +829,7 @@ class Geometry(object):
for i in current.interiors:
geoms.insert(i)
else:
print("Current Area is zero")
log.debug("camlib.Geometry.clear_polygon() --> Current Area is zero")
break
# Optimization: Reduce lifts

View File

@ -839,6 +839,17 @@ class ToolPaint(FlatCAMTool, Gerber):
return None
geo_obj.solid_geometry = []
try:
a, b, c, d = poly.bounds()
geo_obj.options['xmin'] = a
geo_obj.options['ymin'] = b
geo_obj.options['xmax'] = c
geo_obj.options['ymax'] = d
except Exception as e:
log.debug("ToolPaint.paint_poly.gen_paintarea() bounds error --> %s" % str(e))
return
try:
poly_buf = poly.buffer(-paint_margin)
if isinstance(poly_buf, MultiPolygon):
@ -988,6 +999,16 @@ class ToolPaint(FlatCAMTool, Gerber):
sorted_tools.append(float(self.tools_table.item(row, 1).text()))
sorted_tools.sort(reverse=True)
try:
a, b, c, d = obj.bounds()
geo_obj.options['xmin'] = a
geo_obj.options['ymin'] = b
geo_obj.options['xmax'] = c
geo_obj.options['ymax'] = d
except Exception as e:
log.debug("ToolPaint.paint_poly.gen_paintarea() bounds error --> %s" % str(e))
return
total_geometry = []
current_uid = int(1)
geo_obj.solid_geometry = []
@ -1085,6 +1106,16 @@ class ToolPaint(FlatCAMTool, Gerber):
current_uid = int(1)
geo_obj.solid_geometry = []
try:
a, b, c, d = obj.bounds()
geo_obj.options['xmin'] = a
geo_obj.options['ymin'] = b
geo_obj.options['xmax'] = c
geo_obj.options['ymax'] = d
except Exception as e:
log.debug("ToolPaint.paint_poly.gen_paintarea() bounds error --> %s" % str(e))
return
for tool_dia in sorted_tools:
for geo in recurse(obj.solid_geometry):
try: