- fixed an exception that was triggered when toggling units inside the Editors
This commit is contained in:
@@ -13,6 +13,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
- in Markers Plugin added utility geometry for the manual mode
|
- in Markers Plugin added utility geometry for the manual mode
|
||||||
- refactored the is_legacy object to use_3d_engine
|
- refactored the is_legacy object to use_3d_engine
|
||||||
- made sure that there is no longer a double action when toggling the object visibility ('plot' attribute)
|
- made sure that there is no longer a double action when toggling the object visibility ('plot' attribute)
|
||||||
|
- fixed an exception that was triggered when toggling units inside the Editors
|
||||||
|
|
||||||
30.10.2021
|
30.10.2021
|
||||||
|
|
||||||
|
|||||||
12
app_Main.py
12
app_Main.py
@@ -4692,19 +4692,25 @@ class App(QtCore.QObject):
|
|||||||
self.ui.units_label.setText("[" + units.lower() + "]")
|
self.ui.units_label.setText("[" + units.lower() + "]")
|
||||||
|
|
||||||
def on_toggle_units_click(self):
|
def on_toggle_units_click(self):
|
||||||
new_units, factor = self.on_toggle_units()
|
try:
|
||||||
|
new_units, factor = self.on_toggle_units()
|
||||||
|
except TypeError:
|
||||||
|
# hen the self.on_toggle_units() return only one value (maybe None) it means something went wrong,
|
||||||
|
# it will end up in this exception and and we should return
|
||||||
|
return
|
||||||
|
|
||||||
if self.ui.plot_tab_area.currentWidget().objectName() == "preferences_tab":
|
if self.ui.plot_tab_area.currentWidget().objectName() == "preferences_tab":
|
||||||
if factor != 1: # means we had a unit change in the rest of the app
|
if factor != 1: # means we had a unit change in the rest of the app
|
||||||
if self.app_units != new_units:
|
if self.app_units != new_units:
|
||||||
pref_factor = 25.4 if new_units == 'MM' else 1 / 25.4
|
pref_factor = 25.4 if new_units == 'MM' else 1 / 25.4
|
||||||
self.scale_preferenes(pref_factor, new_units)
|
self.scale_preferences(pref_factor, new_units)
|
||||||
|
|
||||||
self.defaults["units"] = new_units
|
self.defaults["units"] = new_units
|
||||||
|
|
||||||
# update th new units in the preferences storage
|
# update th new units in the preferences storage
|
||||||
self.app_units = new_units
|
self.app_units = new_units
|
||||||
|
|
||||||
def scale_preferenes(self, sfactor, new_units):
|
def scale_preferences(self, sfactor, new_units):
|
||||||
self.preferencesUiManager.defaults_read_form()
|
self.preferencesUiManager.defaults_read_form()
|
||||||
|
|
||||||
# update the defaults from form, some may assume that the conversion is enough and it's not
|
# update the defaults from form, some may assume that the conversion is enough and it's not
|
||||||
|
|||||||
Reference in New Issue
Block a user