diff --git a/src/Mod/Draft/Resources/ui/TaskPanel_SetStyle.ui b/src/Mod/Draft/Resources/ui/TaskPanel_SetStyle.ui index 120b907d74..d4f1b824fc 100644 --- a/src/Mod/Draft/Resources/ui/TaskPanel_SetStyle.ui +++ b/src/Mod/Draft/Resources/ui/TaskPanel_SetStyle.ui @@ -6,8 +6,8 @@ 0 0 - 246 - 573 + 287 + 945 @@ -44,8 +44,7 @@ - - + .. @@ -199,6 +198,23 @@ Annotations + + + + The size of texts and dimension texts + + + + + + + + + + The color of texts and dimension texts + + + @@ -206,6 +222,27 @@ + + + + Text size + + + + + + + Line spacing + + + + + + + Text color + + + @@ -219,31 +256,30 @@ - - - - Text size - - - - - + + - The size of texts and dimension texts - - - + The spacing between different lines of text - - + + + + + + + Dimensions + + + + - Text spacing + Arrow style - + The space between the text and the dimension line @@ -253,42 +289,7 @@ - - - - Text color - - - - - - - The color of texts and dimension texts - - - - - - - Line spacing - - - - - - - The spacing between different lines of text - - - - - - - Arrow style - - - - + The type of dimension arrows @@ -320,14 +321,14 @@ - - + + - Arrow size + Ext lines - + The size of dimension arrows @@ -337,14 +338,7 @@ - - - - Show unit - - - - + If the unit suffix is shown on dimension texts or not @@ -357,21 +351,86 @@ + + + + Text spacing + + + + + + + The distance the dimension line is extended past the extension lines + + + + + + + + + + Arrow size + + + + + + + Dim overshoot + + + + + + + Length of the extension lines beyond the dimension line + + + + + + + + + + Length of the extension lines + + + + + + + + + Show unit + + + + + + + Ext overshoot + + + + Unit override - + The unit to use for dimensions. Leave blank to use current FreeCAD unit - + @@ -386,13 +445,15 @@ - - + .. + + Apply above style to all annotations (texts and dimensions) + Annotations diff --git a/src/Mod/Draft/draftguitools/gui_setstyle.py b/src/Mod/Draft/draftguitools/gui_setstyle.py index a820ae7a07..52725fd4f5 100644 --- a/src/Mod/Draft/draftguitools/gui_setstyle.py +++ b/src/Mod/Draft/draftguitools/gui_setstyle.py @@ -92,6 +92,9 @@ class Draft_SetStyle_TaskPanel: self.form.saveButton.setIcon(QtGui.QIcon.fromTheme("gtk-save", QtGui.QIcon(":/icons/document-save.svg"))) self.form.TextSpacing.setText(FreeCAD.Units.Quantity(FreeCAD.ParamGet(self.p+"Mod/Draft").GetFloat("dimspacing",1),FreeCAD.Units.Length).UserString) self.form.LineSpacing.setValue(FreeCAD.ParamGet(self.p+"Mod/Draft").GetFloat("LineSpacing",1)) + self.form.DimOvershoot.setText(FreeCAD.Units.Quantity(FreeCAD.ParamGet(self.p+"Mod/Draft").GetFloat("dimovershoot",0),FreeCAD.Units.Length).UserString) + self.form.ExtLines.setText(FreeCAD.Units.Quantity(FreeCAD.ParamGet(self.p+"Mod/Draft").GetFloat("extlines",0),FreeCAD.Units.Length).UserString) + self.form.ExtOvershoot.setText(FreeCAD.Units.Quantity(FreeCAD.ParamGet(self.p+"Mod/Draft").GetFloat("extovershoot",0),FreeCAD.Units.Length).UserString) self.form.saveButton.clicked.connect(self.onSaveStyle) self.form.applyButton.clicked.connect(self.onApplyStyle) self.form.annotButton.clicked.connect(self.onApplyAnnot) @@ -139,6 +142,9 @@ class Draft_SetStyle_TaskPanel: preset["UnitOverride"] = self.form.UnitOverride.text() preset["TextSpacing"] = FreeCAD.Units.Quantity(self.form.TextSpacing.text()).Value preset["LineSpacing"] = self.form.LineSpacing.value() + preset["DimOvershoot"] = FreeCAD.Units.Quantity(self.form.DimOvershoot.text()).Value + preset["ExtLines"] = FreeCAD.Units.Quantity(self.form.ExtLines.text()).Value + preset["ExtOvershoot"] = FreeCAD.Units.Quantity(self.form.ExtOvershoot.text()).Value return preset def setValues(self,preset): @@ -159,6 +165,9 @@ class Draft_SetStyle_TaskPanel: self.form.ArrowSize.setText(FreeCAD.Units.Quantity(preset.get("ArrowSize",5),FreeCAD.Units.Length).UserString) self.form.TextSpacing.setText(FreeCAD.Units.Quantity(preset.get("TextSpacing",25),FreeCAD.Units.Length).UserString) self.form.LineSpacing.setValue(preset.get("LineSpacing",3)) + self.form.DimOvershoot.setText(FreeCAD.Units.Quantity(preset.get("DimOvershoot",0),FreeCAD.Units.Length).UserString) + self.form.ExtLines.setText(FreeCAD.Units.Quantity(preset.get("ExtLines",0),FreeCAD.Units.Length).UserString) + self.form.ExtOvershoot.setText(FreeCAD.Units.Quantity(preset.get("ExtOvershoot",0),FreeCAD.Units.Length).UserString) def reject(self): @@ -186,6 +195,9 @@ class Draft_SetStyle_TaskPanel: param_draft.SetString("overrideUnit",self.form.UnitOverride.text()) param_draft.SetFloat("dimspacing",FreeCAD.Units.Quantity(self.form.TextSpacing.text()).Value) param_draft.SetFloat("LineSpacing",self.form.LineSpacing.value()) + param_draft.SetFloat("dimovershoot",FreeCAD.Units.Quantity(self.form.DimOvershoot.text()).Value) + param_draft.SetFloat("extlines",FreeCAD.Units.Quantity(self.form.ExtLines.text()).Value) + param_draft.SetFloat("extovershoot",FreeCAD.Units.Quantity(self.form.ExtOvershoot.text()).Value) if hasattr(FreeCADGui,"draftToolBar"): FreeCADGui.draftToolBar.setStyleButton() self.reject() @@ -250,6 +262,12 @@ class Draft_SetStyle_TaskPanel: vobj.TextSpacing = FreeCAD.Units.Quantity(self.form.TextSpacing.text()).Value if "LineSpacing" in properties: vobj.LineSpacing = self.form.LineSpacing.value() + if "DimOvershoot" in properties: + vobj.DimOvershoot = FreeCAD.Units.Quantity(self.form.DimOvershoot.text()).Value + if "ExtLines" in properties: + vobj.ExtLines = FreeCAD.Units.Quantity(self.form.ExtLines.text()).Value + if "ExtOvershoot" in properties: + vobj.ExtOvershoot = FreeCAD.Units.Quantity(self.form.ExtOvershoot.text()).Value def onLoadStyle(self,index): @@ -291,6 +309,7 @@ class Draft_SetStyle_TaskPanel: import json from json.decoder import JSONDecodeError except Exception: + FreeCAD.Console.PrintError(translate("Draft","Error: json module not found. Unable to load style")+"\n") return if os.path.exists(PRESETPATH): with open(PRESETPATH,"r") as f: