- fixed bug in FCSpinner and FCDoubleSpinner GUI elements, that are now the main GUI element in FlatCAM, that made partial selection difficult
- updated the Paint Tool in Geometry Editor to use the FCDoublepinbox - added the possibility for suffix presence on the FCSpinner and FCDoubleSpinner GUI Elements - added the '%' symbol for overlap fields; I still need to divide the conntet by 100 to get the original decimal
This commit is contained in:
parent
65f00ccad7
commit
0de96a377e
|
@ -2690,7 +2690,7 @@ class App(QtCore.QObject):
|
||||||
|
|
||||||
if self.old_defaults_found is True:
|
if self.old_defaults_found is True:
|
||||||
self.inform.emit('[WARNING_NOTCL] %s' % _("Found old default preferences files. "
|
self.inform.emit('[WARNING_NOTCL] %s' % _("Found old default preferences files. "
|
||||||
"Please reboot the application"))
|
"Please reboot the application to update."))
|
||||||
self.old_defaults_found = False
|
self.old_defaults_found = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -13,6 +13,10 @@ CAD program, and create G-Code for Isolation routing.
|
||||||
|
|
||||||
- made sure that if an older preferences file is detected then there are no errors and only the parameters that are currently active are loaded; the factory defaults file is deleted and recreated in the new format
|
- made sure that if an older preferences file is detected then there are no errors and only the parameters that are currently active are loaded; the factory defaults file is deleted and recreated in the new format
|
||||||
- in Preferences added a new button: 'Close' to close the Preferences window without saving
|
- in Preferences added a new button: 'Close' to close the Preferences window without saving
|
||||||
|
- fixed bug in FCSpinner and FCDoubleSpinner GUI elements, that are now the main GUI element in FlatCAM, that made partial selection difficult
|
||||||
|
- updated the Paint Tool in Geometry Editor to use the FCDoublepinbox
|
||||||
|
- added the possibility for suffix presence on the FCSpinner and FCDoubleSpinner GUI Elements
|
||||||
|
- added the '%' symbol for overlap fields; I still need to divide the conntet by 100 to get the original decimal
|
||||||
|
|
||||||
3.12.2019
|
3.12.2019
|
||||||
|
|
||||||
|
|
|
@ -418,6 +418,7 @@ class PaintOptionsTool(FlatCAMTool):
|
||||||
|
|
||||||
self.app = app
|
self.app = app
|
||||||
self.fcdraw = fcdraw
|
self.fcdraw = fcdraw
|
||||||
|
self.decimals = 4
|
||||||
|
|
||||||
# Title
|
# Title
|
||||||
title_label = QtWidgets.QLabel("%s" % ('Editor ' + self.toolName))
|
title_label = QtWidgets.QLabel("%s" % ('Editor ' + self.toolName))
|
||||||
|
@ -432,6 +433,8 @@ class PaintOptionsTool(FlatCAMTool):
|
||||||
|
|
||||||
grid = QtWidgets.QGridLayout()
|
grid = QtWidgets.QGridLayout()
|
||||||
self.layout.addLayout(grid)
|
self.layout.addLayout(grid)
|
||||||
|
grid.setColumnStretch(0, 0)
|
||||||
|
grid.setColumnStretch(1, 1)
|
||||||
|
|
||||||
# Tool dia
|
# Tool dia
|
||||||
ptdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
|
ptdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
|
||||||
|
@ -441,7 +444,9 @@ class PaintOptionsTool(FlatCAMTool):
|
||||||
)
|
)
|
||||||
grid.addWidget(ptdlabel, 0, 0)
|
grid.addWidget(ptdlabel, 0, 0)
|
||||||
|
|
||||||
self.painttooldia_entry = FCEntry()
|
self.painttooldia_entry = FCDoubleSpinner()
|
||||||
|
self.painttooldia_entry.set_range(-9999.9999, 9999.9999)
|
||||||
|
self.painttooldia_entry.set_precision(self.decimals)
|
||||||
grid.addWidget(self.painttooldia_entry, 0, 1)
|
grid.addWidget(self.painttooldia_entry, 0, 1)
|
||||||
|
|
||||||
# Overlap
|
# Overlap
|
||||||
|
@ -457,9 +462,13 @@ class PaintOptionsTool(FlatCAMTool):
|
||||||
"Higher values = slow processing and slow execution on CNC\n"
|
"Higher values = slow processing and slow execution on CNC\n"
|
||||||
"due of too many paths.")
|
"due of too many paths.")
|
||||||
)
|
)
|
||||||
|
self.paintoverlap_entry = FCDoubleSpinner(suffix='%')
|
||||||
|
self.paintoverlap_entry.set_range(0.0000, 1.0000)
|
||||||
|
self.paintoverlap_entry.set_precision(self.decimals)
|
||||||
|
self.paintoverlap_entry.setWrapping(True)
|
||||||
|
self.paintoverlap_entry.setSingleStep(0.1)
|
||||||
|
|
||||||
grid.addWidget(ovlabel, 1, 0)
|
grid.addWidget(ovlabel, 1, 0)
|
||||||
self.paintoverlap_entry = FCEntry()
|
|
||||||
self.paintoverlap_entry.setValidator(QtGui.QDoubleValidator(0.0000, 1.0000, 4))
|
|
||||||
grid.addWidget(self.paintoverlap_entry, 1, 1)
|
grid.addWidget(self.paintoverlap_entry, 1, 1)
|
||||||
|
|
||||||
# Margin
|
# Margin
|
||||||
|
@ -469,8 +478,11 @@ class PaintOptionsTool(FlatCAMTool):
|
||||||
"the edges of the polygon to\n"
|
"the edges of the polygon to\n"
|
||||||
"be painted.")
|
"be painted.")
|
||||||
)
|
)
|
||||||
|
self.paintmargin_entry = FCDoubleSpinner()
|
||||||
|
self.paintmargin_entry.set_range(-9999.9999, 9999.9999)
|
||||||
|
self.paintmargin_entry.set_precision(self.decimals)
|
||||||
|
|
||||||
grid.addWidget(marginlabel, 2, 0)
|
grid.addWidget(marginlabel, 2, 0)
|
||||||
self.paintmargin_entry = FCEntry()
|
|
||||||
grid.addWidget(self.paintmargin_entry, 2, 1)
|
grid.addWidget(self.paintmargin_entry, 2, 1)
|
||||||
|
|
||||||
# Method
|
# Method
|
||||||
|
@ -480,12 +492,13 @@ class PaintOptionsTool(FlatCAMTool):
|
||||||
"<B>Standard</B>: Fixed step inwards.<BR>"
|
"<B>Standard</B>: Fixed step inwards.<BR>"
|
||||||
"<B>Seed-based</B>: Outwards from seed.")
|
"<B>Seed-based</B>: Outwards from seed.")
|
||||||
)
|
)
|
||||||
grid.addWidget(methodlabel, 3, 0)
|
|
||||||
self.paintmethod_combo = RadioSet([
|
self.paintmethod_combo = RadioSet([
|
||||||
{"label": _("Standard"), "value": "standard"},
|
{"label": _("Standard"), "value": "standard"},
|
||||||
{"label": _("Seed-based"), "value": "seed"},
|
{"label": _("Seed-based"), "value": "seed"},
|
||||||
{"label": _("Straight lines"), "value": "lines"}
|
{"label": _("Straight lines"), "value": "lines"}
|
||||||
], orientation='vertical', stretch=False)
|
], orientation='vertical', stretch=False)
|
||||||
|
|
||||||
|
grid.addWidget(methodlabel, 3, 0)
|
||||||
grid.addWidget(self.paintmethod_combo, 3, 1)
|
grid.addWidget(self.paintmethod_combo, 3, 1)
|
||||||
|
|
||||||
# Connect lines
|
# Connect lines
|
||||||
|
@ -494,8 +507,9 @@ class PaintOptionsTool(FlatCAMTool):
|
||||||
_("Draw lines between resulting\n"
|
_("Draw lines between resulting\n"
|
||||||
"segments to minimize tool lifts.")
|
"segments to minimize tool lifts.")
|
||||||
)
|
)
|
||||||
grid.addWidget(pathconnectlabel, 4, 0)
|
|
||||||
self.pathconnect_cb = FCCheckBox()
|
self.pathconnect_cb = FCCheckBox()
|
||||||
|
|
||||||
|
grid.addWidget(pathconnectlabel, 4, 0)
|
||||||
grid.addWidget(self.pathconnect_cb, 4, 1)
|
grid.addWidget(self.pathconnect_cb, 4, 1)
|
||||||
|
|
||||||
contourlabel = QtWidgets.QLabel(_("Contour:"))
|
contourlabel = QtWidgets.QLabel(_("Contour:"))
|
||||||
|
@ -503,8 +517,9 @@ class PaintOptionsTool(FlatCAMTool):
|
||||||
_("Cut around the perimeter of the polygon\n"
|
_("Cut around the perimeter of the polygon\n"
|
||||||
"to trim rough edges.")
|
"to trim rough edges.")
|
||||||
)
|
)
|
||||||
grid.addWidget(contourlabel, 5, 0)
|
|
||||||
self.paintcontour_cb = FCCheckBox()
|
self.paintcontour_cb = FCCheckBox()
|
||||||
|
|
||||||
|
grid.addWidget(contourlabel, 5, 0)
|
||||||
grid.addWidget(self.paintcontour_cb, 5, 1)
|
grid.addWidget(self.paintcontour_cb, 5, 1)
|
||||||
|
|
||||||
# Buttons
|
# Buttons
|
||||||
|
@ -569,40 +584,10 @@ class PaintOptionsTool(FlatCAMTool):
|
||||||
_("Paint cancelled. No shape selected."))
|
_("Paint cancelled. No shape selected."))
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
tooldia = float(self.painttooldia_entry.get_value())
|
||||||
tooldia = float(self.painttooldia_entry.get_value())
|
overlap = float(self.paintoverlap_entry.get_value())
|
||||||
except ValueError:
|
margin = float(self.paintmargin_entry.get_value())
|
||||||
# try to convert comma to decimal point. if it's still not working error message and return
|
|
||||||
try:
|
|
||||||
tooldia = float(self.painttooldia_entry.get_value().replace(',', '.'))
|
|
||||||
self.painttooldia_entry.set_value(tooldia)
|
|
||||||
except ValueError:
|
|
||||||
self.app.inform.emit('[WARNING_NOTCL] %s' %
|
|
||||||
_("Tool diameter value is missing or wrong format. Add it and retry."))
|
|
||||||
return
|
|
||||||
try:
|
|
||||||
overlap = float(self.paintoverlap_entry.get_value())
|
|
||||||
except ValueError:
|
|
||||||
# try to convert comma to decimal point. if it's still not working error message and return
|
|
||||||
try:
|
|
||||||
overlap = float(self.paintoverlap_entry.get_value().replace(',', '.'))
|
|
||||||
self.paintoverlap_entry.set_value(overlap)
|
|
||||||
except ValueError:
|
|
||||||
self.app.inform.emit('[WARNING_NOTCL] %s' %
|
|
||||||
_("Overlap value is missing or wrong format. Add it and retry."))
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
margin = float(self.paintmargin_entry.get_value())
|
|
||||||
except ValueError:
|
|
||||||
# try to convert comma to decimal point. if it's still not working error message and return
|
|
||||||
try:
|
|
||||||
margin = float(self.paintmargin_entry.get_value().replace(',', '.'))
|
|
||||||
self.paintmargin_entry.set_value(margin)
|
|
||||||
except ValueError:
|
|
||||||
self.app.inform.emit('[WARNING_NOTCL] %s' %
|
|
||||||
_("Margin distance value is missing or wrong format. Add it and retry."))
|
|
||||||
return
|
|
||||||
method = self.paintmethod_combo.get_value()
|
method = self.paintmethod_combo.get_value()
|
||||||
contour = self.paintcontour_cb.get_value()
|
contour = self.paintcontour_cb.get_value()
|
||||||
connect = self.pathconnect_cb.get_value()
|
connect = self.pathconnect_cb.get_value()
|
||||||
|
@ -4609,27 +4594,25 @@ class FlatCAMGeoEditor(QtCore.QObject):
|
||||||
|
|
||||||
def paint(self, tooldia, overlap, margin, connect, contour, method):
|
def paint(self, tooldia, overlap, margin, connect, contour, method):
|
||||||
|
|
||||||
|
if overlap >= 1:
|
||||||
|
self.app.inform.emit('[ERROR_NOTCL] %s' %
|
||||||
|
_("Could not do Paint. Overlap value has to be less than 1.00 (100%%)."))
|
||||||
|
return
|
||||||
|
|
||||||
self.paint_tooldia = tooldia
|
self.paint_tooldia = tooldia
|
||||||
selected = self.get_selected()
|
selected = self.get_selected()
|
||||||
|
|
||||||
if len(selected) == 0:
|
if len(selected) == 0:
|
||||||
self.app.inform.emit('[WARNING_NOTCL] %s' %
|
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Nothing selected for painting."))
|
||||||
_("Nothing selected for painting."))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for param in [tooldia, overlap, margin]:
|
for param in [tooldia, overlap, margin]:
|
||||||
if not isinstance(param, float):
|
if not isinstance(param, float):
|
||||||
param_name = [k for k, v in locals().items() if v is param][0]
|
param_name = [k for k, v in locals().items() if v is param][0]
|
||||||
self.app.inform.emit('[WARNING] %s: %s' %
|
self.app.inform.emit('[WARNING] %s: %s' % (_("Invalid value for"), str(param)))
|
||||||
(_("Invalid value for"), str(param)))
|
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
if overlap >= 1:
|
|
||||||
self.app.inform.emit('[ERROR_NOTCL] %s' %
|
|
||||||
_("Could not do Paint. Overlap value has to be less than 1.00 (100%%)."))
|
|
||||||
return
|
|
||||||
|
|
||||||
def recurse(geometry, reset=True):
|
def recurse(geometry, reset=True):
|
||||||
"""
|
"""
|
||||||
Creates a list of non-iterable linear geometry objects.
|
Creates a list of non-iterable linear geometry objects.
|
||||||
|
|
|
@ -511,14 +511,20 @@ class FCSpinner(QtWidgets.QSpinBox):
|
||||||
|
|
||||||
returnPressed = QtCore.pyqtSignal()
|
returnPressed = QtCore.pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, suffix=None, parent=None):
|
||||||
super(FCSpinner, self).__init__(parent)
|
super(FCSpinner, self).__init__(parent)
|
||||||
self.readyToEdit = True
|
self.readyToEdit = True
|
||||||
self.editingFinished.connect(self.on_edit_finished)
|
self.editingFinished.connect(self.on_edit_finished)
|
||||||
self.lineEdit().installEventFilter(self)
|
self.lineEdit().installEventFilter(self)
|
||||||
|
|
||||||
|
if suffix:
|
||||||
|
self.setSuffix(' %s' % str(suffix))
|
||||||
|
|
||||||
|
self.prev_readyToEdit = True
|
||||||
|
|
||||||
def eventFilter(self, object, event):
|
def eventFilter(self, object, event):
|
||||||
if event.type() == QtCore.QEvent.MouseButtonPress:
|
if event.type() == QtCore.QEvent.MouseButtonPress and self.prev_readyToEdit is True:
|
||||||
|
self.prev_readyToEdit = False
|
||||||
if self.isEnabled():
|
if self.isEnabled():
|
||||||
if self.readyToEdit:
|
if self.readyToEdit:
|
||||||
self.lineEdit().selectAll()
|
self.lineEdit().selectAll()
|
||||||
|
@ -580,7 +586,7 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
|
||||||
|
|
||||||
returnPressed = QtCore.pyqtSignal()
|
returnPressed = QtCore.pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, suffix=None, parent=None):
|
||||||
super(FCDoubleSpinner, self).__init__(parent)
|
super(FCDoubleSpinner, self).__init__(parent)
|
||||||
self.readyToEdit = True
|
self.readyToEdit = True
|
||||||
|
|
||||||
|
@ -592,18 +598,26 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
|
||||||
self.lineEdit().setValidator(
|
self.lineEdit().setValidator(
|
||||||
QtGui.QRegExpValidator(QtCore.QRegExp("[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self))
|
QtGui.QRegExpValidator(QtCore.QRegExp("[0-9]*[.,]?[0-9]{%d}" % self.decimals()), self))
|
||||||
|
|
||||||
|
if suffix:
|
||||||
|
self.setSuffix(' %s' % str(suffix))
|
||||||
|
|
||||||
|
self.prev_readyToEdit = True
|
||||||
|
|
||||||
def on_edit_finished(self):
|
def on_edit_finished(self):
|
||||||
self.clearFocus()
|
self.clearFocus()
|
||||||
self.returnPressed.emit()
|
self.returnPressed.emit()
|
||||||
|
|
||||||
def eventFilter(self, object, event):
|
def eventFilter(self, object, event):
|
||||||
if event.type() == QtCore.QEvent.MouseButtonPress:
|
if event.type() == QtCore.QEvent.MouseButtonPress and self.prev_readyToEdit is True:
|
||||||
|
self.prev_readyToEdit = False
|
||||||
if self.isEnabled():
|
if self.isEnabled():
|
||||||
if self.readyToEdit:
|
if self.readyToEdit:
|
||||||
|
self.cursor_pos = self.lineEdit().cursorPosition()
|
||||||
self.lineEdit().selectAll()
|
self.lineEdit().selectAll()
|
||||||
self.readyToEdit = False
|
self.readyToEdit = False
|
||||||
else:
|
else:
|
||||||
self.lineEdit().deselect()
|
self.lineEdit().deselect()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -625,6 +639,7 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
|
||||||
super(FCDoubleSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut
|
super(FCDoubleSpinner, self).focusOutEvent(e) # required to remove cursor on focusOut
|
||||||
self.lineEdit().deselect()
|
self.lineEdit().deselect()
|
||||||
self.readyToEdit = True
|
self.readyToEdit = True
|
||||||
|
self.prev_readyToEdit = True
|
||||||
|
|
||||||
def valueFromText(self, p_str):
|
def valueFromText(self, p_str):
|
||||||
text = p_str.replace(',', '.')
|
text = p_str.replace(',', '.')
|
||||||
|
|
|
@ -376,7 +376,7 @@ class GerberObjectUI(ObjectUI):
|
||||||
"A value here of 0.25 means an overlap of 25%% from the tool diameter found above.")
|
"A value here of 0.25 means an overlap of 25%% from the tool diameter found above.")
|
||||||
)
|
)
|
||||||
overlabel.setMinimumWidth(90)
|
overlabel.setMinimumWidth(90)
|
||||||
self.iso_overlap_entry = FCDoubleSpinner()
|
self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
|
||||||
self.iso_overlap_entry.set_precision(self.decimals)
|
self.iso_overlap_entry.set_precision(self.decimals)
|
||||||
self.iso_overlap_entry.setWrapping(True)
|
self.iso_overlap_entry.setWrapping(True)
|
||||||
self.iso_overlap_entry.setRange(0.000, 0.999)
|
self.iso_overlap_entry.setRange(0.000, 0.999)
|
||||||
|
|
|
@ -328,8 +328,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||||
"Higher values = slow processing and slow execution on CNC\n"
|
"Higher values = slow processing and slow execution on CNC\n"
|
||||||
"due of too many paths.")
|
"due of too many paths.")
|
||||||
)
|
)
|
||||||
self.ncc_overlap_entry = FCDoubleSpinner()
|
self.ncc_overlap_entry = FCDoubleSpinner(suffix='%')
|
||||||
self.ncc_overlap_entry.set_precision(3)
|
self.ncc_overlap_entry.set_precision(self.decimals)
|
||||||
self.ncc_overlap_entry.setWrapping(True)
|
self.ncc_overlap_entry.setWrapping(True)
|
||||||
self.ncc_overlap_entry.setRange(0.000, 0.999)
|
self.ncc_overlap_entry.setRange(0.000, 0.999)
|
||||||
self.ncc_overlap_entry.setSingleStep(0.1)
|
self.ncc_overlap_entry.setSingleStep(0.1)
|
||||||
|
|
|
@ -228,7 +228,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||||
"Higher values = slow processing and slow execution on CNC\n"
|
"Higher values = slow processing and slow execution on CNC\n"
|
||||||
"due of too many paths.")
|
"due of too many paths.")
|
||||||
)
|
)
|
||||||
self.paintoverlap_entry = FCDoubleSpinner()
|
self.paintoverlap_entry = FCDoubleSpinner(suffix='%')
|
||||||
self.paintoverlap_entry.set_precision(3)
|
self.paintoverlap_entry.set_precision(3)
|
||||||
self.paintoverlap_entry.setWrapping(True)
|
self.paintoverlap_entry.setWrapping(True)
|
||||||
self.paintoverlap_entry.setRange(0.000, 0.999)
|
self.paintoverlap_entry.setRange(0.000, 0.999)
|
||||||
|
@ -958,14 +958,6 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||||
|
|
||||||
self.overlap = float(self.paintoverlap_entry.get_value())
|
self.overlap = float(self.paintoverlap_entry.get_value())
|
||||||
|
|
||||||
if self.overlap >= 1 or self.overlap < 0:
|
|
||||||
self.app.inform.emit('[ERROR_NOTCL] %s' %
|
|
||||||
_("Overlap value must be between 0 (inclusive) and 1 (exclusive)"))
|
|
||||||
return
|
|
||||||
|
|
||||||
self.app.inform.emit('[WARNING_NOTCL] %s' %
|
|
||||||
_("Click inside the desired polygon."))
|
|
||||||
|
|
||||||
self.connect = self.pathconnect_cb.get_value()
|
self.connect = self.pathconnect_cb.get_value()
|
||||||
self.contour = self.paintcontour_cb.get_value()
|
self.contour = self.paintcontour_cb.get_value()
|
||||||
self.select_method = self.selectmethod_combo.get_value()
|
self.select_method = self.selectmethod_combo.get_value()
|
||||||
|
@ -1012,8 +1004,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||||
continue
|
continue
|
||||||
self.tooldia_list.append(self.tooldia)
|
self.tooldia_list.append(self.tooldia)
|
||||||
else:
|
else:
|
||||||
self.app.inform.emit('[ERROR_NOTCL] %s' %
|
self.app.inform.emit('[ERROR_NOTCL] %s' % _("No selected tools in Tool Table."))
|
||||||
_("No selected tools in Tool Table."))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.select_method == "all":
|
if self.select_method == "all":
|
||||||
|
|
Loading…
Reference in New Issue