- updated the GUI fields for the Scale and Offset in the Object UI to allow only numeric values and operators in the list [/,*,+,-], spaces, dots and comma
This commit is contained in:
parent
84ffa68cb0
commit
5f81d415a0
|
@ -667,6 +667,19 @@ class NumericalEvalEntry(EvalEntry):
|
||||||
validator = QtGui.QRegExpValidator(regex, self)
|
validator = QtGui.QRegExpValidator(regex, self)
|
||||||
self.setValidator(validator)
|
self.setValidator(validator)
|
||||||
|
|
||||||
|
|
||||||
|
class NumericalEvalTupleEntry(EvalEntry):
|
||||||
|
"""
|
||||||
|
Will evaluate the input and return a value. Accepts only float numbers and formulas using the operators: /,*,+,-,%
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
regex = QtCore.QRegExp("[0-9\/\*\+\-\%\.\s\,]*")
|
||||||
|
validator = QtGui.QRegExpValidator(regex, self)
|
||||||
|
self.setValidator(validator)
|
||||||
|
|
||||||
|
|
||||||
class FCSpinner(QtWidgets.QSpinBox):
|
class FCSpinner(QtWidgets.QSpinBox):
|
||||||
|
|
||||||
returnPressed = QtCore.pyqtSignal()
|
returnPressed = QtCore.pyqtSignal()
|
||||||
|
|
|
@ -114,7 +114,7 @@ class ObjectUI(QtWidgets.QWidget):
|
||||||
self.common_grid.addWidget(self.transform_label, 2, 0, 1, 2)
|
self.common_grid.addWidget(self.transform_label, 2, 0, 1, 2)
|
||||||
|
|
||||||
# ### Scale ####
|
# ### Scale ####
|
||||||
self.scale_entry = FCEntry()
|
self.scale_entry = NumericalEvalEntry()
|
||||||
self.scale_entry.set_value(1.0)
|
self.scale_entry.set_value(1.0)
|
||||||
self.scale_entry.setToolTip(
|
self.scale_entry.setToolTip(
|
||||||
_("Factor by which to multiply\n"
|
_("Factor by which to multiply\n"
|
||||||
|
@ -132,7 +132,7 @@ class ObjectUI(QtWidgets.QWidget):
|
||||||
self.common_grid.addWidget(self.scale_button, 3, 1)
|
self.common_grid.addWidget(self.scale_button, 3, 1)
|
||||||
|
|
||||||
# ### Offset ####
|
# ### Offset ####
|
||||||
self.offsetvector_entry = EvalEntry2()
|
self.offsetvector_entry = NumericalEvalTupleEntry()
|
||||||
self.offsetvector_entry.setText("(0.0, 0.0)")
|
self.offsetvector_entry.setText("(0.0, 0.0)")
|
||||||
self.offsetvector_entry.setToolTip(
|
self.offsetvector_entry.setToolTip(
|
||||||
_("Amount by which to move the object\n"
|
_("Amount by which to move the object\n"
|
||||||
|
|
|
@ -252,7 +252,7 @@ class FlatCAMObj(QtCore.QObject):
|
||||||
def on_scale_button_click(self):
|
def on_scale_button_click(self):
|
||||||
self.read_form()
|
self.read_form()
|
||||||
try:
|
try:
|
||||||
factor = float(eval(self.ui.scale_entry.get_value()))
|
factor = float(self.ui.scale_entry.get_value())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Scaling could not be executed."))
|
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Scaling could not be executed."))
|
||||||
log.debug("FlatCAMObj.on_scale_button_click() -- %s" % str(e))
|
log.debug("FlatCAMObj.on_scale_button_click() -- %s" % str(e))
|
||||||
|
|
|
@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
|
||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
25.05.2020
|
||||||
|
|
||||||
|
- updated the GUI fields for the Scale and Offset in the Object UI to allow only numeric values and operators in the list [/,*,+,-], spaces, dots and comma
|
||||||
|
|
||||||
24.05.2020
|
24.05.2020
|
||||||
|
|
||||||
- changes some icons
|
- changes some icons
|
||||||
|
|
Loading…
Reference in New Issue