From 196044426cdd40b8570888c6dd0e57b4d827b7b5 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 31 Oct 2021 14:20:47 +0200 Subject: [PATCH] - fixed an exception that was triggered when toggling units inside the Editors --- CHANGELOG.md | 1 + app_Main.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b4e2267..263d7960 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ CHANGELOG for FlatCAM beta - in Markers Plugin added utility geometry for the manual mode - 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) +- fixed an exception that was triggered when toggling units inside the Editors 30.10.2021 diff --git a/app_Main.py b/app_Main.py index c78cc43c..79c5f670 100644 --- a/app_Main.py +++ b/app_Main.py @@ -4692,19 +4692,25 @@ class App(QtCore.QObject): self.ui.units_label.setText("[" + units.lower() + "]") 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 factor != 1: # means we had a unit change in the rest of the app if self.app_units != new_units: 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 # update th new units in the preferences storage self.app_units = new_units - def scale_preferenes(self, sfactor, new_units): + def scale_preferences(self, sfactor, new_units): self.preferencesUiManager.defaults_read_form() # update the defaults from form, some may assume that the conversion is enough and it's not