Draft: Added pref option to set default dimension unit

This commit is contained in:
Yorik van Havre
2020-10-14 17:21:27 +02:00
parent 7f95da95c1
commit 71cd301ca7
3 changed files with 41 additions and 4 deletions

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>522</width>
<height>473</height>
<width>537</width>
<height>605</height>
</rect>
</property>
<property name="windowTitle">
@@ -467,6 +467,43 @@ such as &quot;Arial:Bold&quot;</string>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Override unit</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Gui::PrefLineEdit" name="lineEdit">
<property name="toolTip">
<string>By leaving this field blank, the dimension measurements will be shown in the current unit defined in FreeCAD. By indicating a unit here such as m or cm, you can force new dimensions to be shown in that unit.</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>overrideUnit</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@@ -171,7 +171,7 @@ def get_param_type(param):
return "int"
elif param in ("constructiongroupname", "textfont",
"patternFile", "template", "snapModes",
"FontFile", "ClonePrefix",
"FontFile", "ClonePrefix","overrideUnit",
"labeltype") or "inCommandShortcut" in param:
return "string"
elif param in ("textheight", "tolerance", "gridSpacing",

View File

@@ -216,7 +216,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
"UnitOverride",
"Units",
_tip)
vobj.UnitOverride = ''
vobj.UnitOverride = utils.get_param("overrideUnit", '')
def set_graphics_properties(self, vobj, properties):
"""Set graphics properties only if they don't already exist."""