- fixed the problem with using comma as decimal separator in Grid Snap fields

This commit is contained in:
Marius Stanciu 2020-05-10 13:50:24 +03:00 committed by Marius
parent 541813c22b
commit f81be6f0a9
2 changed files with 20 additions and 6 deletions

View File

@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
================================================= =================================================
10.05.2020
- fixed the problem with using comma as decimal separator in Grid Snap fields
9.05.2020 9.05.2020
- modified the GUI for Exclusion areas; now the shapes are displayed in a Table where they can be selected and deleted. Modification applied for Geometry Objects only (for now). - modified the GUI for Exclusion areas; now the shapes are displayed in a Table where they can be selected and deleted. Modification applied for Geometry Objects only (for now).

View File

@ -3467,22 +3467,32 @@ class FlatCAMGeoEditor(QtCore.QObject):
:return: :return:
""" """
try: try:
self.options[opt] = float(entry.text()) text_value = entry.text()
if ',' in text_value:
text_value = text_value.replace(',', '.')
self.options[opt] = float(text_value)
except Exception as e: except Exception as e:
entry.set_value(self.app.defaults[opt])
log.debug("FlatCAMGeoEditor.__init__().entry2option() --> %s" % str(e)) log.debug("FlatCAMGeoEditor.__init__().entry2option() --> %s" % str(e))
return return
def gridx_changed(goption, gentry): def grid_changed(goption, gentry):
""" """
:param goption: String. Can be either 'global_gridx' or 'global_gridy' :param goption: String. Can be either 'global_gridx' or 'global_gridy'
:param gentry: A GUI element which text value is read and used :param gentry: A GUI element which text value is read and used
:return: :return:
""" """
if goption not in ['global_gridx', 'global_gridy']:
return
entry2option(opt=goption, entry=gentry) entry2option(opt=goption, entry=gentry)
# if the grid link is checked copy the value in the GridX field to GridY # if the grid link is checked copy the value in the GridX field to GridY
try: try:
val = float(gentry.get_value()) text_value = gentry.text()
if ',' in text_value:
text_value = text_value.replace(',', '.')
val = float(text_value)
except ValueError: except ValueError:
return return
@ -3491,7 +3501,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
self.app.ui.grid_gap_x_entry.setValidator(QtGui.QDoubleValidator()) self.app.ui.grid_gap_x_entry.setValidator(QtGui.QDoubleValidator())
self.app.ui.grid_gap_x_entry.textChanged.connect( self.app.ui.grid_gap_x_entry.textChanged.connect(
lambda: gridx_changed("global_gridx", self.app.ui.grid_gap_x_entry)) lambda: grid_changed("global_gridx", self.app.ui.grid_gap_x_entry))
self.app.ui.grid_gap_y_entry.setValidator(QtGui.QDoubleValidator()) self.app.ui.grid_gap_y_entry.setValidator(QtGui.QDoubleValidator())
self.app.ui.grid_gap_y_entry.textChanged.connect( self.app.ui.grid_gap_y_entry.textChanged.connect(