- 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

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()