- minor changes
This commit is contained in:
@@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
- added a new GUI element, an InputDialog made out of FCSliderWithSpinner named FCInputDialogSlider
|
- added a new GUI element, an InputDialog made out of FCSliderWithSpinner named FCInputDialogSlider
|
||||||
- replaced the InputDialog in the Opacity pop menu for the objects in the Project Tab with a FCInputDialogSlider
|
- replaced the InputDialog in the Opacity pop menu for the objects in the Project Tab with a FCInputDialogSlider
|
||||||
|
- minor changes
|
||||||
|
|
||||||
23.10.2020
|
23.10.2020
|
||||||
|
|
||||||
|
|||||||
@@ -3419,57 +3419,15 @@ class AppGeoEditor(QtCore.QObject):
|
|||||||
|
|
||||||
self.rtree_index = rtindex.Index()
|
self.rtree_index = rtindex.Index()
|
||||||
|
|
||||||
def entry2option(opt, entry):
|
|
||||||
"""
|
|
||||||
|
|
||||||
:param opt: A option from the self.options dictionary
|
|
||||||
:param entry: A GUI element which text value is used
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
text_value = entry.text()
|
|
||||||
if ',' in text_value:
|
|
||||||
text_value = text_value.replace(',', '.')
|
|
||||||
self.options[opt] = float(text_value)
|
|
||||||
except Exception as e:
|
|
||||||
entry.set_value(self.app.defaults[opt])
|
|
||||||
log.debug("AppGeoEditor.__init__().entry2option() --> %s" % str(e))
|
|
||||||
return
|
|
||||||
|
|
||||||
def grid_changed(goption, gentry):
|
|
||||||
"""
|
|
||||||
|
|
||||||
:param goption: String. Can be either 'global_gridx' or 'global_gridy'
|
|
||||||
:param gentry: A GUI element which text value is read and used
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
if goption not in ['global_gridx', 'global_gridy']:
|
|
||||||
return
|
|
||||||
|
|
||||||
entry2option(opt=goption, entry=gentry)
|
|
||||||
# if the grid link is checked copy the value in the GridX field to GridY
|
|
||||||
try:
|
|
||||||
text_value = gentry.text()
|
|
||||||
if ',' in text_value:
|
|
||||||
text_value = text_value.replace(',', '.')
|
|
||||||
val = float(text_value)
|
|
||||||
except ValueError:
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.app.ui.grid_gap_link_cb.isChecked():
|
|
||||||
self.app.ui.grid_gap_y_entry.set_value(val, decimals=self.decimals)
|
|
||||||
|
|
||||||
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(self.on_gridx_val_changed)
|
||||||
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(self.on_gridy_val_changed)
|
||||||
lambda: entry2option("global_gridy", self.app.ui.grid_gap_y_entry))
|
|
||||||
|
|
||||||
self.app.ui.snap_max_dist_entry.setValidator(QtGui.QDoubleValidator())
|
self.app.ui.snap_max_dist_entry.setValidator(QtGui.QDoubleValidator())
|
||||||
self.app.ui.snap_max_dist_entry.textChanged.connect(
|
self.app.ui.snap_max_dist_entry.textChanged.connect(
|
||||||
lambda: entry2option("snap_max", self.app.ui.snap_max_dist_entry))
|
lambda: self.entry2option("snap_max", self.app.ui.snap_max_dist_entry))
|
||||||
|
|
||||||
# if using Paint store here the tool diameter used
|
# if using Paint store here the tool diameter used
|
||||||
self.paint_tooldia = None
|
self.paint_tooldia = None
|
||||||
@@ -3522,6 +3480,56 @@ class AppGeoEditor(QtCore.QObject):
|
|||||||
self.delete_selected()
|
self.delete_selected()
|
||||||
self.replot()
|
self.replot()
|
||||||
|
|
||||||
|
def entry2option(self, opt, entry):
|
||||||
|
"""
|
||||||
|
|
||||||
|
:param opt: A option from the self.options dictionary
|
||||||
|
:param entry: A GUI element which text value is used
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
text_value = entry.text()
|
||||||
|
if ',' in text_value:
|
||||||
|
text_value = text_value.replace(',', '.')
|
||||||
|
self.options[opt] = float(text_value)
|
||||||
|
except Exception as e:
|
||||||
|
entry.set_value(self.app.defaults[opt])
|
||||||
|
log.debug("AppGeoEditor.__init__().entry2option() --> %s" % str(e))
|
||||||
|
return
|
||||||
|
|
||||||
|
def grid_changed(self, goption, gentry):
|
||||||
|
"""
|
||||||
|
|
||||||
|
:param goption: String. Can be either 'global_gridx' or 'global_gridy'
|
||||||
|
:param gentry: A GUI element which text value is read and used
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
if goption not in ['global_gridx', 'global_gridy']:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.entry2option(opt=goption, entry=gentry)
|
||||||
|
# if the grid link is checked copy the value in the GridX field to GridY
|
||||||
|
try:
|
||||||
|
text_value = gentry.text()
|
||||||
|
if ',' in text_value:
|
||||||
|
text_value = text_value.replace(',', '.')
|
||||||
|
val = float(text_value)
|
||||||
|
except ValueError:
|
||||||
|
return
|
||||||
|
|
||||||
|
if self.app.ui.grid_gap_link_cb.isChecked():
|
||||||
|
self.app.ui.grid_gap_y_entry.set_value(val, decimals=self.decimals)
|
||||||
|
|
||||||
|
def on_gridx_val_changed(self):
|
||||||
|
self.grid_changed("global_gridx", self.app.ui.grid_gap_x_entry)
|
||||||
|
# try:
|
||||||
|
# self.app.defaults["global_gridx"] = float(self.app.ui.grid_gap_x_entry.get_value())
|
||||||
|
# except ValueError:
|
||||||
|
# return
|
||||||
|
|
||||||
|
def on_gridy_val_changed(self):
|
||||||
|
self.entry2option("global_gridy", self.app.ui.grid_gap_y_entry)
|
||||||
|
|
||||||
def set_ui(self):
|
def set_ui(self):
|
||||||
# updated units
|
# updated units
|
||||||
self.units = self.app.defaults['units'].upper()
|
self.units = self.app.defaults['units'].upper()
|
||||||
|
|||||||
Reference in New Issue
Block a user