Skip to content

Commit

Permalink
Draft: Added pref option to set default dimension unit
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Oct 14, 2020
1 parent 7f95da9 commit 71cd301
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
41 changes: 39 additions & 2 deletions src/Mod/Draft/Resources/ui/preferences-drafttexts.ui
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Draft/draftutils/utils.py
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Draft/draftviewproviders/view_dimension.py
Expand Up @@ -216,7 +216,7 @@ def set_units_properties(self, vobj, properties):
"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."""
Expand Down

0 comments on commit 71cd301

Please sign in to comment.