- in Tools Database added a contextual menu to add/copy/delete tool; CTRL+C, DEL keys work too; key T for adding a tool is now only partially working

- in Tools Database made the status bar messages show when adding/copying/deleting tools in DB
- changed all Except statements that were single to except Exception as recommended in some PEP
- renamed the Copper Fill Tool to Copper Thieving Tool as this is a more appropriate name; started to add ability for more types of copper thieving besides solid
- fixed some issues recently introduced in ParseSVG
- updated POT file
This commit is contained in:
Marius Stanciu 2019-11-11 02:35:42 +02:00 committed by Marius
parent fdad91f04e
commit 70d123306c
33 changed files with 8161 additions and 5603 deletions

File diff suppressed because it is too large Load Diff

View File

@ -382,7 +382,7 @@ class BookmarkManager(QtWidgets.QWidget):
self.app.log.debug('Creating a new bookmarks file ...')
f = open(filename, 'w')
f.close()
except:
except Exception:
e = sys.exc_info()[0]
self.app.log.error("Could not load defaults file.")
self.app.log.error(str(e))
@ -395,7 +395,7 @@ class BookmarkManager(QtWidgets.QWidget):
for title, link in self.bm_dict.items():
line2write = str(title) + ':' + str(link) + '\n'
f.write(line2write)
except:
except Exception:
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed to write bookmarks to file."))
return
self.app.inform.emit('[success] %s: %s' % (_("Exported bookmarks to"), filename))
@ -647,8 +647,8 @@ class ToolsDB(QtWidgets.QWidget):
new_vlay = QtWidgets.QVBoxLayout()
layout.addLayout(new_vlay)
new_tool_lbl = QtWidgets.QLabel('<b>%s</b>' % _("New Tool"))
new_vlay.addWidget(new_tool_lbl, alignment=QtCore.Qt.AlignBottom)
# new_tool_lbl = QtWidgets.QLabel('<b>%s</b>' % _("New Tool"))
# new_vlay.addWidget(new_tool_lbl, alignment=QtCore.Qt.AlignBottom)
self.buttons_frame = QtWidgets.QFrame()
self.buttons_frame.setContentsMargins(0, 0, 0, 0)
@ -700,8 +700,8 @@ class ToolsDB(QtWidgets.QWidget):
# ######################## SIGNALS #############################################
# ##############################################################################
add_entry_btn.clicked.connect(self.on_add_entry)
remove_entry_btn.clicked.connect(self.on_remove_entry)
add_entry_btn.clicked.connect(self.on_tool_add)
remove_entry_btn.clicked.connect(self.on_tool_delete)
export_db_btn.clicked.connect(self.on_export_tools_db_file)
import_db_btn.clicked.connect(self.on_import_tools_db_file)
# closebtn.clicked.connect(self.accept)
@ -724,7 +724,7 @@ class ToolsDB(QtWidgets.QWidget):
try:
self.db_tool_dict = json.loads(tools)
except:
except Exception:
e = sys.exc_info()[0]
self.app.log.error(str(e))
self.app.inform.emit('[ERROR] %s' % _("Failed to parse Tools DB file."))
@ -734,6 +734,14 @@ class ToolsDB(QtWidgets.QWidget):
self.build_db_ui()
self.table_widget.setupContextMenu()
self.table_widget.addContextMenu(
_("Add to DB"), self.on_tool_add, icon=QtGui.QIcon("share/plus16.png"))
self.table_widget.addContextMenu(
_("Copy from DB"), self.on_tool_copy, icon=QtGui.QIcon("share/copy16.png"))
self.table_widget.addContextMenu(
_("Delete from DB"), self.on_tool_delete, icon=QtGui.QIcon("share/delete32.png"))
def build_db_ui(self):
self.ui_disconnect()
self.table_widget.setRowCount(len(self.db_tool_dict))
@ -772,7 +780,8 @@ class ToolsDB(QtWidgets.QWidget):
nr_crt = row + 1
id_item = QtWidgets.QTableWidgetItem('%d' % int(nr_crt))
id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
# id_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
id_item.setFlags(id_item.flags() & ~QtCore.Qt.ItemIsEditable)
widget.setItem(row, 0, id_item) # Tool name/id
tool_name_item = QtWidgets.QTableWidgetItem(name)
@ -930,7 +939,7 @@ class ToolsDB(QtWidgets.QWidget):
endz_item.set_value(float(data['endz']))
widget.setCellWidget(row, 25, endz_item)
def on_add_entry(self):
def on_tool_add(self):
"""
Add a tool in the DB Tool Table
:return: None
@ -977,21 +986,39 @@ class ToolsDB(QtWidgets.QWidget):
}
)
self.app.inform.emit(f'[success] {_("Tool added to DB.")}')
# add the new entry to the Tools DB table
self.build_db_ui()
self.callback_on_edited()
self.app.inform.emit(f'[success] {_("Tool added to DB.")}')
def on_remove_entry(self):
def on_tool_copy(self):
"""
Remove a Tool in the Tools DB table
Copy a selection of Tools in the Tools DB table
:return:
"""
index_list = []
new_tool_id = self.table_widget.rowCount() + 1
for model_index in self.table_widget.selectionModel().selectedRows():
index = QtCore.QPersistentModelIndex(model_index)
index_list.append(index)
# index = QtCore.QPersistentModelIndex(model_index)
old_tool_id = self.table_widget.item(model_index.row(), 0).text()
new_tool_id += 1
for toolid, dict_val in list(self.db_tool_dict.items()):
if int(old_tool_id) == int(toolid):
self.db_tool_dict.update({
new_tool_id: deepcopy(dict_val)
})
self.build_db_ui()
self.callback_on_edited()
self.app.inform.emit(f'[success] {_("Tool copied from Tools DB.")}')
def on_tool_delete(self):
"""
Delete a selection of Tools in the Tools DB table
:return:
"""
for model_index in self.table_widget.selectionModel().selectedRows():
# index = QtCore.QPersistentModelIndex(model_index)
toolname_to_remove = self.table_widget.item(model_index.row(), 0).text()
for toolid, dict_val in list(self.db_tool_dict.items()):
@ -999,10 +1026,9 @@ class ToolsDB(QtWidgets.QWidget):
# remove from the storage
self.db_tool_dict.pop(toolid, None)
self.app.inform.emit(f'[success] {_("Tool removed from Tools DB.")}')
self.build_db_ui()
self.callback_on_edited()
self.app.inform.emit(f'[success] {_("Tool removed from Tools DB.")}')
def on_export_tools_db_file(self):
self.app.report_usage("on_export_tools_db_file")
@ -1038,7 +1064,7 @@ class ToolsDB(QtWidgets.QWidget):
self.app.log.debug('Creating a new Tools DB file ...')
f = open(filename, 'w')
f.close()
except:
except Exception:
e = sys.exc_info()[0]
self.app.log.error("Could not load Tools DB file.")
self.app.log.error(str(e))
@ -1055,7 +1081,7 @@ class ToolsDB(QtWidgets.QWidget):
self.app.log.debug("App.on_save_tools_db() --> %s" % str(e))
self.inform.emit(f'[ERROR_NOTCL] {_("Failed to write Tools DB to file.")}')
return
except:
except Exception:
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed to write Tools DB to file."))
return
@ -1081,7 +1107,7 @@ class ToolsDB(QtWidgets.QWidget):
try:
self.db_tool_dict = json.loads(tools_in_db)
except:
except Exception:
e = sys.exc_info()[0]
self.app.log.error(str(e))
self.app.inform.emit('[ERROR] %s' % _("Failed to parse Tools DB file."))
@ -1112,7 +1138,7 @@ class ToolsDB(QtWidgets.QWidget):
return
if not silent:
self.app.inform.emit('[success] %s: %s' % (_("Exported Tools DB to"), filename))
self.app.inform.emit('[success] %s' % _("Saved Tools DB."))
def ui_connect(self):
try:
@ -1206,7 +1232,6 @@ class ToolsDB(QtWidgets.QWidget):
elif column_header_text == 'Tool Shape':
dict_elem['tool_type'] = self.table_widget.cellWidget(row, col).get_value()
else:
if column_header_text == 'Cut Z':
default_data['cutz'] = self.table_widget.cellWidget(row, col).get_value()
elif column_header_text == 'MultiDepth':
@ -1261,19 +1286,15 @@ class ToolsDB(QtWidgets.QWidget):
if not self.table_widget.selectionModel().selectedRows():
self.app.inform.emit('[WARNING_NOTCL] %s...' % _("No Tool/row selected in the Tools Database table"))
return
elif len(self.table_widget.selectionModel().selectedRows()) > 1:
self.app.inform.emit('[WARNING_NOTCL] %s...' %
_("Only one tool can be selected in the Tools Database table"))
return
# only one model in list since the conditions above assure this
model_index = self.table_widget.selectionModel().selectedRows()[0]
selected_row = model_index.row()
tool_uid = selected_row + 1
for key in self.db_tool_dict.keys():
if str(key) == str(tool_uid):
selected_tool = self.db_tool_dict[key]
self.on_tool_request(tool=selected_tool)
model_index_list = self.table_widget.selectionModel().selectedRows()
for model_index in model_index_list:
selected_row = model_index.row()
tool_uid = selected_row + 1
for key in self.db_tool_dict.keys():
if str(key) == str(tool_uid):
selected_tool = self.db_tool_dict[key]
self.on_tool_request(tool=selected_tool)
def resize_new_tool_table_widget(self, min_size, max_size):
"""

View File

@ -3986,6 +3986,12 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
and display the Tools Database tab in the form needed for the Tool adding
:return: None
"""
# if the Tools Database is already opened focus on it
for idx in range(self.app.ui.plot_tab_area.count()):
if self.app.ui.plot_tab_area.tabText(idx) == _("Tools Database"):
self.app.ui.plot_tab_area.setCurrentWidget(self.app.tools_db_tab)
break
self.app.on_tools_database()
self.app.tools_db_tab.buttons_frame.hide()
self.app.tools_db_tab.add_tool_from_db.show()

View File

@ -9,6 +9,15 @@ CAD program, and create G-Code for Isolation routing.
=================================================
11.11.2019
- in Tools Database added a contextual menu to add/copy/delete tool; CTRL+C, DEL keys work too; key T for adding a tool is now only partially working
- in Tools Database made the status bar messages show when adding/copying/deleting tools in DB
- changed all Except statements that were single to except Exception as recommended in some PEP
- renamed the Copper Fill Tool to Copper Thieving Tool as this is a more appropriate name; started to add ability for more types of copper thieving besides solid
- fixed some issues recently introduced in ParseSVG
- updated POT file
9.11.2019
- fixed a new bug that did not allow to open the FlatCAM Preferences files by doubleclick in Windows
@ -18,7 +27,7 @@ CAD program, and create G-Code for Isolation routing.
8.11.2019
- updated the make file for freezed executable
- updated the make file for frozen executable
7.11.2019
@ -117,7 +126,7 @@ CAD program, and create G-Code for Isolation routing.
- working on the Calibrate Excellon Tool
- finished the GUI layout for the Calibrate Excellon Tool
- start working on QRCode Tool - not working yet
- start working on QRCode Tool - searching for alternativess
- start working on QRCode Tool - searching for alternatives
21.10.2019

View File

@ -1014,6 +1014,8 @@ class Geometry(object):
:return: None
"""
log.debug("camlib.Geometry.import_svg()")
# Parse into list of shapely objects
svg_tree = ET.parse(filename)
svg_root = svg_tree.getroot()
@ -1022,8 +1024,8 @@ class Geometry(object):
# h = float(svg_root.get('height'))
# w = float(svg_root.get('width'))
h = svgparselength(svg_root.get('height'))[0] # TODO: No units support yet
geos = getsvggeo(svg_root, object_type)
geos = getsvggeo(svg_root, object_type)
if flip:
geos = [translate(scale(g, 1.0, -1.0, origin=(0, 0)), yoff=h) for g in geos]
@ -1134,12 +1136,12 @@ class Geometry(object):
try:
green = src.read(2)
except Exception as e:
except Exception:
pass
try:
blue = src.read(3)
except Exception as e:
except Exception:
pass
if mode == 'black':
@ -2289,7 +2291,7 @@ class CNCjob(Geometry):
try:
returnvalue = fun(attributes)
return returnvalue
except Exception as e:
except Exception:
self.app.log.error('Exception occurred within a postprocessor: ' + traceback.format_exc())
return ''
@ -5192,7 +5194,7 @@ def get_bounds(geometry_list):
ymin = min([ymin, gymin])
xmax = max([xmax, gxmax])
ymax = max([ymax, gymax])
except:
except Exception:
log.warning("DEVELOPMENT: Tried to get bounds of empty geometry.")
return [xmin, ymin, xmax, ymax]

View File

@ -63,7 +63,7 @@ class FCDrillAdd(FCShapeTool):
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero_drill.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
@ -105,7 +105,7 @@ class FCDrillAdd(FCShapeTool):
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
# add the point to drills if the diameter is a key in the dict, if not, create it add the drill location
@ -888,7 +888,7 @@ class FCDrillResize(FCShapeTool):
try:
new_dia = self.draw_app.resdrill_entry.get_value()
except:
except Exception:
self.draw_app.app.inform.emit('[ERROR_NOTCL] %s' %
_("Resize drill(s) failed. Please enter a diameter for resize."))
return
@ -3241,7 +3241,7 @@ class FlatCAMExcEditor(QtCore.QObject):
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("There are no Tools definitions in the file. Aborting Excellon creation.")
)
except:
except Exception:
msg = '[ERROR] %s' % \
_("An internal error has ocurred. See Shell.\n")
msg += traceback.format_exc()

View File

@ -1297,8 +1297,7 @@ class TransformEditorTool(FlatCAMTool):
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
(_("Rotation action was not executed"), str(e)))
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Rotation action was not executed"), str(e)))
return
def on_flip(self, axis):
@ -1358,8 +1357,7 @@ class TransformEditorTool(FlatCAMTool):
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
(_("Flip action was not executed"), str(e)))
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Flip action was not executed"), str(e)))
return
def on_skew(self, axis, num):
@ -1405,8 +1403,7 @@ class TransformEditorTool(FlatCAMTool):
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
(_("Skew action was not executed"), str(e)))
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Skew action was not executed"), str(e)))
return
def on_scale(self, axis, xfactor, yfactor, point=None):
@ -1462,8 +1459,7 @@ class TransformEditorTool(FlatCAMTool):
_('Scale on the Y axis done'))
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
(_("Scale action was not executed"), str(e)))
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Scale action was not executed"), str(e)))
return
def on_offset(self, axis, num):
@ -1496,8 +1492,7 @@ class TransformEditorTool(FlatCAMTool):
self.app.progress.emit(100)
except Exception as e:
self.app.inform.emit('[ERROR_NOTCL] %s: %s' %
(_("Offset action was not executed"), str(e)))
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Offset action was not executed"), str(e)))
return
def on_rotate_key(self):
@ -1815,7 +1810,7 @@ class DrawToolShape(object):
try:
xfactor = float(xfactor)
except:
except Exception:
log.debug("DrawToolShape.offset() --> Scale factor has to be a number: integer or float.")
return
@ -1824,7 +1819,7 @@ class DrawToolShape(object):
else:
try:
yfactor = float(yfactor)
except:
except Exception:
log.debug("DrawToolShape.offset() --> Scale factor has to be a number: integer or float.")
return
@ -1946,7 +1941,7 @@ class FCCircle(FCShapeTool):
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero_circle_geo.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
@ -1979,7 +1974,7 @@ class FCCircle(FCShapeTool):
def make(self):
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
p1 = self.points[0]
@ -1998,7 +1993,7 @@ class FCArc(FCShapeTool):
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero_arc.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
@ -2217,7 +2212,7 @@ class FCRectangle(FCShapeTool):
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
@ -2248,7 +2243,7 @@ class FCRectangle(FCShapeTool):
def make(self):
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
p1 = self.points[0]
@ -2271,7 +2266,7 @@ class FCPolygon(FCShapeTool):
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
@ -2304,7 +2299,7 @@ class FCPolygon(FCShapeTool):
def make(self):
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
# self.geometry = LinearRing(self.points)
@ -2334,7 +2329,7 @@ class FCPath(FCPolygon):
try:
QtGui.QGuiApplication.restoreOverrideCursor()
except Exception as e:
except Exception:
pass
self.cursor = QtGui.QCursor(QtGui.QPixmap('share/aero_path5.png'))
QtGui.QGuiApplication.setOverrideCursor(self.cursor)
@ -2748,7 +2743,7 @@ class FCText(FCShapeTool):
try:
return DrawToolUtilityShape(affinity.translate(self.text_gui.text_path, xoff=dx, yoff=dy))
except:
except Exception:
return

View File

@ -748,7 +748,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.calculators_btn = self.toolbartools.addAction(QtGui.QIcon('share/calculator24.png'), _("Calculators Tool"))
self.transform_btn = self.toolbartools.addAction(QtGui.QIcon('share/transform.png'), _("Transform Tool"))
self.qrcode_btn = self.toolbartools.addAction(QtGui.QIcon('share/qrcode32.png'), _("QRCode Tool"))
self.copperfill_btn = self.toolbartools.addAction(QtGui.QIcon('share/copperfill32.png'), _("Copper Fill Tool"))
self.copperfill_btn = self.toolbartools.addAction(QtGui.QIcon('share/copperfill32.png'),
_("Copper Thieving Tool"))
# ########################################################################
# ########################## Excellon Editor Toolbar# ####################
@ -2173,7 +2174,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
_("Calculators Tool"))
self.transform_btn = self.toolbartools.addAction(QtGui.QIcon('share/transform.png'), _("Transform Tool"))
self.qrcode_btn = self.toolbartools.addAction(QtGui.QIcon('share/qrcode32.png'), _("QRCode Tool"))
self.copperfill_btn = self.toolbartools.addAction(QtGui.QIcon('share/copperfill32.png'), _("Copper Fill Tool"))
self.copperfill_btn = self.toolbartools.addAction(QtGui.QIcon('share/copperfill32.png'),
_("Copper Thieving Tool"))
# ## Excellon Editor Toolbar # ##
self.select_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), _("Select"))
@ -2378,6 +2380,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# Copy an FlatCAM object
if key == QtCore.Qt.Key_C:
widget_name = self.plot_tab_area.currentWidget().objectName()
if widget_name == 'database_tab':
# Tools DB saved, update flag
self.app.tools_db_changed_flag = True
self.app.tools_db_tab.on_tool_copy()
return
self.app.on_copy_object()
# Copy an FlatCAM object
@ -2504,7 +2513,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.app.cal_exc_tool.run(toggle=True)
return
# Copper Fill Tool
# Copper Thieving Tool
if key == QtCore.Qt.Key_F:
self.app.copperfill_tool.run(toggle=True)
return
@ -2611,6 +2620,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# It's meant to make a difference between delete objects and delete tools in
# Geometry Selected tool table
if key == QtCore.Qt.Key_Delete and matplotlib_key_flag is False:
widget_name = self.plot_tab_area.currentWidget().objectName()
if widget_name == 'database_tab':
# Tools DB saved, update flag
self.app.tools_db_changed_flag = True
self.app.tools_db_tab.on_tool_delete()
return
self.app.on_delete_keypress()
# Delete from canvas
@ -2703,6 +2719,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# Add a Tool from shortcut
if key == QtCore.Qt.Key_T:
widget_name = self.plot_tab_area.currentWidget().objectName()
if widget_name == 'database_tab':
# Tools DB saved, update flag
self.app.tools_db_changed_flag = True
self.app.tools_db_tab.on_tool_add()
return
self.app.on_tool_add_keypress()
# Zoom Fit
@ -3509,7 +3532,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# Jump to coords
if key == QtCore.Qt.Key_J:
self.app.on_jump_to()
elif self.app.call_source == 'copperfill_tool':
elif self.app.call_source == 'copper_thieving_tool':
if modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.AltModifier:
if key == QtCore.Qt.Key_X:
self.app.abort_all_tasks()

View File

@ -199,7 +199,7 @@ class LengthEntry(QtWidgets.QLineEdit):
except KeyError:
value = raw
return float(eval(value))
except:
except Exception:
log.warning("Could not parse value in entry: %s" % str(raw))
return None

View File

@ -161,7 +161,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
self.r_line.parent = None
self.t_line.parent = None
self.l_line.parent = None
except Exception as e:
except Exception:
pass
# redraw the workspace lines on the plot by readding them to the parent view.scene
@ -171,7 +171,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
self.r_line.parent = self.view.scene
self.t_line.parent = self.view.scene
self.l_line.parent = self.view.scene
except Exception as e:
except Exception:
pass
def graph_event_connect(self, event_name, callback):

View File

@ -5568,10 +5568,10 @@ class Tools2QRCodePrefGroupUI(OptionsGroupUI):
self.error_label = QtWidgets.QLabel('%s:' % _("Error correction"))
self.error_label.setToolTip(
_("Parameter that controls the error correction used for the QR Code.\n"
"L = maximum 7% errors can be corrected\n"
"M = maximum 15% errors can be corrected\n"
"Q = maximum 25% errors can be corrected\n"
"H = maximum 30% errors can be corrected.")
"L = maximum 7%% errors can be corrected\n"
"M = maximum 15%% errors can be corrected\n"
"Q = maximum 25%% errors can be corrected\n"
"H = maximum 30%% errors can be corrected.")
)
self.error_radio = RadioSet([{'label': 'L', 'value': 'L'},
{'label': 'M', 'value': 'M'},
@ -5579,10 +5579,10 @@ class Tools2QRCodePrefGroupUI(OptionsGroupUI):
{'label': 'H', 'value': 'H'}])
self.error_radio.setToolTip(
_("Parameter that controls the error correction used for the QR Code.\n"
"L = maximum 7% errors can be corrected\n"
"M = maximum 15% errors can be corrected\n"
"Q = maximum 25% errors can be corrected\n"
"H = maximum 30% errors can be corrected.")
"L = maximum 7%% errors can be corrected\n"
"M = maximum 15%% errors can be corrected\n"
"Q = maximum 25%% errors can be corrected\n"
"H = maximum 30%% errors can be corrected.")
)
grid_lay.addWidget(self.error_label, 2, 0)
grid_lay.addWidget(self.error_radio, 2, 1)
@ -5722,7 +5722,7 @@ class Tools2CFillPrefGroupUI(OptionsGroupUI):
super(Tools2CFillPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Copper Fill Tool Options")))
self.setTitle(str(_("Copper Thieving Tool Options")))
self.decimals = 4
# ## Grid Layout
@ -5734,7 +5734,7 @@ class Tools2CFillPrefGroupUI(OptionsGroupUI):
# ## Parameters
self.cflabel = QtWidgets.QLabel('<b>%s</b>' % _('Parameters'))
self.cflabel.setToolTip(
_("A tool to generate a Copper fill that can be added\n"
_("A tool to generate a Copper Thieving that can be added\n"
"to a selected Gerber file.")
)
grid_lay.addWidget(self.cflabel, 0, 0, 1, 2)
@ -5754,7 +5754,7 @@ class Tools2CFillPrefGroupUI(OptionsGroupUI):
# CLEARANCE #
self.clearance_label = QtWidgets.QLabel('%s:' % _("Clearance"))
self.clearance_label.setToolTip(
_("This set the distance between the copper fill components\n"
_("This set the distance between the copper Thieving components\n"
"(the polygon fill may be split in multiple polygons)\n"
"and the copper traces in the Gerber file.")
)
@ -5787,9 +5787,9 @@ class Tools2CFillPrefGroupUI(OptionsGroupUI):
], orientation='vertical', stretch=False)
self.reference_label = QtWidgets.QLabel(_("Reference:"))
self.reference_label.setToolTip(
_("- 'Itself' - the copper fill extent is based on the object that is copper cleared.\n "
_("- 'Itself' - the copper Thieving extent is based on the object that is copper cleared.\n "
"- 'Area Selection' - left mouse click to start selection of the area to be filled.\n"
"- 'Reference Object' - will do copper filling within the area specified by another object.")
"- 'Reference Object' - will do copper thieving within the area specified by another object.")
)
grid_lay.addWidget(self.reference_label, 4, 0)
grid_lay.addWidget(self.reference_radio, 4, 1)
@ -5807,6 +5807,29 @@ class Tools2CFillPrefGroupUI(OptionsGroupUI):
grid_lay.addWidget(self.bbox_type_label, 5, 0)
grid_lay.addWidget(self.bbox_type_radio, 5, 1)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid_lay.addWidget(separator_line, 6, 0, 1, 2)
# Fill Type
self.fill_type_radio = RadioSet([
{'label': _('Solid'), 'value': 'solid'},
{"label": _("Dots Grid"), "value": "dot"},
{"label": _("Squares Grid"), "value": "square"},
{"label": _("Lines Grid"), "value": "line"}
], orientation='vertical', stretch=False)
self.fill_type_label = QtWidgets.QLabel(_("Fill Type:"))
self.fill_type_label.setToolTip(
_("- 'Solid' - copper thieving will be a solid polygon.\n "
"- 'Dots Grid' - the empty area will be filled with a pattern of dots.\n"
"- 'Squares Grid' - the empty area will be filled with a pattern of squares.\n"
"- 'Lines Grid' - the empty area will be filled with a pattern of lines.")
)
grid_lay.addWidget(self.fill_type_label, 7, 0)
grid_lay.addWidget(self.fill_type_radio, 7, 1)
self.layout.addStretch()

View File

@ -241,7 +241,7 @@ def dxfsolid2shapely(solid):
try:
corner_list.append(solid[iterator])
iterator += 1
except:
except Exception:
return Polygon(corner_list)
@ -265,7 +265,7 @@ def dxftrace2shapely(trace):
try:
corner_list.append(trace[iterator])
iterator += 1
except:
except Exception:
return Polygon(corner_list)

View File

@ -250,7 +250,7 @@ class Excellon(Geometry):
try:
self.parse_lines(estr)
except:
except Exception:
return "fail"
def parse_lines(self, elines):
@ -412,7 +412,7 @@ class Excellon(Geometry):
name = str(int(match.group(1)))
try:
diam = float(match.group(2))
except:
except Exception:
# it's possible that tool definition has only tool number and no diameter info
# (those could be in another file like PCB Wizard do)
# then match.group(2) = None and float(None) will create the exception
@ -476,7 +476,7 @@ class Excellon(Geometry):
slot_current_x = slot_start_x
except TypeError:
slot_start_x = slot_current_x
except:
except Exception:
return
try:
@ -484,7 +484,7 @@ class Excellon(Geometry):
slot_current_y = slot_start_y
except TypeError:
slot_start_y = slot_current_y
except:
except Exception:
return
try:
@ -492,7 +492,7 @@ class Excellon(Geometry):
slot_current_x = slot_stop_x
except TypeError:
slot_stop_x = slot_current_x
except:
except Exception:
return
try:
@ -500,7 +500,7 @@ class Excellon(Geometry):
slot_current_y = slot_stop_y
except TypeError:
slot_stop_y = slot_current_y
except:
except Exception:
return
if (slot_start_x is None or slot_start_y is None or
@ -546,7 +546,7 @@ class Excellon(Geometry):
slot_current_x = slot_start_x
except TypeError:
slot_start_x = slot_current_x
except:
except Exception:
return
try:
@ -554,7 +554,7 @@ class Excellon(Geometry):
slot_current_y = slot_start_y
except TypeError:
slot_start_y = slot_current_y
except:
except Exception:
return
try:
@ -562,7 +562,7 @@ class Excellon(Geometry):
slot_current_x = slot_stop_x
except TypeError:
slot_stop_x = slot_current_x
except:
except Exception:
return
try:
@ -570,7 +570,7 @@ class Excellon(Geometry):
slot_current_y = slot_stop_y
except TypeError:
slot_stop_y = slot_current_y
except:
except Exception:
return
if (slot_start_x is None or slot_start_y is None or
@ -619,7 +619,7 @@ class Excellon(Geometry):
except TypeError:
x = current_x
repeating_x = 0
except:
except Exception:
return
try:
@ -629,7 +629,7 @@ class Excellon(Geometry):
except TypeError:
y = current_y
repeating_y = 0
except:
except Exception:
return
if x is None or y is None:

View File

@ -258,7 +258,7 @@ class Gerber(Geometry):
try: # Could be empty for aperture macros
paramList = apParameters.split('X')
except:
except Exception:
paramList = None
if apertureType == "C": # Circle, example: %ADD11C,0.1*%
@ -867,7 +867,7 @@ class Gerber(Geometry):
# if match.group(1) is None and match.group(2) is None and match.group(3) is None:
# try:
# current_operation_code = int(match.group(4))
# except:
# except Exception:
# pass # A line with just * will match too.
# continue
# NOTE: Letting it continue allows it to react to the
@ -1082,7 +1082,7 @@ class Gerber(Geometry):
geo_dict['clear'] = geo_s
else:
geo_dict['solid'] = geo_s
except:
except Exception:
if self.app.defaults['gerber_simplification']:
poly_buffer.append(geo_s.simplify(s_tol))
else:
@ -1434,7 +1434,7 @@ class Gerber(Geometry):
# for poly in new_poly:
# try:
# self.solid_geometry = self.solid_geometry.union(poly)
# except:
# except Exception:
# pass
else:
self.solid_geometry = self.solid_geometry.difference(new_poly)
@ -1661,7 +1661,7 @@ class Gerber(Geometry):
try:
xfactor = float(xfactor)
except:
except Exception:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Scale factor has to be a number: integer or float."))
return
@ -1671,7 +1671,7 @@ class Gerber(Geometry):
else:
try:
yfactor = float(yfactor)
except:
except Exception:
self.app.inform.emit('[ERROR_NOTCL] %s' %
_("Scale factor has to be a number: integer or float."))
return

View File

@ -125,7 +125,7 @@ def path2shapely(path, object_type, res=1.0):
rings = MultiLineString(rings)
if len(rings) > 0:
if len(rings) == 1:
if len(rings) == 1 and not isinstance(rings, MultiLineString):
# Polygons are closed and require more than 2 points
if Point(rings[0][0]).almost_equals(Point(rings[0][-1])) and len(rings[0]) > 2:
geo_element = Polygon(rings[0])
@ -134,7 +134,7 @@ def path2shapely(path, object_type, res=1.0):
else:
try:
geo_element = Polygon(rings[0], rings[1:])
except Exception as e:
except Exception:
coords = list()
for line in rings:
coords.append(line.coords[0])

View File

@ -423,7 +423,7 @@ class ToolCalibrateExcellon(FlatCAMTool):
# ## Adjust Objects Button
self.adj_obj_button = QtWidgets.QPushButton(_("Adjust Objects"))
self.adj_obj_button.setToolTip(
_("Adjust (scale and / or skew) the objects\n"
_("Adjust (scale and/or skew) the objects\n"
"with the factors determined above.")
)
grid_lay.addWidget(self.adj_obj_button, 34, 0, 1, 3)

View File

@ -33,9 +33,9 @@ if '_' not in builtins.__dict__:
log = logging.getLogger('base')
class ToolCopperFill(FlatCAMTool):
class ToolCopperThieving(FlatCAMTool):
toolName = _("Copper Fill Tool")
toolName = _("Copper Thieving Tool")
def __init__(self, app):
FlatCAMTool.__init__(self, app)
@ -71,7 +71,7 @@ class ToolCopperFill(FlatCAMTool):
self.grbobj_label = QtWidgets.QLabel("<b>%s:</b>" % _("GERBER"))
self.grbobj_label.setToolTip(
_("Gerber Object to which will be added a copper fill.")
_("Gerber Object to which will be added a copper thieving.")
)
i_grid_lay.addWidget(self.grbobj_label, 0, 0)
@ -93,7 +93,7 @@ class ToolCopperFill(FlatCAMTool):
# CLEARANCE #
self.clearance_label = QtWidgets.QLabel('%s:' % _("Clearance"))
self.clearance_label.setToolTip(
_("This set the distance between the copper fill components\n"
_("This set the distance between the copper thieving components\n"
"(the polygon fill may be split in multiple polygons)\n"
"and the copper traces in the Gerber file.")
)
@ -126,16 +126,16 @@ class ToolCopperFill(FlatCAMTool):
], orientation='vertical', stretch=False)
self.reference_label = QtWidgets.QLabel(_("Reference:"))
self.reference_label.setToolTip(
_("- 'Itself' - the copper fill extent is based on the object that is copper cleared.\n "
_("- 'Itself' - the copper thieving extent is based on the object that is copper cleared.\n "
"- 'Area Selection' - left mouse click to start selection of the area to be filled.\n"
"- 'Reference Object' - will do copper filling within the area specified by another object.")
"- 'Reference Object' - will do copper thieving within the area specified by another object.")
)
grid_lay.addWidget(self.reference_label, 3, 0)
grid_lay.addWidget(self.reference_radio, 3, 1)
self.box_combo_type_label = QtWidgets.QLabel('%s:' % _("Ref. Type"))
self.box_combo_type_label.setToolTip(
_("The type of FlatCAM object to be used as copper filling reference.\n"
_("The type of FlatCAM object to be used as copper thieving reference.\n"
"It can be Gerber, Excellon or Geometry.")
)
self.box_combo_type = QtWidgets.QComboBox()
@ -178,8 +178,30 @@ class ToolCopperFill(FlatCAMTool):
self.bbox_type_label.hide()
self.bbox_type_radio.hide()
# ## Insert Copper Fill
self.fill_button = QtWidgets.QPushButton(_("Insert Copper Fill"))
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid_lay.addWidget(separator_line, 7, 0, 1, 2)
# Fill Type
self.fill_type_radio = RadioSet([
{'label': _('Solid'), 'value': 'solid'},
{"label": _("Dots Grid"), "value": "dot"},
{"label": _("Squares Grid"), "value": "square"},
{"label": _("Lines Grid"), "value": "line"}
], orientation='vertical', stretch=False)
self.fill_type_label = QtWidgets.QLabel(_("Fill Type:"))
self.fill_type_label.setToolTip(
_("- 'Solid' - copper thieving will be a solid polygon.\n "
"- 'Dots Grid' - the empty area will be filled with a pattern of dots.\n"
"- 'Squares Grid' - the empty area will be filled with a pattern of squares.\n"
"- 'Lines Grid' - the empty area will be filled with a pattern of lines.")
)
grid_lay.addWidget(self.fill_type_label, 8, 0)
grid_lay.addWidget(self.fill_type_radio, 8, 1)
# ## Insert Copper Thieving
self.fill_button = QtWidgets.QPushButton(_("Insert Copper thieving"))
self.fill_button.setToolTip(
_("Will add a polygon (may be split in multiple parts)\n"
"that will surround the actual Gerber traces at a certain distance.")
@ -188,7 +210,7 @@ class ToolCopperFill(FlatCAMTool):
self.layout.addStretch()
# Objects involved in Copper filling
# Objects involved in Copper thieving
self.grb_object = None
self.ref_obj = None
self.sel_rect = list()
@ -215,7 +237,7 @@ class ToolCopperFill(FlatCAMTool):
self.reference_radio.group_toggle_fn = self.on_toggle_reference
def run(self, toggle=True):
self.app.report_usage("ToolCopperFill()")
self.app.report_usage("ToolCopperThieving()")
if toggle:
# if the splitter is hidden, display it, else hide it but only if the current widget is the same
@ -240,19 +262,19 @@ class ToolCopperFill(FlatCAMTool):
self.set_tool_ui()
self.app.ui.notebook.setTabText(2, _("Copper Fill Tool"))
self.app.ui.notebook.setTabText(2, _("Copper Thieving Tool"))
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='ALT+F', **kwargs)
def set_tool_ui(self):
self.units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value()
self.clearance_entry.set_value(float(self.app.defaults["tools_copperfill_clearance"]))
self.margin_entry.set_value(float(self.app.defaults["tools_copperfill_margin"]))
self.reference_radio.set_value(self.app.defaults["tools_copperfill_reference"])
self.bbox_type_radio.set_value(self.app.defaults["tools_copperfill_box_type"])
self.geo_steps_per_circle = int(self.app.defaults["tools_copperfill_circle_steps"])
self.clearance_entry.set_value(float(self.app.defaults["tools_copper_thieving_clearance"]))
self.margin_entry.set_value(float(self.app.defaults["tools_copper_thieving_margin"]))
self.reference_radio.set_value(self.app.defaults["tools_copper_thieving_reference"])
self.bbox_type_radio.set_value(self.app.defaults["tools_copper_thieving_box_type"])
self.fill_type_radio.set_value(self.app.defaults["tools_copper_thieving_fill_type"])
self.geo_steps_per_circle = int(self.app.defaults["tools_copper_thieving_circle_steps"])
self.area_method = False
@ -281,20 +303,20 @@ class ToolCopperFill(FlatCAMTool):
self.bbox_type_radio.hide()
def execute(self):
self.app.call_source = "copperfill_tool"
self.app.call_source = "copper_thieving_tool"
self.clearance_val = self.clearance_entry.get_value()
self.margin_val = self.margin_entry.get_value()
reference_method = self.reference_radio.get_value()
# get the Gerber object on which the Copper fill will be inserted
# get the Gerber object on which the Copper thieving will be inserted
selection_index = self.grb_object_combo.currentIndex()
model_index = self.app.collection.index(selection_index, 0, self.grb_object_combo.rootModelIndex())
try:
self.grb_object = model_index.internalPointer().obj
except Exception as e:
log.debug("ToolCopperFill.execute() --> %s" % str(e))
log.debug("ToolCopperThieving.execute() --> %s" % str(e))
self.app.inform.emit('[WARNING_NOTCL] %s' % _("There is no Gerber object loaded ..."))
return 'fail'
@ -487,17 +509,17 @@ class ToolCopperFill(FlatCAMTool):
"""
if run_threaded:
proc = self.app.proc_container.new('%s ...' % _("Copper filling"))
proc = self.app.proc_container.new('%s ...' % _("Copper thieving"))
else:
self.app.proc_container.view.set_busy('%s ...' % _("Copper filling"))
self.app.proc_container.view.set_busy('%s ...' % _("Copper thieving"))
QtWidgets.QApplication.processEvents()
# #####################################################################
# ####### Read the parameters #########################################
# #####################################################################
log.debug("Copper Filling Tool started. Reading parameters.")
self.app.inform.emit(_("Copper Filling Tool started. Reading parameters."))
log.debug("Copper Thieving Tool started. Reading parameters.")
self.app.inform.emit(_("Copper Thieving Tool started. Reading parameters."))
ref_selected = self.reference_radio.get_value()
if c_val is None:
@ -512,8 +534,8 @@ class ToolCopperFill(FlatCAMTool):
# #########################################################################################
# Prepare isolation polygon. This will create the clearance over the Gerber features ######
# #########################################################################################
log.debug("Copper Filling Tool. Preparing isolation polygons.")
self.app.inform.emit(_("Copper Filling Tool. Preparing isolation polygons."))
log.debug("Copper Thieving Tool. Preparing isolation polygons.")
self.app.inform.emit(_("Copper Thieving Tool. Preparing isolation polygons."))
# variables to display the percentage of work done
geo_len = 0
@ -557,8 +579,8 @@ class ToolCopperFill(FlatCAMTool):
# #########################################################################################
# Prepare the area to fill with copper. ###################################################
# #########################################################################################
log.debug("Copper Filling Tool. Preparing areas to fill with copper.")
self.app.inform.emit(_("Copper Filling Tool. Preparing areas to fill with copper."))
log.debug("Copper Thieving Tool. Preparing areas to fill with copper.")
self.app.inform.emit(_("Copper Thieving Tool. Preparing areas to fill with copper."))
try:
if ref_obj is None or ref_obj == 'itself':
@ -566,7 +588,7 @@ class ToolCopperFill(FlatCAMTool):
else:
working_obj = ref_obj
except Exception as e:
log.debug("ToolCopperFIll.on_copper_fill() --> %s" % str(e))
log.debug("ToolCopperThieving.on_copper_fill() --> %s" % str(e))
return 'fail'
bounding_box = None
@ -647,9 +669,9 @@ class ToolCopperFill(FlatCAMTool):
self.app.inform.emit('[ERROR_NOTCL] %s' % _("The reference object type is not supported."))
return 'fail'
log.debug("Copper Filling Tool. Finished creating areas to fill with copper.")
log.debug("Copper Thieving Tool. Finished creating areas to fill with copper.")
self.app.inform.emit(_("Copper Filling Tool. Appending new geometry and buffering."))
self.app.inform.emit(_("Copper Thieving Tool. Appending new geometry and buffering."))
new_solid_geometry = bounding_box.difference(clearance_geometry)
geo_list = self.grb_object.solid_geometry
@ -689,7 +711,7 @@ class ToolCopperFill(FlatCAMTool):
local_use=self.grb_object, use_thread=False)
self.on_exit()
self.app.inform.emit('[success] %s' % _("Copper Fill Tool done."))
self.app.inform.emit('[success] %s' % _("Copper Thieving Tool done."))
def replot(self, obj):
def worker_task():
@ -710,7 +732,7 @@ class ToolCopperFill(FlatCAMTool):
self.grb_object.options['xmax'] = c
self.grb_object.options['ymax'] = d
except Exception as e:
log.debug("ToolCopperFill.on_exit() bounds error --> %s" % str(e))
log.debug("ToolCopperThieving.on_exit() bounds error --> %s" % str(e))
# reset the variables
self.grb_object = None
@ -746,4 +768,4 @@ class ToolCopperFill(FlatCAMTool):
self.app.on_mouse_click_release_over_plot)
self.app.call_source = "app"
self.app.inform.emit('[success] %s' % _("Copper Fill Tool exit."))
self.app.inform.emit('[success] %s' % _("Copper Thieving Tool exit."))

View File

@ -112,10 +112,10 @@ class QRCode(FlatCAMTool):
self.error_label = QtWidgets.QLabel('%s:' % _("Error correction"))
self.error_label.setToolTip(
_("Parameter that controls the error correction used for the QR Code.\n"
"L = maximum 7% errors can be corrected\n"
"M = maximum 15% errors can be corrected\n"
"Q = maximum 25% errors can be corrected\n"
"H = maximum 30% errors can be corrected.")
"L = maximum 7%% errors can be corrected\n"
"M = maximum 15%% errors can be corrected\n"
"Q = maximum 25%% errors can be corrected\n"
"H = maximum 30%% errors can be corrected.")
)
self.error_radio = RadioSet([{'label': 'L', 'value': 'L'},
{'label': 'M', 'value': 'M'},
@ -123,10 +123,10 @@ class QRCode(FlatCAMTool):
{'label': 'H', 'value': 'H'}])
self.error_radio.setToolTip(
_("Parameter that controls the error correction used for the QR Code.\n"
"L = maximum 7% errors can be corrected\n"
"M = maximum 15% errors can be corrected\n"
"Q = maximum 25% errors can be corrected\n"
"H = maximum 30% errors can be corrected.")
"L = maximum 7%% errors can be corrected\n"
"M = maximum 15%% errors can be corrected\n"
"Q = maximum 25%% errors can be corrected\n"
"H = maximum 30%% errors can be corrected.")
)
grid_lay.addWidget(self.error_label, 2, 0)
grid_lay.addWidget(self.error_radio, 2, 1)

View File

@ -557,7 +557,7 @@ class SolderPaste(FlatCAMTool):
try:
dias = [float(eval(dia)) for dia in self.app.defaults["tools_solderpaste_tools"].split(",") if dia != '']
except:
except Exception:
log.error("At least one Nozzle tool diameter needed. "
"Verify in Edit -> Preferences -> TOOLS -> Solder Paste Tools.")
return
@ -675,7 +675,7 @@ class SolderPaste(FlatCAMTool):
if row is None:
try:
current_row = self.tools_table.currentRow()
except:
except Exception:
current_row = 0
else:
current_row = row

View File

@ -29,7 +29,7 @@ from flatcamTools.ToolProperties import Properties
from flatcamTools.ToolQRCode import QRCode
from flatcamTools.ToolRulesCheck import RulesCheck
from flatcamTools.ToolCopperFill import ToolCopperFill
from flatcamTools.ToolCopperThieving import ToolCopperThieving
from flatcamTools.ToolShell import FCShell
from flatcamTools.ToolSolderPaste import SolderPaste

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,7 @@ class TclCommandAddCircle(TclCommand):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except Exception as e:
except Exception:
return "Could not retrieve object: %s" % obj_name
if obj is None:
return "Object not found: %s" % obj_name

View File

@ -58,7 +58,7 @@ class TclCommandAddRectangle(TclCommandSignaled):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except Exception as e:
except Exception:
return "Could not retrieve object: %s" % obj_name
if obj is None:
return "Object not found: %s" % obj_name

View File

@ -81,7 +81,7 @@ class TclCommandAlignDrill(TclCommandSignaled):
# Get source object.
try:
obj = self.app.collection.get_by_name(str(name))
except:
except Exception:
return "Could not retrieve object: %s" % name
if obj is None:
@ -179,7 +179,7 @@ class TclCommandAlignDrill(TclCommandSignaled):
if 'box' in args:
try:
box = self.app.collection.get_by_name(args['box'])
except:
except Exception:
return "Could not retrieve object box: %s" % args['box']
if box is None:

View File

@ -52,7 +52,7 @@ class TclCommandGeoUnion(TclCommand):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except:
except Exception:
return "Could not retrieve object: %s" % obj_name
if obj is None:
return "Object not found: %s" % obj_name

View File

@ -75,7 +75,7 @@ class TclCommandMillSlots(TclCommandSignaled):
try:
obj = self.app.collection.get_by_name(str(name))
except:
except Exception:
obj = None
self.raise_tcl_error("Could not retrieve object: %s" % name)

View File

@ -57,7 +57,7 @@ class TclCommandMirror(TclCommandSignaled):
# Get source object.
try:
obj = self.app.collection.get_by_name(str(name))
except Exception as e:
except Exception:
return "Could not retrieve object: %s" % name
if obj is None:
@ -78,7 +78,7 @@ class TclCommandMirror(TclCommandSignaled):
if 'box' in args:
try:
box = self.app.collection.get_by_name(args['box'])
except Exception as e:
except Exception:
return "Could not retrieve object box: %s" % args['box']
if box is None:

View File

@ -80,7 +80,7 @@ class TclCommandPanelize(TclCommand):
boxname = args['box']
try:
box = self.app.collection.get_by_name(boxname)
except Exception as e:
except Exception:
return "Could not retrieve object: %s" % name
else:
box = obj

View File

@ -57,7 +57,7 @@ class TclCommandSubtractPoly(TclCommandSignaled):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except Exception as e:
except Exception:
return "Could not retrieve object: %s" % obj_name
if obj is None:
return "Object not found: %s" % obj_name

View File

@ -70,8 +70,9 @@ class TclCommandSubtractRectangle(TclCommandSignaled):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except Exception as e:
except Exception:
return "Could not retrieve object: %s" % obj_name
if obj is None:
return "Object not found: %s" % obj_name

View File

@ -90,7 +90,7 @@ class TclCommandWriteGCode(TclCommandSignaled):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except Exception as e:
except Exception:
if muted == 0:
return "Could not retrieve object: %s" % obj_name
else: