diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e900b52..0ae77a59 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta
27.09.2021
- in Gerber Object trying to solve the issue with too little details on plotting geometry with inch units
+- working to differentiate between temporary units change and permanent units change
26.09.2021
diff --git a/appCommon/Common.py b/appCommon/Common.py
index a5098b2c..f2d7fb33 100644
--- a/appCommon/Common.py
+++ b/appCommon/Common.py
@@ -603,7 +603,7 @@ class ExclusionAreas(QtCore.QObject):
# "%.4f " % (self.app.dx, self.app.dy))
self.app.ui.update_location_labels(self.dx, self.dy, curr_pos[0], curr_pos[1])
- units = self.app.defaults["units"].lower()
+ units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units)
@@ -741,7 +741,7 @@ class ExclusionAreas(QtCore.QObject):
buffered_storage = []
# add a little something to the half diameter, to make sure that we really don't enter in the exclusion zones
- buffered_distance = (tooldia / 2.0) + (0.1 if self.app.defaults['units'] == 'MM' else 0.00393701)
+ buffered_distance = (tooldia / 2.0) + (0.1 if self.app.app_units == 'MM' else 0.00393701)
for area in self.exclusion_areas_storage:
new_area = deepcopy(area)
diff --git a/appDatabase.py b/appDatabase.py
index 656f05c2..c3deb1cc 100644
--- a/appDatabase.py
+++ b/appDatabase.py
@@ -704,7 +704,7 @@ class ToolsDB2UI:
self.ncc_offset_spinner.setWrapping(True)
self.ncc_offset_spinner.setObjectName("gdb_n_offset_value")
- units = self.app.defaults['units'].upper()
+ units = self.app.app_units.upper()
if units == 'MM':
self.ncc_offset_spinner.setSingleStep(0.1)
else:
diff --git a/appEditors/AppExcEditor.py b/appEditors/AppExcEditor.py
index 306ce018..69e9b2cb 100644
--- a/appEditors/AppExcEditor.py
+++ b/appEditors/AppExcEditor.py
@@ -1745,7 +1745,7 @@ class AppExcEditor(QtCore.QObject):
self.app = app
self.canvas = self.app.plotcanvas
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.dec_format = self.app.dec_format
@@ -1961,7 +1961,7 @@ class AppExcEditor(QtCore.QObject):
def set_editor_ui(self):
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.olddia_newdia.clear()
self.tool2tooldia.clear()
@@ -2041,7 +2041,7 @@ class AppExcEditor(QtCore.QObject):
pass
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
# make a new name for the new Excellon object (the one with edited content)
self.edited_obj_name = self.edited_obj.options['name']
@@ -3439,7 +3439,7 @@ class AppExcEditor(QtCore.QObject):
# "%.4f " % (self.app.dx, self.app.dy))
self.app.ui.update_location_labels(self.app.dx, self.app.dy, x, y)
- units = self.app.defaults["units"].lower()
+ units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# self.app.dx, units, self.app.dy, units, x, units, y, units)
@@ -3971,7 +3971,7 @@ class AppExcEditorUI:
self.decimals = self.app.decimals
# ## Current application units in Upper Case
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.exc_edit_widget = QtWidgets.QWidget()
# ## Box for custom widgets
diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py
index c9d6c2b3..3adee42e 100644
--- a/appEditors/AppGeoEditor.py
+++ b/appEditors/AppGeoEditor.py
@@ -437,7 +437,7 @@ class TextInputTool(AppTool):
self.text_path = self.f_parse.font_to_geometry(char_string=string_to_geo, font_name=self.font_name,
font_size=font_to_geo_size,
font_type=font_to_geo_type,
- units=self.app.defaults['units'].upper())
+ units=self.app.app_units.upper())
def font_family(self, font):
self.text_input_entry.selectAll()
@@ -1581,7 +1581,7 @@ class TransformEditorTool(AppTool):
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Rotate cancelled"))
def on_offx_key(self):
- units = self.app.defaults['units'].lower()
+ units = self.app.app_units.lower()
val_box = FCInputDoubleSpinner(title=_("Offset on X axis ..."),
text='%s: (%s)' % (_('Enter a distance Value'), str(units)),
@@ -1599,7 +1599,7 @@ class TransformEditorTool(AppTool):
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Offset X cancelled"))
def on_offy_key(self):
- units = self.app.defaults['units'].lower()
+ units = self.app.app_units.lower()
val_box = FCInputDoubleSpinner(title=_("Offset on Y axis ..."),
text='%s: (%s)' % (_('Enter a distance Value'), str(units)),
@@ -3401,7 +3401,7 @@ class AppGeoEditor(QtCore.QObject):
self.app = app
self.canvas = app.plotcanvas
self.decimals = app.decimals
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
# when True the Editor can't do selection due of an ongoing process
self.interdict_selection = False
@@ -3889,7 +3889,7 @@ class AppGeoEditor(QtCore.QObject):
def set_editor_ui(self):
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.decimals = self.app.decimals
# Remove anything else in the GUI Selected Tab
@@ -4788,7 +4788,7 @@ class AppGeoEditor(QtCore.QObject):
# "%.4f " % (self.app.dx, self.app.dy))
self.app.ui.update_location_labels(self.app.dx, self.app.dy, x, y)
- units = self.app.defaults["units"].lower()
+ units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# self.app.dx, units, self.app.dy, units, x, units, y, units)
@@ -5314,7 +5314,7 @@ class AppGeoEditor(QtCore.QObject):
self.set_editor_ui()
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
# Hide original geometry
self.fcgeometry = fcgeometry
@@ -5367,7 +5367,7 @@ class AppGeoEditor(QtCore.QObject):
editor_obj.plot_all()
# updated units
- editor_obj.units = self.app.defaults['units'].upper()
+ editor_obj.units = self.app.app_units.upper()
editor_obj.decimals = self.app.decimals
# start with GRID toolbar activated
diff --git a/appEditors/AppGerberEditor.py b/appEditors/AppGerberEditor.py
index 8e79e2c3..61736084 100644
--- a/appEditors/AppGerberEditor.py
+++ b/appEditors/AppGerberEditor.py
@@ -3254,7 +3254,7 @@ class AppGerberEditor(QtCore.QObject):
self.decimals = self.app.decimals
# Current application units in Upper Case
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.ui = AppGerberEditorUI(self.app)
@@ -3504,7 +3504,7 @@ class AppGerberEditor(QtCore.QObject):
def set_editor_ui(self):
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.decimals = self.app.decimals
self.oldapcode_newapcode.clear()
@@ -3576,7 +3576,7 @@ class AppGerberEditor(QtCore.QObject):
pass
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
# make a new name for the new Excellon object (the one with edited content)
self.edited_obj_name = self.gerber_obj.options['name']
@@ -4536,7 +4536,7 @@ class AppGerberEditor(QtCore.QObject):
self.gerber_obj_options = orig_grb_obj.options
file_units = self.gerber_obj.units if self.gerber_obj.units else 'IN'
- app_units = self.app.defaults['units']
+ app_units = self.app.app_units
# self.conversion_factor = 25.4 if file_units == 'IN' else (1 / 25.4) if file_units != app_units else 1
if file_units == app_units:
@@ -4923,7 +4923,7 @@ class AppGerberEditor(QtCore.QObject):
grb_obj.multigeo = False
grb_obj.follow = False
- grb_obj.units = app_obj.defaults['units']
+ grb_obj.units = app_obj.app_units
try:
grb_obj.create_geometry()
@@ -5435,7 +5435,7 @@ class AppGerberEditor(QtCore.QObject):
# "%.4f " % (self.app.dx, self.app.dy))
self.app.ui.update_location_labels(self.app.dx, self.app.dy, x, y)
- units = self.app.defaults["units"].lower()
+ units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# self.app.dx, units, self.app.dy, units, x, units, y, units)
@@ -5937,7 +5937,7 @@ class AppGerberEditor(QtCore.QObject):
# clear previous marking
self.ma_annotation.clear(update=True)
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
text = []
position = []
@@ -6015,7 +6015,7 @@ class AppGerberEditorUI:
self.decimals = self.app.decimals
# ## Current application units in Upper Case
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.grb_edit_widget = QtWidgets.QWidget()
@@ -7599,7 +7599,7 @@ class TransformEditorTool(AppTool):
self.app.inform.emit('[WARNING_NOTCL] %s...' % _("Rotate cancelled"))
def on_offx_key(self):
- units = self.app.defaults['units'].lower()
+ units = self.app.app_units.lower()
val_box = FCInputDoubleSpinner(title=_("Offset on X axis ..."),
text='%s: (%s)' % (_('Enter a distance Value'), str(units)),
@@ -7617,7 +7617,7 @@ class TransformEditorTool(AppTool):
self.app.inform.emit('[WARNING_NOTCL] %s...' % _("Offset X cancelled"))
def on_offy_key(self):
- units = self.app.defaults['units'].lower()
+ units = self.app.app_units.lower()
val_box = FCInputDoubleSpinner(title=_("Offset on Y axis ..."),
text='%s: (%s)' % (_('Enter a distance Value'), str(units)),
diff --git a/appEditors/AppTextEditor.py b/appEditors/AppTextEditor.py
index 19edb031..5d8ebaa9 100644
--- a/appEditors/AppTextEditor.py
+++ b/appEditors/AppTextEditor.py
@@ -278,7 +278,7 @@ class AppTextEditor(QtWidgets.QWidget):
# styleH = styles['Heading1']
story = []
- if self.app.defaults['units'].lower() == 'mm':
+ if self.app.app_units.lower() == 'mm':
bmargin = self.app.defaults['global_tpdf_bmargin'] * mm
tmargin = self.app.defaults['global_tpdf_tmargin'] * mm
rmargin = self.app.defaults['global_tpdf_rmargin'] * mm
diff --git a/appEditors/appGCodeEditor.py b/appEditors/appGCodeEditor.py
index 14f848dc..aaeda0f9 100644
--- a/appEditors/appGCodeEditor.py
+++ b/appEditors/appGCodeEditor.py
@@ -728,7 +728,7 @@ class AppGCodeEditorUI:
self.decimals = self.app.decimals
# ## Current application units in Upper Case
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
# self.setSizePolicy(
# QtWidgets.QSizePolicy.Policy.MinimumExpanding,
diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py
index 5f1d2094..87d4c17e 100644
--- a/appGUI/MainGUI.py
+++ b/appGUI/MainGUI.py
@@ -3265,7 +3265,7 @@ class MainGUI(QtWidgets.QMainWindow):
# Change Units
if key == QtCore.Qt.Key.Key_Q:
- # if self.app.defaults["units"] == 'MM':
+ # if self.app.app_units == 'MM':
# self.app.ui.general_pref_form.general_app_group.units_radio.set_value("IN")
# else:
# self.app.ui.general_pref_form.general_app_group.units_radio.set_value("MM")
diff --git a/appGUI/PlotCanvas.py b/appGUI/PlotCanvas.py
index 4654c8e2..4ed37b31 100644
--- a/appGUI/PlotCanvas.py
+++ b/appGUI/PlotCanvas.py
@@ -313,7 +313,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
:rtype: None
"""
# units
- units = self.fcapp.defaults["units"].lower()
+ units = self.fcapp.app_units.lower()
dx_dec = str(self.fcapp.dec_format(dx, self.fcapp.decimals)) if dx else '0.0'
dy_dec = str(self.fcapp.dec_format(dy, self.fcapp.decimals)) if dy else '0.0'
@@ -416,7 +416,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
:return:
"""
try:
- if self.fcapp.defaults['units'].upper() == 'MM':
+ if self.fcapp.app_units.upper() == 'MM':
dims = self.pagesize_dict[workspace_size]
else:
dims = (self.pagesize_dict[workspace_size][0]/25.4, self.pagesize_dict[workspace_size][1]/25.4)
@@ -620,7 +620,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
# rect.right *= 1.04
# rect.top *= 1.04
- # units = self.fcapp.defaults['units'].upper()
+ # units = self.fcapp.app_units.upper()
# if units == 'MM':
# compensation = 0.5
# else:
diff --git a/appGUI/PlotCanvas3d.py b/appGUI/PlotCanvas3d.py
index b83d8a05..c7dfc4fc 100644
--- a/appGUI/PlotCanvas3d.py
+++ b/appGUI/PlotCanvas3d.py
@@ -162,7 +162,7 @@ class PlotCanvas3d(QtCore.QObject, scene.SceneCanvas):
fsize = 8
# units
- # units = self.fcapp.defaults["units"].upper()
+ # units = self.fcapp.app_units.upper()
# coordinates and anchors
height = fsize * 11 # 90. Constant 11 is something that works
diff --git a/appGUI/PlotCanvasLegacy.py b/appGUI/PlotCanvasLegacy.py
index 32285821..e3fa9dfe 100644
--- a/appGUI/PlotCanvasLegacy.py
+++ b/appGUI/PlotCanvasLegacy.py
@@ -446,7 +446,7 @@ class PlotCanvasLegacy(QtCore.QObject):
super().__init__()
self.p = plotcanvas
- units = self.p.app.defaults['units']
+ units = self.p.app.app_units
# self._text = 'Dx: %s [%s]\nDy: %s [%s]\n\nX: %s [%s]\nY: %s [%s]' % \
# ('0.0000', units, '0.0000', units, '0.0000', units, '0.0000', units)
self.on_update_text_hud()
@@ -509,7 +509,7 @@ class PlotCanvasLegacy(QtCore.QObject):
:return:
"""
# units
- units = self.p.app.defaults['units'].lower()
+ units = self.p.app.app_units.lower()
dx_dec = str(self.p.app.dec_format(dx, self.p.app.decimals)) if dx else '0.0'
dy_dec = str(self.p.app.dec_format(dy, self.p.app.decimals)) if dy else '0.0'
@@ -553,7 +553,7 @@ class PlotCanvasLegacy(QtCore.QObject):
:return:
"""
try:
- if self.app.defaults['units'].upper() == 'MM':
+ if self.app.app_units.upper() == 'MM':
dims = self.pagesize_dict[workspace_size]
else:
dims = (self.pagesize_dict[workspace_size][0] / 25.4, self.pagesize_dict[workspace_size][1] / 25.4)
diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py
index f994413a..3124eda3 100644
--- a/appGUI/preferences/PreferencesUIManager.py
+++ b/appGUI/preferences/PreferencesUIManager.py
@@ -33,8 +33,6 @@ class PreferencesUIManager:
self.inform = inform
self.ignore_tab_close_event = False
- self.preferences_units = "MM"
-
# if Preferences are changed in the Edit -> Preferences tab the value will be set to True
self.preferences_changed_flag = False
diff --git a/appObjects/FlatCAMCNCJob.py b/appObjects/FlatCAMCNCJob.py
index 2f551702..1c465bc9 100644
--- a/appObjects/FlatCAMCNCJob.py
+++ b/appObjects/FlatCAMCNCJob.py
@@ -163,7 +163,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
self.gcode_viewer_tab = None
self.source_file = ''
- self.units_found = self.app.defaults['units']
+ self.units_found = self.app.app_units
self.prepend_snippet = ''
self.append_snippet = ''
@@ -185,7 +185,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
FlatCAMObj.build_ui(self)
self.app.log.debug("CNCJobObject.build_ui()")
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
# if the FlatCAM object is Excellon don't build the CNC Tools Table but hide it
self.ui.cnc_tools_table.hide()
@@ -414,8 +414,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
assert isinstance(self.ui, CNCObjectUI), \
"Expected a CNCObjectUI, got %s" % type(self.ui)
- self.units = self.app.defaults['units'].upper()
- self.units_found = self.app.defaults['units']
+ self.units = self.app.app_units.upper()
+ self.units_found = self.app.app_units
# this signal has to be connected to it's slot before the defaults are populated
# the decision done in the slot has to override the default value set below
diff --git a/appObjects/FlatCAMDocument.py b/appObjects/FlatCAMDocument.py
index c8af83a3..6f8b8000 100644
--- a/appObjects/FlatCAMDocument.py
+++ b/appObjects/FlatCAMDocument.py
@@ -51,7 +51,7 @@ class DocumentObject(FlatCAMObj):
self.document_editor_tab = None
self._read_only = False
- self.units_found = self.app.defaults['units']
+ self.units_found = self.app.app_units
def set_ui(self, ui):
FlatCAMObj.set_ui(self, ui)
@@ -60,8 +60,8 @@ class DocumentObject(FlatCAMObj):
assert isinstance(self.ui, DocumentObjectUI), \
"Expected a DocumentObjectUI, got %s" % type(self.ui)
- self.units = self.app.defaults['units'].upper()
- self.units_found = self.app.defaults['units']
+ self.units = self.app.app_units.upper()
+ self.units_found = self.app.app_units
# Fill form fields only on object create
self.to_form()
diff --git a/appObjects/FlatCAMExcellon.py b/appObjects/FlatCAMExcellon.py
index a6929027..a9f73f93 100644
--- a/appObjects/FlatCAMExcellon.py
+++ b/appObjects/FlatCAMExcellon.py
@@ -94,7 +94,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
self.source_file = ""
self.multigeo = False
- self.units_found = self.app.defaults['units']
+ self.units_found = self.app.app_units
self.fill_color = self.app.defaults['excellon_plot_fill']
self.outline_color = self.app.defaults['excellon_plot_line']
@@ -121,7 +121,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
self.app.log.debug("ExcellonObject.set_ui()")
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
# # fill in self.options values for the Drilling Tool from self.app.options
# for opt_key, opt_val in self.app.options.items():
@@ -185,7 +185,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
self.ui.table_visibility_cb.stateChanged.connect(self.on_table_visibility_toggle)
- self.units_found = self.app.defaults['units']
+ self.units_found = self.app.app_units
self.set_offset_values()
@@ -251,7 +251,7 @@ class ExcellonObject(FlatCAMObj, Excellon):
"""
FlatCAMObj.build_ui(self)
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
for row in range(self.ui.tools_table.rowCount()):
try:
diff --git a/appObjects/FlatCAMGeometry.py b/appObjects/FlatCAMGeometry.py
index b864c5f7..42602866 100644
--- a/appObjects/FlatCAMGeometry.py
+++ b/appObjects/FlatCAMGeometry.py
@@ -141,7 +141,7 @@ class GeometryObject(FlatCAMObj, Geometry):
# self.old_pp_state = self.app.defaults["tools_mill_multidepth"]
# self.old_toolchangeg_state = self.app.defaults["tools_mill_toolchange"]
- self.units_found = self.app.defaults['units']
+ self.units_found = self.app.app_units
# this variable can be updated by the Object that generates the geometry
self.tool_type = 'C1'
@@ -171,7 +171,7 @@ class GeometryObject(FlatCAMObj, Geometry):
FlatCAMObj.build_ui(self)
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
row_idx = 0
@@ -300,8 +300,8 @@ class GeometryObject(FlatCAMObj, Geometry):
assert isinstance(self.ui, GeometryObjectUI), \
"Expected a GeometryObjectUI, got %s" % type(self.ui)
- self.units = self.app.defaults['units'].upper()
- self.units_found = self.app.defaults['units']
+ self.units = self.app.app_units.upper()
+ self.units_found = self.app.app_units
self.form_fields.update({
"plot": self.ui.plot_cb,
@@ -549,8 +549,8 @@ class GeometryObject(FlatCAMObj, Geometry):
msp = dwg.modelspace()
# add units
- dwg.units = ezdxf.InsertUnits(4) if self.app.defaults['units'].lower() == 'mm' else ezdxf.InsertUnits(1)
- dwg.header['$MEASUREMENT'] = 1 if self.app.defaults['units'].lower() == 'mm' else 0
+ dwg.units = ezdxf.InsertUnits(4) if self.app.app_units.lower() == 'mm' else ezdxf.InsertUnits(1)
+ dwg.header['$MEASUREMENT'] = 1 if self.app.app_units.lower() == 'mm' else 0
def g2dxf(dxf_space, geo_obj):
if isinstance(geo_obj, MultiPolygon):
diff --git a/appObjects/FlatCAMGerber.py b/appObjects/FlatCAMGerber.py
index 5e7ac62f..4d0d948a 100644
--- a/appObjects/FlatCAMGerber.py
+++ b/appObjects/FlatCAMGerber.py
@@ -91,7 +91,7 @@ class GerberObject(FlatCAMObj, Gerber):
# store the status of grid snapping
self.grid_status_memory = None
- self.units_found = self.app.defaults['units']
+ self.units_found = self.app.app_units
self.fill_color = self.app.defaults['gerber_plot_fill']
self.outline_color = self.app.defaults['gerber_plot_line']
@@ -120,7 +120,7 @@ class GerberObject(FlatCAMObj, Gerber):
FlatCAMObj.set_ui(self, ui)
log.debug("GerberObject.set_ui()")
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.replotApertures.connect(self.on_mark_cb_click_table)
@@ -195,7 +195,7 @@ class GerberObject(FlatCAMObj, Gerber):
self.on_aperture_table_visibility_change()
self.build_ui()
- self.units_found = self.app.defaults['units']
+ self.units_found = self.app.app_units
self.set_offset_values()
diff --git a/appObjects/FlatCAMObj.py b/appObjects/FlatCAMObj.py
index 495b0e40..7e0bb8da 100644
--- a/appObjects/FlatCAMObj.py
+++ b/appObjects/FlatCAMObj.py
@@ -118,7 +118,7 @@ class FlatCAMObj(QtCore.QObject):
self.selection_shape_drawn = False
# self.units = 'IN'
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
# this is the treeWidget from the UI; it is updated when the add_properties_items() method is called
self.treeWidget = None
@@ -530,7 +530,7 @@ class FlatCAMObj(QtCore.QObject):
log.error("FlatCAMObj.add_properties_items() -> calculate dimensions --> %s" % str(ee))
# calculate box area
- if self.app.defaults['units'].lower() == 'mm':
+ if self.app.app_units.lower() == 'mm':
area = (length * width) / 100
else:
area = length * width
@@ -586,7 +586,7 @@ class FlatCAMObj(QtCore.QObject):
width = abs(ymax - ymin)
# calculate box area
- if self.app.defaults['units'].lower() == 'mm':
+ if self.app.app_units.lower() == 'mm':
area = (length * width) / 100
else:
area = length * width
@@ -637,7 +637,7 @@ class FlatCAMObj(QtCore.QObject):
area_chull = None
log.error("FlatCAMObj.add_properties_items() area chull--> %s" % str(er))
- if self.app.defaults['units'].lower() == 'mm' and area_chull:
+ if self.app.app_units.lower() == 'mm' and area_chull:
area_chull = area_chull / 100
if area_chull is None:
@@ -726,7 +726,7 @@ class FlatCAMObj(QtCore.QObject):
toolid,
[
_('Diameter'),
- '%.*f %s' % (self.decimals, value['tooldia'], self.app.defaults['units'].lower())
+ '%.*f %s' % (self.decimals, value['tooldia'], self.app.app_units.lower())
],
True
)
@@ -792,7 +792,7 @@ class FlatCAMObj(QtCore.QObject):
exc_tool,
[
_('Diameter'),
- '%.*f %s' % (self.decimals, tool_dia, self.app.defaults['units'].lower())
+ '%.*f %s' % (self.decimals, tool_dia, self.app.app_units.lower())
],
True
)
@@ -820,7 +820,7 @@ class FlatCAMObj(QtCore.QObject):
'%.*f %s' % (
self.decimals,
(obj.z_cut - abs(value['data']['tools_drill_offset'])),
- self.app.defaults['units'].lower()
+ self.app.app_units.lower()
)
],
True
@@ -832,7 +832,7 @@ class FlatCAMObj(QtCore.QObject):
'%.*f %s' % (
self.decimals,
obj.z_move,
- self.app.defaults['units'].lower()
+ self.app.app_units.lower()
)
],
True
@@ -844,7 +844,7 @@ class FlatCAMObj(QtCore.QObject):
'%.*f %s/min' % (
self.decimals,
obj.feedrate,
- self.app.defaults['units'].lower()
+ self.app.app_units.lower()
)
],
True
@@ -874,7 +874,7 @@ class FlatCAMObj(QtCore.QObject):
others,
[
'%s:' % _('Travelled distance'),
- '%.*f %s' % (self.decimals, obj.travel_distance, self.app.defaults['units'].lower())
+ '%.*f %s' % (self.decimals, obj.travel_distance, self.app.app_units.lower())
],
True
)
@@ -886,17 +886,17 @@ class FlatCAMObj(QtCore.QObject):
# add dimensions
self.treeWidget.addChild(
location,
- ['%s:' % _('Length'), '%.*f %s' % (self.decimals, length, self.app.defaults['units'].lower())],
+ ['%s:' % _('Length'), '%.*f %s' % (self.decimals, length, self.app.app_units.lower())],
True
)
self.treeWidget.addChild(
location,
- ['%s:' % _('Width'), '%.*f %s' % (self.decimals, width, self.app.defaults['units'].lower())],
+ ['%s:' % _('Width'), '%.*f %s' % (self.decimals, width, self.app.app_units.lower())],
True
)
# add box area
- if self.app.defaults['units'].lower() == 'mm':
+ if self.app.app_units.lower() == 'mm':
self.treeWidget.addChild(location, ['%s:' % _('Box Area'), '%.*f %s' % (self.decimals, area, 'cm2')], True)
self.treeWidget.addChild(
location,
@@ -913,7 +913,7 @@ class FlatCAMObj(QtCore.QObject):
)
# add copper area
- if self.app.defaults['units'].lower() == 'mm':
+ if self.app.app_units.lower() == 'mm':
self.treeWidget.addChild(
location, ['%s:' % _('Copper Area'), '%.*f %s' % (self.decimals, copper_area, 'cm2')], True)
else:
@@ -960,13 +960,13 @@ class FlatCAMObj(QtCore.QObject):
@property
def drawing_tolerance(self):
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
tol = self._drawing_tolerance if self.units == 'MM' or not self.units else self._drawing_tolerance / 25.4
return tol
@drawing_tolerance.setter
def drawing_tolerance(self, value):
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self._drawing_tolerance = value if self.units == 'MM' or not self.units else value / 25.4
def clear(self, update=False):
diff --git a/appObjects/FlatCAMScript.py b/appObjects/FlatCAMScript.py
index 427d9964..0171c923 100644
--- a/appObjects/FlatCAMScript.py
+++ b/appObjects/FlatCAMScript.py
@@ -56,7 +56,7 @@ class ScriptObject(FlatCAMObj):
self.script_code = ''
self.script_filename = ''
- self.units_found = self.app.defaults['units']
+ self.units_found = self.app.app_units
def set_ui(self, ui):
"""
@@ -70,8 +70,8 @@ class ScriptObject(FlatCAMObj):
assert isinstance(self.ui, ScriptObjectUI), \
"Expected a ScriptObjectUI, got %s" % type(self.ui)
- self.units = self.app.defaults['units'].upper()
- self.units_found = self.app.defaults['units']
+ self.units = self.app.app_units.upper()
+ self.units_found = self.app.app_units
# Fill form fields only on object create
self.to_form()
diff --git a/appParsers/ParseExcellon.py b/appParsers/ParseExcellon.py
index 2da282ee..a4b14c23 100644
--- a/appParsers/ParseExcellon.py
+++ b/appParsers/ParseExcellon.py
@@ -90,8 +90,8 @@ class Excellon(Geometry):
self.match_routing_stop = None
# ## IN|MM -> Units are inherited from Geometry
- self.units = self.app.defaults['units']
- self.units_found = self.app.defaults['units']
+ self.units = self.app.app_units
+ self.units_found = self.app.app_units
# Trailing "T" or leading "L" (default)
# self.zeros = "T"
diff --git a/appParsers/ParseGerber.py b/appParsers/ParseGerber.py
index a8136f98..841e36f9 100644
--- a/appParsers/ParseGerber.py
+++ b/appParsers/ParseGerber.py
@@ -1948,7 +1948,7 @@ class Gerber(Geometry):
# w = float(svg_root.get('width'))
h = svgparselength(svg_root.get('height'))[0] # TODO: No units support yet
- units = self.app.defaults['units'] if units is None else units
+ units = self.app.app_units if units is None else units
res = self.app.defaults['gerber_circle_steps']
factor = svgparse_viewbox(svg_root)
geos = getsvggeo(svg_root, 'gerber', units=units, res=res, factor=factor, app=self.app)
diff --git a/appPlugins/ToolCalculators.py b/appPlugins/ToolCalculators.py
index 53bd3f5f..483bd851 100644
--- a/appPlugins/ToolCalculators.py
+++ b/appPlugins/ToolCalculators.py
@@ -110,7 +110,7 @@ class ToolCalculator(AppTool):
AppTool.install(self, icon, separator, shortcut='Alt+C', **kwargs)
def set_tool_ui(self):
- self.units = self.app.defaults['units'].lower()
+ self.units = self.app.app_units.lower()
self.clear_ui(self.layout)
self.ui = CalcUI(layout=self.layout, app=self.app)
@@ -513,7 +513,7 @@ class CalcUI:
self.app = app
self.decimals = self.app.decimals
self.layout = layout
- self.units = self.app.defaults['units'].lower()
+ self.units = self.app.app_units.lower()
# ## Title
title_label = FCLabel("%s" % self.pluginName)
diff --git a/appPlugins/ToolCalibration.py b/appPlugins/ToolCalibration.py
index b6591774..6b053ab1 100644
--- a/appPlugins/ToolCalibration.py
+++ b/appPlugins/ToolCalibration.py
@@ -148,7 +148,7 @@ class ToolCalibration(AppTool):
self.ui.reset_button.clicked.connect(self.set_tool_ui)
def set_tool_ui(self):
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.clear_ui(self.layout)
self.ui = CalibrationUI(layout=self.layout, app=self.app)
diff --git a/appPlugins/ToolCopperThieving.py b/appPlugins/ToolCopperThieving.py
index 495b231d..5829d76b 100644
--- a/appPlugins/ToolCopperThieving.py
+++ b/appPlugins/ToolCopperThieving.py
@@ -45,7 +45,7 @@ class ToolCopperThieving(AppTool):
self.canvas = self.app.plotcanvas
self.decimals = self.app.decimals
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
# #############################################################################
# ######################### Tool GUI ##########################################
@@ -161,7 +161,7 @@ class ToolCopperThieving(AppTool):
self.work_finished.connect(self.on_new_pattern_plating_object)
def set_tool_ui(self):
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
self.geo_steps_per_circle = int(self.app.defaults["tools_copper_thieving_circle_steps"])
self.clear_ui(self.layout)
@@ -519,7 +519,7 @@ class ToolCopperThieving(AppTool):
# "%.4f " % (self.app.dx, self.app.dy))
self.app.ui.update_location_labels(self.app.dx, self.app.dy, curr_pos[0], curr_pos[1])
- # units = self.app.defaults["units"].lower()
+ # units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units)
@@ -1267,7 +1267,7 @@ class ThievingUI:
def __init__(self, layout, app):
self.app = app
self.decimals = self.app.decimals
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
self.layout = layout
# ## Title
diff --git a/appPlugins/ToolCorners.py b/appPlugins/ToolCorners.py
index d15b5345..04fe8804 100644
--- a/appPlugins/ToolCorners.py
+++ b/appPlugins/ToolCorners.py
@@ -138,7 +138,7 @@ class ToolCorners(AppTool):
self.ui.sel_radio.activated_custom.connect(self.on_selection_changed)
def set_tool_ui(self):
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
self.clear_ui(self.layout)
self.ui = CornersUI(layout=self.layout, app=self.app)
diff --git a/appPlugins/ToolDistance.py b/appPlugins/ToolDistance.py
index 4f41c447..b651b8b8 100644
--- a/appPlugins/ToolDistance.py
+++ b/appPlugins/ToolDistance.py
@@ -39,7 +39,7 @@ class Distance(AppTool):
self.decimals = self.app.decimals
self.canvas = self.app.plotcanvas
- self.units = self.app.defaults['units'].lower()
+ self.units = self.app.app_units.lower()
# #############################################################################
# ######################### Tool GUI ##########################################
@@ -144,7 +144,7 @@ class Distance(AppTool):
# Switch notebook to tool page
self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab)
- self.units = self.app.defaults['units'].lower()
+ self.units = self.app.app_units.lower()
self.app.command_active = "Distance"
@@ -202,7 +202,7 @@ class Distance(AppTool):
self.original_call_source = copy(self.app.call_source)
self.app.inform.emit(_("MEASURING: Click on the Start point ..."))
- self.units = self.app.defaults['units'].lower()
+ self.units = self.app.app_units.lower()
# we can connect the app mouse events to the measurement tool
# NEVER DISCONNECT THOSE before connecting some other handlers; it breaks something in VisPy
@@ -488,7 +488,7 @@ class Distance(AppTool):
# )
self.app.ui.update_location_labels(dx=None, dy=None, x=pos[0], y=pos[1])
- units = self.app.defaults["units"].lower()
+ units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# 0.0000, units, 0.0000, units, pos[0], units, pos[1], units)
@@ -572,7 +572,7 @@ class DistUI:
self.app = app
self.decimals = self.app.decimals
self.layout = layout
- self.units = self.app.defaults['units'].lower()
+ self.units = self.app.app_units.lower()
# ## Title
title_label = FCLabel("%s
" % self.pluginName)
diff --git a/appPlugins/ToolDistanceMin.py b/appPlugins/ToolDistanceMin.py
index 390e296c..f2613fe9 100644
--- a/appPlugins/ToolDistanceMin.py
+++ b/appPlugins/ToolDistanceMin.py
@@ -33,7 +33,7 @@ class DistanceMin(AppTool):
self.app = app
self.canvas = self.app.plotcanvas
- self.units = self.app.defaults['units'].lower()
+ self.units = self.app.app_units.lower()
self.decimals = self.app.decimals
# #############################################################################
@@ -101,7 +101,7 @@ class DistanceMin(AppTool):
# Switch notebook to tool page
self.app.ui.notebook.setCurrentWidget(self.app.ui.plugin_tab)
- self.units = self.app.defaults['units'].lower()
+ self.units = self.app.app_units.lower()
# initial view of the layout
self.ui.start_entry.set_value('(0, 0)')
@@ -121,7 +121,7 @@ class DistanceMin(AppTool):
# ENABLE the Measuring TOOL
self.ui.jump_hp_btn.setDisabled(False)
- self.units = self.app.defaults['units'].lower()
+ self.units = self.app.app_units.lower()
if self.app.call_source == 'app':
selected_objs = self.app.collection.get_selected()
@@ -246,7 +246,7 @@ class DistMinUI:
self.app = app
self.decimals = self.app.decimals
self.layout = layout
- self.units = self.app.defaults['units'].lower()
+ self.units = self.app.app_units.lower()
# ## Title
title_label = FCLabel("%s
" % self.pluginName)
diff --git a/appPlugins/ToolDrilling.py b/appPlugins/ToolDrilling.py
index e6ce5a5d..d5e6cb43 100644
--- a/appPlugins/ToolDrilling.py
+++ b/appPlugins/ToolDrilling.py
@@ -316,7 +316,7 @@ class ToolDrilling(AppTool, Excellon):
self.ui = DrillingUI(layout=self.layout, app=self.app, name=self.pluginName)
def set_tool_ui(self):
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.clear_ui(self.layout)
self.init_ui()
@@ -473,7 +473,7 @@ class ToolDrilling(AppTool, Excellon):
self.cursor_pos = None
self.mouse_is_dragging = False
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
# ########################################
# #######3 TEMP SETTINGS #################
@@ -923,7 +923,7 @@ class ToolDrilling(AppTool, Excellon):
def on_object_changed(self):
log.debug("ToolDrilling.on_object_changed()")
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
# load the Excellon object
self.obj_name = self.ui.object_combo.currentText()
diff --git a/appPlugins/ToolFiducials.py b/appPlugins/ToolFiducials.py
index 0ff959c6..9b8c7090 100644
--- a/appPlugins/ToolFiducials.py
+++ b/appPlugins/ToolFiducials.py
@@ -155,7 +155,7 @@ class ToolFiducials(AppTool):
self.ui.reset_button.clicked.connect(self.set_tool_ui)
def set_tool_ui(self):
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
self.clear_ui(self.layout)
self.ui = FidoUI(layout=self.layout, app=self.app)
diff --git a/appPlugins/ToolFilm.py b/appPlugins/ToolFilm.py
index eb2e2140..e35b4c11 100644
--- a/appPlugins/ToolFilm.py
+++ b/appPlugins/ToolFilm.py
@@ -46,7 +46,7 @@ class Film(AppTool):
AppTool.__init__(self, app)
self.decimals = self.app.decimals
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
# #############################################################################################################
# ######################################## Tool GUI ###########################################################
diff --git a/appPlugins/ToolFollow.py b/appPlugins/ToolFollow.py
index 2893ded2..84d56690 100644
--- a/appPlugins/ToolFollow.py
+++ b/appPlugins/ToolFollow.py
@@ -135,7 +135,7 @@ class ToolFollow(AppTool, Gerber):
self.ui.generate_geometry_button.clicked.connect(self.on_generate_geometry_click)
def set_tool_ui(self):
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.clear_ui(self.layout)
self.ui = FollowUI(layout=self.layout, app=self.app)
@@ -573,7 +573,7 @@ class ToolFollow(AppTool, Gerber):
# "%.4f " % (self.app.dx, self.app.dy))
self.app.ui.update_location_labels(self.app.dx, self.app.dy, curr_pos[0], curr_pos[1])
- units = self.app.defaults["units"].lower()
+ units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units)
diff --git a/appPlugins/ToolImage.py b/appPlugins/ToolImage.py
index cff79b01..1ddfb154 100644
--- a/appPlugins/ToolImage.py
+++ b/appPlugins/ToolImage.py
@@ -191,7 +191,7 @@ class ToolImage(AppTool):
# Object name
name = outname or filename.split('/')[-1].split('\\')[-1]
- units = self.app.defaults['units']
+ units = self.app.app_units
self.app.app_obj.new_object(obj_type, name, obj_init)
diff --git a/appPlugins/ToolIsolation.py b/appPlugins/ToolIsolation.py
index c23b39a8..26ffc2ba 100644
--- a/appPlugins/ToolIsolation.py
+++ b/appPlugins/ToolIsolation.py
@@ -267,7 +267,7 @@ class ToolIsolation(AppTool, Gerber):
}[self.ui.type_excobj_radio.get_value()]
def set_tool_ui(self):
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.clear_ui(self.layout)
self.ui = IsoUI(layout=self.layout, app=self.app)
@@ -572,7 +572,7 @@ class ToolIsolation(AppTool, Gerber):
self.ui_disconnect()
# updated units
- units = self.app.defaults['units'].upper()
+ units = self.app.app_units.upper()
self.units = units
self.sort_iso_tools()
@@ -1061,7 +1061,7 @@ class ToolIsolation(AppTool, Gerber):
# multiprocessing variant
def find_safe_tooldia_multiprocessing(self):
self.app.inform.emit(_("Checking tools for validity."))
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
obj_name = self.ui.object_combo.currentText()
@@ -1126,7 +1126,7 @@ class ToolIsolation(AppTool, Gerber):
def find_safe_tooldia_worker(self):
self.app.inform.emit(_("Checking tools for validity."))
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
obj_name = self.ui.object_combo.currentText()
@@ -2649,7 +2649,7 @@ class ToolIsolation(AppTool, Gerber):
# "%.4f " % (self.app.dx, self.app.dy))
self.app.ui.update_location_labels(self.app.dx, self.app.dy, curr_pos[0], curr_pos[1])
- units = self.app.defaults["units"].lower()
+ units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units)
@@ -2785,7 +2785,7 @@ class ToolIsolation(AppTool, Gerber):
"""
self.ui_disconnect()
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
tooldia = float(tool['tooldia'])
diff --git a/appPlugins/ToolLevelling.py b/appPlugins/ToolLevelling.py
index ba5cf2b1..ce2730dd 100644
--- a/appPlugins/ToolLevelling.py
+++ b/appPlugins/ToolLevelling.py
@@ -239,7 +239,7 @@ class ToolLevelling(AppTool, CNCjob):
self.app.cleanup.connect(self.set_tool_ui)
def set_tool_ui(self):
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.clear_ui(self.layout)
self.ui = LevelUI(layout=self.layout, app=self.app)
diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py
index 663c3c57..2d26a96f 100644
--- a/appPlugins/ToolMilling.py
+++ b/appPlugins/ToolMilling.py
@@ -405,7 +405,7 @@ class ToolMilling(AppTool, Excellon):
self.ui = MillingUI(layout=self.layout, app=self.app, name=self.pluginName)
def set_tool_ui(self):
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.old_tool_dia = self.app.defaults["tools_iso_newdia"]
self.obj_name = ""
@@ -936,7 +936,7 @@ class ToolMilling(AppTool, Excellon):
)
def build_ui_mill(self):
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
if self.target_obj:
self.ui.param_frame.setDisabled(False)
@@ -1056,7 +1056,7 @@ class ToolMilling(AppTool, Excellon):
def build_ui_exc(self):
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
if self.target_obj:
self.ui.param_frame.setDisabled(False)
@@ -2189,7 +2189,7 @@ class ToolMilling(AppTool, Excellon):
"""
self.ui_disconnect()
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
tooldia = float(tool['tooldia'])
diff --git a/appPlugins/ToolMove.py b/appPlugins/ToolMove.py
index 055a40e4..feb6175a 100644
--- a/appPlugins/ToolMove.py
+++ b/appPlugins/ToolMove.py
@@ -329,7 +329,7 @@ class ToolMove(AppTool):
def draw_shape(self, shape):
- if self.app.defaults['units'].upper() == 'MM':
+ if self.app.app_units.upper() == 'MM':
proc_shape = shape.buffer(-0.1)
proc_shape = proc_shape.buffer(0.2)
else:
diff --git a/appPlugins/ToolNCC.py b/appPlugins/ToolNCC.py
index 8935e062..ad26c65c 100644
--- a/appPlugins/ToolNCC.py
+++ b/appPlugins/ToolNCC.py
@@ -271,7 +271,7 @@ class NonCopperClear(AppTool, Gerber):
self.app.cleanup.connect(self.set_tool_ui)
def set_tool_ui(self):
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.old_tool_dia = self.app.defaults["tools_ncc_newdia"]
self.clear_ui(self.layout)
@@ -434,7 +434,7 @@ class NonCopperClear(AppTool, Gerber):
self.bound_obj = None
self.tool_type_item_options = ["C1", "C2", "C3", "C4", "B", "V"]
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.first_click = False
self.cursor_pos = None
@@ -794,7 +794,7 @@ class NonCopperClear(AppTool, Gerber):
self.ui_disconnect()
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
sorted_tools = []
for k, v in self.ncc_tools.items():
@@ -1045,7 +1045,7 @@ class NonCopperClear(AppTool, Gerber):
# multiprocessing variant
def find_safe_tooldia_multiprocessing(self):
self.app.inform.emit(_("Checking tools for validity."))
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
obj_name = self.ui.object_combo.currentText()
@@ -1114,7 +1114,7 @@ class NonCopperClear(AppTool, Gerber):
def find_safe_tooldia_worker(self):
self.app.inform.emit(_("Checking tools for validity."))
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
obj_name = self.ui.object_combo.currentText()
@@ -1353,7 +1353,7 @@ class NonCopperClear(AppTool, Gerber):
def on_tool_default_add(self, dia=None, muted=None):
self.blockSignals(True)
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
if dia:
tool_dia = dia
@@ -1820,7 +1820,7 @@ class NonCopperClear(AppTool, Gerber):
# "%.4f " % (self.app.dx, self.app.dy))
self.app.ui.update_location_labels(self.app.dx, self.app.dy, curr_pos[0], curr_pos[1])
- units = self.app.defaults["units"].lower()
+ units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units)
@@ -2329,7 +2329,7 @@ class NonCopperClear(AppTool, Gerber):
# ######################### Read the parameters ########################################################
# ######################################################################################################
- units = self.app.defaults['units']
+ units = self.app.app_units
order = order if order else self.ui.ncc_order_combo.get_value()
ncc_select = self.ui.select_combo.get_value()
rest_machining_choice = self.ui.ncc_rest_cb.get_value()
@@ -2915,7 +2915,7 @@ class NonCopperClear(AppTool, Gerber):
# ####### Read the parameters #########################################
# #####################################################################
- units = self.app.defaults['units']
+ units = self.app.app_units
log.debug("NCC Tool started. Reading parameters.")
self.app.inform.emit(_("NCC Tool started. Reading parameters."))
@@ -3993,7 +3993,7 @@ class NonCopperClear(AppTool, Gerber):
"""
self.ui_disconnect()
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
tooldia = float(tool['tooldia'])
@@ -4468,7 +4468,7 @@ class NccUI:
self.ncc_offset_spinner.setWrapping(True)
self.ncc_offset_spinner.setObjectName("n_offset_value")
- units = self.app.defaults['units'].upper()
+ units = self.app.app_units.upper()
if units == 'MM':
self.ncc_offset_spinner.setSingleStep(0.1)
else:
@@ -4565,7 +4565,7 @@ class NccUI:
self.rest_ncc_offset_spinner.set_precision(4)
self.rest_ncc_offset_spinner.setWrapping(True)
- units = self.app.defaults['units'].upper()
+ units = self.app.app_units.upper()
if units == 'MM':
self.rest_ncc_offset_spinner.setSingleStep(0.1)
else:
diff --git a/appPlugins/ToolOptimal.py b/appPlugins/ToolOptimal.py
index 4e8864de..b7ca8226 100644
--- a/appPlugins/ToolOptimal.py
+++ b/appPlugins/ToolOptimal.py
@@ -37,7 +37,7 @@ class ToolOptimal(AppTool):
def __init__(self, app):
AppTool.__init__(self, app)
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.decimals = self.app.decimals
# #############################################################################
@@ -163,7 +163,7 @@ class ToolOptimal(AppTool):
self.ui.gerber_object_combo.set_value(obj_name)
def find_minimum_distance(self):
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
self.decimals = int(self.ui.precision_spinner.get_value())
selection_index = self.ui.gerber_object_combo.currentIndex()
@@ -431,7 +431,7 @@ class OptimalUI:
self.app = app
self.decimals = self.app.decimals
self.layout = layout
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
# ## Title
title_label = FCLabel("%s" % self.pluginName)
diff --git a/appPlugins/ToolPDF.py b/appPlugins/ToolPDF.py
index a0187768..c94fa86f 100644
--- a/appPlugins/ToolPDF.py
+++ b/appPlugins/ToolPDF.py
@@ -63,7 +63,7 @@ class ToolPDF(AppTool):
# when empty we start the layer rendering
self.parsing_promises = []
- self.parser = PdfParser(units=self.app.defaults['units'],
+ self.parser = PdfParser(units=self.app.app_units,
resolution=self.app.defaults["gerber_circle_steps"],
abort=self.app.abort_flag)
diff --git a/appPlugins/ToolPaint.py b/appPlugins/ToolPaint.py
index 841df7f4..efec0a09 100644
--- a/appPlugins/ToolPaint.py
+++ b/appPlugins/ToolPaint.py
@@ -281,7 +281,7 @@ class ToolPaint(AppTool, Gerber):
self.reset_fields()
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
# set the working variables to a known state
self.paint_tools.clear()
@@ -726,7 +726,7 @@ class ToolPaint(AppTool, Gerber):
self.ui_disconnect()
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
sorted_tools = []
for k, v in self.paint_tools.items():
@@ -962,7 +962,7 @@ class ToolPaint(AppTool, Gerber):
def on_tool_default_add(self, dia=None, muted=None):
self.blockSignals(True)
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
if dia:
tool_dia = dia
@@ -1495,7 +1495,7 @@ class ToolPaint(AppTool, Gerber):
# "%.4f " % (self.app.dx, self.app.dy))
self.app.ui.update_location_labels(self.app.dx, self.app.dy, curr_pos[0], curr_pos[1])
- units = self.app.defaults["units"].lower()
+ units = self.app.app_units.lower()
# self.app.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units)
@@ -2807,7 +2807,7 @@ class ToolPaint(AppTool, Gerber):
"""
self.ui_disconnect()
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
tooldia = float(tool['tooldia'])
diff --git a/appPlugins/ToolPunchGerber.py b/appPlugins/ToolPunchGerber.py
index 44b3ec35..65cabc01 100644
--- a/appPlugins/ToolPunchGerber.py
+++ b/appPlugins/ToolPunchGerber.py
@@ -40,7 +40,7 @@ class ToolPunchGerber(AppTool, Gerber):
self.app = app
self.decimals = self.app.decimals
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
# store here the old object name
self.old_name = ''
diff --git a/appPlugins/ToolQRCode.py b/appPlugins/ToolQRCode.py
index 07a9168d..8aec77d4 100644
--- a/appPlugins/ToolQRCode.py
+++ b/appPlugins/ToolQRCode.py
@@ -147,7 +147,7 @@ class QRCode(AppTool):
self.ui.reset_button.clicked.connect(self.set_tool_ui)
def set_tool_ui(self):
- self.units = self.app.defaults['units']
+ self.units = self.app.app_units
self.clear_ui(self.layout)
self.ui = QRcodeUI(layout=self.layout, app=self.app)
@@ -518,7 +518,7 @@ class QRCode(AppTool):
# h = float(svg_root.get('height'))
# w = float(svg_root.get('width'))
h = svgparselength(svg_root.get('height'))[0] # TODO: No units support yet
- units = self.app.defaults['units'] if units is None else units
+ units = self.app.app_units if units is None else units
res = self.app.defaults['geometry_circle_steps']
factor = svgparse_viewbox(svg_root)
geos = getsvggeo(svg_root, object_type, units=units, res=res, factor=factor, app=self.app)
diff --git a/appPlugins/ToolReport.py b/appPlugins/ToolReport.py
index 0a104cd8..9ff4d176 100644
--- a/appPlugins/ToolReport.py
+++ b/appPlugins/ToolReport.py
@@ -240,7 +240,7 @@ class ObjectReport(AppTool):
log.error("PropertiesTool.addItems() -> calculate dimensions --> %s" % str(ee))
# calculate box area
- if self.app.defaults['units'].lower() == 'mm':
+ if self.app.app_units.lower() == 'mm':
area = (length * width) / 100
else:
area = length * width
@@ -301,7 +301,7 @@ class ObjectReport(AppTool):
width = abs(ymax - ymin)
# calculate box area
- if self.app.defaults['units'].lower() == 'mm':
+ if self.app.app_units.lower() == 'mm':
area = (length * width) / 100
else:
area = length * width
@@ -354,7 +354,7 @@ class ObjectReport(AppTool):
area_chull = None
log.error("Properties.addItems() --> %s" % str(er))
- if self.app.defaults['units'].lower() == 'mm' and area_chull:
+ if self.app.app_units.lower() == 'mm' and area_chull:
area_chull = area_chull / 100
if area_chull is None:
@@ -365,7 +365,7 @@ class ObjectReport(AppTool):
self.app.worker_task.emit({'fcn': job_thread, 'params': [obj]})
# Units items
- f_unit = {'in': _('Inch'), 'mm': _('Metric')}[str(self.app.defaults['units'].lower())]
+ f_unit = {'in': _('Inch'), 'mm': _('Metric')}[str(self.app.app_units.lower())]
self.treeWidget.addChild(units, ['FlatCAM units:', f_unit], True)
o_unit = {
@@ -441,7 +441,7 @@ class ObjectReport(AppTool):
toolid,
[
_('Diameter'),
- '%.*f %s' % (self.decimals, value['tooldia'], self.app.defaults['units'].lower())
+ '%.*f %s' % (self.decimals, value['tooldia'], self.app.app_units.lower())
],
True
)
@@ -507,7 +507,7 @@ class ObjectReport(AppTool):
exc_tool,
[
_('Diameter'),
- '%.*f %s' % (self.decimals, tool_dia, self.app.defaults['units'].lower())
+ '%.*f %s' % (self.decimals, tool_dia, self.app.app_units.lower())
],
True
)
@@ -535,7 +535,7 @@ class ObjectReport(AppTool):
'%.*f %s' % (
self.decimals,
(obj.z_cut - abs(value['data']['tools_drill_offset'])),
- self.app.defaults['units'].lower()
+ self.app.app_units.lower()
)
],
True
@@ -547,7 +547,7 @@ class ObjectReport(AppTool):
'%.*f %s' % (
self.decimals,
obj.z_move,
- self.app.defaults['units'].lower()
+ self.app.app_units.lower()
)
],
True
@@ -559,7 +559,7 @@ class ObjectReport(AppTool):
'%.*f %s/min' % (
self.decimals,
obj.feedrate,
- self.app.defaults['units'].lower()
+ self.app.app_units.lower()
)
],
True
@@ -589,7 +589,7 @@ class ObjectReport(AppTool):
others,
[
'%s:' % _('Travelled distance'),
- '%.*f %s' % (self.decimals, obj.travel_distance, self.app.defaults['units'].lower())
+ '%.*f %s' % (self.decimals, obj.travel_distance, self.app.app_units.lower())
],
True
)
@@ -601,17 +601,17 @@ class ObjectReport(AppTool):
# add dimensions
self.treeWidget.addChild(
location,
- ['%s:' % _('Length'), '%.*f %s' % (self.decimals, length, self.app.defaults['units'].lower())],
+ ['%s:' % _('Length'), '%.*f %s' % (self.decimals, length, self.app.app_units.lower())],
True
)
self.treeWidget.addChild(
location,
- ['%s:' % _('Width'), '%.*f %s' % (self.decimals, width, self.app.defaults['units'].lower())],
+ ['%s:' % _('Width'), '%.*f %s' % (self.decimals, width, self.app.app_units.lower())],
True
)
# add box area
- if self.app.defaults['units'].lower() == 'mm':
+ if self.app.app_units.lower() == 'mm':
self.treeWidget.addChild(location, ['%s:' % _('Box Area'), '%.*f %s' % (self.decimals, area, 'cm2')], True)
self.treeWidget.addChild(
location,
@@ -628,7 +628,7 @@ class ObjectReport(AppTool):
)
# add copper area
- if self.app.defaults['units'].lower() == 'mm':
+ if self.app.app_units.lower() == 'mm':
self.treeWidget.addChild(
location, ['%s:' % _('Copper Area'), '%.*f %s' % (self.decimals, copper_area, 'cm2')], True)
else:
diff --git a/appPlugins/ToolSolderPaste.py b/appPlugins/ToolSolderPaste.py
index d145506f..de54d9d7 100644
--- a/appPlugins/ToolSolderPaste.py
+++ b/appPlugins/ToolSolderPaste.py
@@ -218,7 +218,7 @@ class SolderPaste(AppTool):
self.name = ""
self.obj = None
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
for name in self.app.preprocessors.keys():
# populate only with preprocessor files that start with 'Paste_'
@@ -242,7 +242,7 @@ class SolderPaste(AppTool):
self.ui_disconnect()
# updated units
- self.units = self.app.defaults['units'].upper()
+ self.units = self.app.app_units.upper()
sorted_tools = []
for k, v in self.tooltable_tools.items():
diff --git a/app_Main.py b/app_Main.py
index c276ae4a..0f64fbd2 100644
--- a/app_Main.py
+++ b/app_Main.py
@@ -593,7 +593,9 @@ class App(QtCore.QObject):
if user_defaults:
self.defaults.load(filename=current_defaults_path, inform=self.inform)
- if self.defaults['units'] == 'MM':
+ self.app_units = self.defaults["units"]
+
+ if self.app_units == 'MM':
self.decimals = int(self.defaults['decimals_metric'])
else:
self.decimals = int(self.defaults['decimals_inch'])
@@ -603,8 +605,6 @@ class App(QtCore.QObject):
else:
self.resource_location = 'assets/resources/dark_resources'
- self.current_units = self.defaults['units']
-
# ###########################################################################################################
# ####################################### Auto-complete KEYWORDS ############################################
# ######################## Setup after the Defaults class was instantiated ##################################
@@ -1005,7 +1005,7 @@ class App(QtCore.QObject):
# ########################
# set FlatCAM units in the Status bar
- self.set_screen_units(self.defaults['units'])
+ self.set_screen_units(self.app_units)
# decide if to show or hide the Notebook side of the screen at startup
if self.defaults["global_project_at_startup"] is True:
@@ -4575,7 +4575,7 @@ class App(QtCore.QObject):
self.preferencesUiManager.defaults_write_form_field(field=field)
if field == "units":
- self.set_screen_units(self.defaults['units'])
+ self.set_screen_units(self.app_units)
def set_screen_units(self, units):
"""
@@ -4590,15 +4590,15 @@ class App(QtCore.QObject):
new_units, factor = self.on_toggle_units()
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
- pref_units = self.preferencesUiManager.preferences_units
- if pref_units != new_units:
- self.preferencesUiManager.preferences_units = new_units
+ 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)
- # update th new units in the preferences storage
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):
self.preferencesUiManager.defaults_read_form()
@@ -4784,7 +4784,7 @@ class App(QtCore.QObject):
if self.toggle_units_ignore:
return
- new_units = self.defaults["units"]
+ new_units = 'IN' if self.app_units.upper() == 'MM' else 'MM'
# we can't change the units while inside the Editors
if self.call_source in ['geo_editor', 'grb_editor', 'exc_editor']:
@@ -4811,7 +4811,7 @@ class App(QtCore.QObject):
response = msgbox.clickedButton()
if response == bt_ok:
- new_units = "IN" if self.defaults['units'].upper() == "MM" else "MM"
+ new_units = "IN" if self.app_units.upper() == "MM" else "MM"
# The scaling factor depending on choice of units.
factor = 25.4 if new_units == 'MM' else 1 / 25.4
@@ -4932,7 +4932,7 @@ class App(QtCore.QObject):
def on_tool_add_keypress(self):
# ## Current application units in Upper Case
- self.units = self.defaults['units'].upper()
+ self.units = self.app_units.upper()
notebook_widget_name = self.ui.notebook.currentWidget().objectName()
@@ -5753,7 +5753,7 @@ class App(QtCore.QObject):
# "%.4f " % (self.dx, self.dy))
self.ui.update_location_labels(self.dx, self.dy, location[0], location[1])
- # units = self.defaults["units"].lower()
+ # units = self.app_units.lower()
# self.plotcanvas.text_hud.text = \
# 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
# self.dx, units, self.dy, units, location[0], units, location[1], units)
@@ -7002,7 +7002,7 @@ class App(QtCore.QObject):
return True if self.ui.grid_snap_btn.isChecked() else False
def populate_cmenu_grids(self):
- units = self.defaults['units'].lower()
+ units = self.app_units.lower()
# for act in self.ui.cmenu_gridmenu.actions():
# act.triggered.disconnect()
@@ -7039,7 +7039,7 @@ class App(QtCore.QObject):
def on_grid_add(self):
# ## Current application units in lower Case
- units = self.defaults['units'].lower()
+ units = self.app_units.lower()
grid_add_popup = FCInputDoubleSpinner(title=_("New Grid ..."),
text=_('Enter a Grid Value:'),
@@ -7064,7 +7064,7 @@ class App(QtCore.QObject):
def on_grid_delete(self):
# ## Current application units in lower Case
- units = self.defaults['units'].lower()
+ units = self.app_units.lower()
grid_del_popup = FCInputDoubleSpinner(title="Delete Grid ...",
text='Enter a Grid Value:',
@@ -7630,7 +7630,7 @@ class App(QtCore.QObject):
pt4 = (float(sel_obj.options['xmin']), float(sel_obj.options['ymax']))
hover_rect = Polygon([pt1, pt2, pt3, pt4])
- if self.defaults['units'].upper() == 'MM':
+ if self.app_units.upper() == 'MM':
hover_rect = hover_rect.buffer(-0.1)
hover_rect = hover_rect.buffer(0.2)
@@ -7689,7 +7689,7 @@ class App(QtCore.QObject):
b_sel_rect = None
try:
- if self.defaults['units'].upper() == 'MM':
+ if self.app_units.upper() == 'MM':
b_sel_rect = sel_rect.buffer(-0.1)
b_sel_rect = b_sel_rect.buffer(0.2)
else:
@@ -10310,7 +10310,7 @@ class MenuFileHandlers(QtCore.QObject):
doc_final = doc.toprettyxml()
try:
- if self.defaults['units'].upper() == 'IN':
+ if self.app_units.upper() == 'IN':
unit = inch
else:
unit = mm
@@ -10520,7 +10520,7 @@ class MenuFileHandlers(QtCore.QObject):
eformat = self.defaults["excellon_exp_format"]
slot_type = self.defaults["excellon_exp_slot_type"]
- fc_units = self.defaults['units'].upper()
+ fc_units = self.app_units.upper()
if fc_units == 'MM':
factor = 1 if eunits == 'METRIC' else 0.03937
else:
@@ -10665,7 +10665,7 @@ class MenuFileHandlers(QtCore.QObject):
gfract = self.defaults["gerber_exp_decimals"]
gzeros = self.defaults["gerber_exp_zeros"]
- fc_units = self.defaults['units'].upper()
+ fc_units = self.app_units.upper()
if fc_units == 'MM':
factor = 1 if gunits == 'MM' else 0.03937
else:
@@ -10860,7 +10860,7 @@ class MenuFileHandlers(QtCore.QObject):
_("Not supported type is picked as parameter. Only Geometry and Gerber are supported"))
return
- units = self.defaults['units'].upper()
+ units = self.app_units.upper()
def obj_init(geo_obj, app_obj):
res = geo_obj.import_svg(filename, obj_type, units=units)
@@ -10916,7 +10916,7 @@ class MenuFileHandlers(QtCore.QObject):
_("Not supported type is picked as parameter. Only Geometry and Gerber are supported"))
return
- units = self.defaults['units'].upper()
+ units = self.app_units.upper()
def obj_init(geo_obj, app_obj):
if obj_type == "geometry":
diff --git a/camlib.py b/camlib.py
index 8b38bcc0..1b1234a4 100644
--- a/camlib.py
+++ b/camlib.py
@@ -517,7 +517,7 @@ class Geometry(object):
def __init__(self, geo_steps_per_circle=None):
# Units (in or mm)
- self.units = self.app.defaults["units"]
+ self.units = self.app.app_units
self.decimals = self.app.decimals
self.drawing_tolerance = 0.0
@@ -1179,7 +1179,7 @@ class Geometry(object):
self.app.inform.emit("[ERROR_NOTCL] %s" % _("Failed."))
return
- units = self.app.defaults['units'] if units is None else units
+ units = self.app.app_units if units is None else units
res = self.app.defaults['geometry_circle_steps']
factor = svgparse_viewbox(svg_root)
@@ -7719,7 +7719,7 @@ class CNCjob(Geometry):
temp_gcode = ''
header_start = False
header_stop = False
- units = self.app.defaults['units'].upper()
+ units = self.app.app_units.upper()
lines = StringIO(g)
for line in lines:
diff --git a/tclCommands/TclCommandMillSlots.py b/tclCommands/TclCommandMillSlots.py
index 7580a828..833a0542 100644
--- a/tclCommands/TclCommandMillSlots.py
+++ b/tclCommands/TclCommandMillSlots.py
@@ -96,7 +96,7 @@ class TclCommandMillSlots(TclCommandSignaled):
if not obj.slots:
self.raise_tcl_error("The Excellon object has no slots: %s" % name)
- # units = self.app.defaults['units'].upper()
+ # units = self.app.app_units.upper()
try:
if 'milled_dias' in args and args['milled_dias'] != 'all':
diameters = [x.strip() for x in args['milled_dias'].split(",")]
diff --git a/tclCommands/TclCommandOpenDXF.py b/tclCommands/TclCommandOpenDXF.py
index bd788a3c..4aa82cf3 100644
--- a/tclCommands/TclCommandOpenDXF.py
+++ b/tclCommands/TclCommandOpenDXF.py
@@ -84,7 +84,7 @@ class TclCommandOpenDXF(TclCommandSignaled):
if obj_type != "geometry" and obj_type != "gerber":
self.raise_tcl_error("Option type can be 'geometry' or 'gerber' only, got '%s'." % obj_type)
- units = self.app.defaults['units'].upper()
+ units = self.app.app_units.upper()
with self.app.proc_container.new('%s...' % _("Opening")):
diff --git a/tclCommands/TclCommandOpenSVG.py b/tclCommands/TclCommandOpenSVG.py
index a9225a0c..e1d4e9c9 100644
--- a/tclCommands/TclCommandOpenSVG.py
+++ b/tclCommands/TclCommandOpenSVG.py
@@ -80,7 +80,7 @@ class TclCommandOpenSVG(TclCommandSignaled):
if obj_type != "geometry" and obj_type != "gerber":
self.raise_tcl_error("Option type can be 'geometry' or 'gerber' only, got '%s'." % obj_type)
- units = self.app.defaults['units'].upper()
+ units = self.app.app_units.upper()
with self.app.proc_container.new('%s...' % _("Working")):