From be75f4febc5fd2d145485350077538f12e15d69a Mon Sep 17 00:00:00 2001 From: carlopav Date: Wed, 25 Mar 2020 09:00:19 +0100 Subject: [PATCH] [Draft] Statusbar widgets, preferences to disable draft statusba . . . . --- src/Mod/Draft/InitGui.py | 1 + src/Mod/Draft/Resources/Draft.qrc | 1 + .../Draft/Resources/ui/preferences-draft.ui | 1205 ++--------- .../ui/preferences-draftinterface.ui | 1885 ++++++++--------- .../Draft/draftutils/init_draft_statusbar.py | 32 +- 5 files changed, 1018 insertions(+), 2106 deletions(-) diff --git a/src/Mod/Draft/InitGui.py b/src/Mod/Draft/InitGui.py index 4572cc5b69..66330e4c3a 100644 --- a/src/Mod/Draft/InitGui.py +++ b/src/Mod/Draft/InitGui.py @@ -116,6 +116,7 @@ class DraftWorkbench(FreeCADGui.Workbench): if hasattr(FreeCADGui, "draftToolBar"): if not hasattr(FreeCADGui.draftToolBar, "loadedPreferences"): FreeCADGui.addPreferencePage(":/ui/preferences-draft.ui", QT_TRANSLATE_NOOP("Draft", "Draft")) + FreeCADGui.addPreferencePage(":/ui/preferences-draftinterface.ui", QT_TRANSLATE_NOOP("Draft", "Draft")) FreeCADGui.addPreferencePage(":/ui/preferences-draftsnap.ui", QT_TRANSLATE_NOOP("Draft", "Draft")) FreeCADGui.addPreferencePage(":/ui/preferences-draftvisual.ui", QT_TRANSLATE_NOOP("Draft", "Draft")) FreeCADGui.addPreferencePage(":/ui/preferences-drafttexts.ui", QT_TRANSLATE_NOOP("Draft", "Draft")) diff --git a/src/Mod/Draft/Resources/Draft.qrc b/src/Mod/Draft/Resources/Draft.qrc index 5467200ade..c4096b88f3 100644 --- a/src/Mod/Draft/Resources/Draft.qrc +++ b/src/Mod/Draft/Resources/Draft.qrc @@ -153,6 +153,7 @@ translations/Draft_zh-CN.qm translations/Draft_zh-TW.qm ui/preferences-draft.ui + ui/preferences-draftinterface.ui ui/preferences-draftsnap.ui ui/preferences-drafttexts.ui ui/preferences-draftvisual.ui diff --git a/src/Mod/Draft/Resources/ui/preferences-draft.ui b/src/Mod/Draft/Resources/ui/preferences-draft.ui index 3a41695f63..005858b37e 100644 --- a/src/Mod/Draft/Resources/ui/preferences-draft.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draft.ui @@ -6,8 +6,8 @@ 0 0 - 584 - 881 + 500 + 560 @@ -17,16 +17,7 @@ 6 - - 9 - - - 9 - - - 9 - - + 9 @@ -41,41 +32,6 @@ General Draft Settings - - - - If this is checked, copy mode will be kept across command, otherwise commands will always start in no-copy mode - - - Global copy mode - - - false - - - copymode - - - Mod/Draft - - - - - - - Normally, after copying objects, the copies get selected. If this option is checked, the base objects will be selected instead. - - - Select base objects after copying - - - selectBaseObjects - - - Mod/Draft - - - @@ -233,68 +189,149 @@ Values with differences below this value will be treated as same. This value wil - + - When this is checked, the Draft tools will create Part primitives instead of Draft objects, when available. + If this option is checked, the layers drop-down list will also show groups, allowing you to automatically add objects to groups too. - Use Part Primitives when available - - - UsePartPrimitives - - - Mod/Draft - - - - - - - If this is checked, objects will appear as filled by default. Otherwise, they will appear as wireframe - - - Fill objects with faces whenever possible + Show groups in layers list drop-down button - true + false - fillmode + AutogroupAddGroups Mod/Draft + + + + + + + Draft tools options + + + + 9 + - - - When drawing lines, set focus on Length instead of X coordinate + + + 0 - - focusOnLength - - - Mod/Draft - - - - - - - If this option is set, when creating Draft objects on top of an existing face of another object, the "Support" property of the Draft object will be set to the base object. This was the standard behaviour before FreeCAD 0.19 - - - Set the Support property when possible - - - useSupport - - - Mod/Draft - - + + + + When drawing lines, set focus on Length instead of X coordinate. +This allows to point the direction and type the distance. + + + Set focus on Length instead of X coordinate + + + focusOnLength + + + Mod/Draft + + + + + + + If this option is set, when creating Draft objects on top of an existing face of another object, the "Support" property of the Draft object will be set to the base object. This was the standard behaviour before FreeCAD 0.19 + + + Set the Support property when possible + + + useSupport + + + Mod/Draft + + + + + + + If this is checked, objects will appear as filled by default. +Otherwise, they will appear as wireframe + + + Fill objects with faces whenever possible + + + true + + + fillmode + + + Mod/Draft + + + + + + + Normally, after copying objects, the copies get selected. +If this option is checked, the base objects will be selected instead. + + + Select base objects after copying + + + selectBaseObjects + + + Mod/Draft + + + + + + + If this is checked, copy mode will be kept across command, +otherwise commands will always start in no-copy mode + + + Global copy mode + + + false + + + copymode + + + Mod/Draft + + + + + + + Force Draft Tools to create Part primitives instead of Draft objects. +Note that this is not fully supported, and many object will be not editable with Draft Modifiers. + + + Use Part Primitives when available + + + UsePartPrimitives + + + Mod/Draft + + + + @@ -320,25 +357,6 @@ Values with differences below this value will be treated as same. This value wil - - - - If this option is checked, the layers drop-down list will also show groups, allowing you to automatically add objects to groups too. - - - Show groups in layers list drop-down button - - - false - - - AutogroupAddGroups - - - Mod/Draft - - - @@ -408,7 +426,7 @@ Values with differences below this value will be treated as same. This value wil This is the default color for objects being drawn while in construction mode. - + 44 125 @@ -428,965 +446,6 @@ Values with differences below this value will be treated as same. This value wil - - - - In-Command Shortcuts - - - - - - - - - - Relative - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - R - - - 1 - - - - - - false - - - inCommandShortcutRelative - - - Mod/Draft - - - - - - - - - - - - - Continue - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - T - - - 1 - - - - - - false - - - inCommandShortcutContinue - - - Mod/Draft - - - - - - - - - - - - - Close - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - O - - - 1 - - - - - - false - - - inCommandShortcutClose - - - Mod/Draft - - - - - - - - - - - - - - - Copy - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - P - - - 1 - - - - - - false - - - inCommandShortcutCopy - - - Mod/Draft - - - - - - - - - - - Subelement Mode - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - D - - - 1 - - - - - - false - - - inCommandShortcutSubelementMode - - - Mod/Draft - - - - - - - - - - - Fill - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - L - - - 1 - - - - - - false - - - inCommandShortcutFill - - - Mod/Draft - - - - - - - - - - - - - - - Exit - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - A - - - 1 - - - - - - false - - - inCommandShortcutExit - - - Mod/Draft - - - - - - - - - - - Select Edge - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - E - - - 1 - - - - - - false - - - inCommandShortcutSelectEdge - - - Mod/Draft - - - - - - - - - - - Add Hold - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - Q - - - 1 - - - - - - false - - - inCommandShortcutAddHold - - - Mod/Draft - - - - - - - - - - - - - - - Length - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - H - - - 1 - - - - - - false - - - inCommandShortcutLength - - - Mod/Draft - - - - - - - - - - - Wipe - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - W - - - 1 - - - - - - false - - - inCommandShortcutWipe - - - Mod/Draft - - - - - - - - - - - Set WP - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - U - - - 1 - - - - - - false - - - inCommandShortcutSetWP - - - Mod/Draft - - - - - - - - - - - - - - - Cycle Snap - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - ` - - - 1 - - - - - - false - - - inCommandShortcutCycleSnap - - - Mod/Draft - - - - - - - - - - - - - - - - - - - - - Snap - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - S - - - 1 - - - - - - false - - - inCommandShortcutSnap - - - Mod/Draft - - - - - - - - - - - Increase Radius - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - [ - - - 1 - - - - - - false - - - inCommandShortcutIncreaseRadius - - - Mod/Draft - - - - - - - - - - - Decrease Radius - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - ] - - - 1 - - - - - - false - - - inCommandShortcutDecreaseRadius - - - Mod/Draft - - - - - - - - - - - - - - - Restrict X - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - X - - - 1 - - - - - - false - - - inCommandShortcutRestrictX - - - Mod/Draft - - - - - - - - - - - Restrict Y - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - Y - - - 1 - - - - - - false - - - inCommandShortcutRestrictY - - - Mod/Draft - - - - - - - - - - - Restrict Z - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - Z - - - 1 - - - - - - false - - - RestrictZ - - - Mod/Draft - - - - - - - - - - diff --git a/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui b/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui index 1d2e2522dc..7f231e4ce7 100644 --- a/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui @@ -6,12 +6,12 @@ 0 0 - 510 - 397 + 456 + 338 - General settings + User interface settings @@ -25,954 +25,847 @@ In-Command Shortcuts - + - - - - - - - Relative - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - R - - - 1 - - - - - - false - - - inCommandShortcutRelative - - - Mod/Draft - - - - + + + 0 + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + ` + + + 1 + + + + + + false + + + inCommandShortcutCycleSnap + + + Mod/Draft + + - - - - - - - - Continue - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - T - - - 1 - - - - - - false - - - inCommandShortcutContinue - - - Mod/Draft - - - - - - + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + S + + + 1 + + + + + + false + + + inCommandShortcutSnap + + + Mod/Draft + + - - - - - - Close - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - O - - - 1 - - - - - - false - - - inCommandShortcutClose - - - Mod/Draft - - - - + + + + Close + + - - - - - - - - - - Copy - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - P - - - 1 - - - - - - false - - - inCommandShortcutCopy - - - Mod/Draft - - - - + + + + Relative + + - - - - - - Subelement Mode - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - D - - - 1 - - - - - - false - - - inCommandShortcutSubelementMode - - - Mod/Draft - - - - + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + R + + + 1 + + + + + + false + + + inCommandShortcutRelative + + + Mod/Draft + + - - - - - - Fill - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - L - - - 1 - - - - - - false - - - inCommandShortcutFill - - - Mod/Draft - - - - + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + O + + + 1 + + + + + + false + + + inCommandShortcutClose + + + Mod/Draft + + - - - - - - - - - - Exit - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - A - - - 1 - - - - - - false - - - inCommandShortcutExit - - - Mod/Draft - - - - + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + T + + + 1 + + + + + + false + + + inCommandShortcutContinue + + + Mod/Draft + + - - - - - - Select Edge - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - E - - - 1 - - - - - - false - - - inCommandShortcutSelectEdge - - - Mod/Draft - - - - + + + + Continue + + - - - - - - Add Hold - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - Q - - - 1 - - - - - - false - - - inCommandShortcutAddHold - - - Mod/Draft - - - - + + + + Copy + + - - - - - - - - - - Length - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - H - - - 1 - - - - - - false - - - inCommandShortcutLength - - - Mod/Draft - - - - + + + + Increase Radius + + - - - - - - Wipe - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - W - - - 1 - - - - - - false - - - inCommandShortcutWipe - - - Mod/Draft - - - - + + + + Cycle Snap + + - - - - - - Set WP - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - U - - - 1 - - - - - - false - - - inCommandShortcutSetWP - - - Mod/Draft - - - - + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + [ + + + 1 + + + + + + false + + + inCommandShortcutIncreaseRadius + + + Mod/Draft + + - - - - - - - - - - Cycle Snap - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - ` - - - 1 - - - - - - false - - - inCommandShortcutCycleSnap - - - Mod/Draft - - - - + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + ] + + + 1 + + + + + + false + + + inCommandShortcutDecreaseRadius + + + Mod/Draft + + - - + + + + Snap + + - - + + + + Decrease Radius + + - - - - - - - - - - Snap - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - S - - - 1 - - - - - - false - - - inCommandShortcutSnap - - - Mod/Draft - - - - + + + + Length + + - - - - - - Increase Radius - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - [ - - - 1 - - - - - - false - - - inCommandShortcutIncreaseRadius - - - Mod/Draft - - - - + + + + Wipe + + - - - - - - Decrease Radius - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - ] - - - 1 - - - - - - false - - - inCommandShortcutDecreaseRadius - - - Mod/Draft - - - - + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + D + + + 1 + + + + + + false + + + inCommandShortcutSubelementMode + + + Mod/Draft + + - - - - - - - - - - Restrict X - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - X - - - 1 - - - - - - false - - - inCommandShortcutRestrictX - - - Mod/Draft - - - - + + + + Add Hold + + - - - - - - Restrict Y - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - Y - - - 1 - - - - - - false - - - inCommandShortcutRestrictY - - - Mod/Draft - - - - + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + L + + + 1 + + + + + + false + + + inCommandShortcutFill + + + Mod/Draft + + - - - - - - Restrict Z - - - - - - - true - - - - 0 - 0 - - - - - 25 - 16777215 - - - - Z - - - 1 - - - - - - false - - - RestrictZ - - - Mod/Draft - - - - + + + + Exit + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + P + + + 1 + + + + + + false + + + inCommandShortcutCopy + + + Mod/Draft + + + + + + + Fill + + + + + + + Subelement Mode + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + E + + + 1 + + + + + + false + + + inCommandShortcutSelectEdge + + + Mod/Draft + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + H + + + 1 + + + + + + false + + + inCommandShortcutLength + + + Mod/Draft + + + + + + + Select Edge + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + W + + + 1 + + + + + + false + + + inCommandShortcutWipe + + + Mod/Draft + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + A + + + 1 + + + + + + false + + + inCommandShortcutExit + + + Mod/Draft + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + Q + + + 1 + + + + + + false + + + inCommandShortcutAddHold + + + Mod/Draft + + + + + + + Set WP + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + U + + + 1 + + + + + + false + + + inCommandShortcutSetWP + + + Mod/Draft + + + + + + + Restrict X + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + X + + + 1 + + + + + + false + + + inCommandShortcutRestrictX + + + Mod/Draft + + + + + + + Restrict Y + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + Y + + + 1 + + + + + + false + + + inCommandShortcutRestrictY + + + Mod/Draft + + + + + + + Restrict Z + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + Z + + + 1 + + + + + + false + + + RestrictZ + + + Mod/Draft + + @@ -987,101 +880,61 @@ 0 + + Enable draft statusbar customization + Draft Statusbar true + + DisplayStatusbar + + + Mod/Draft + - - - - - - - Normally, after copying objects, the copies get selected. If this option is checked, the base objects will be selected instead. - - - Draft snap widget - - - selectBaseObjects - - - Mod/Draft - - - - + + + 0 + + + + + Enable snap statusbar widget + + + Draft snap widget + + + true + + + DisplayStatusbarSnapWidget + + + Mod/Draft + + - - - - - - When this is checked, the Draft tools will create Part primitives instead of Draft objects, when available. - - - Annotation scale widget - - - UsePartPrimitives - - - Mod/Draft - - - - - - - - - - - - - - - - - Mouse navigation mode - - - true - - - focusOnLength - - - Mod/Draft - - - - - - - - - If this is checked, objects will appear as filled by default. Otherwise, they will appear as wireframe - - - 3D View size - - - true - - - fillmode - - - Mod/Draft - - - - + + + + Enable draft statusbar annotation scale widget + + + Annotation scale widget + + + DisplayStatusbarScaleWidget + + + Mod/Draft + + diff --git a/src/Mod/Draft/draftutils/init_draft_statusbar.py b/src/Mod/Draft/draftutils/init_draft_statusbar.py index 515ecda1b2..3373ac713f 100644 --- a/src/Mod/Draft/draftutils/init_draft_statusbar.py +++ b/src/Mod/Draft/draftutils/init_draft_statusbar.py @@ -1,11 +1,3 @@ -"""Draft Statusbar commands. - -This module provide the code for the Draft Statusbar, activated by initGui -""" -## @package init_draft_statusbar -# \ingroup DRAFT -# \brief This module provides the code for the Draft Statusbar. - # *************************************************************************** # * * # * Copyright (c) 2020 Carlo Pavan * @@ -29,6 +21,13 @@ This module provide the code for the Draft Statusbar, activated by initGui # * USA * # * * # *************************************************************************** +"""Draft Statusbar commands. + +This module provide the code for the Draft Statusbar, activated by initGui +""" +## @package init_draft_statusbar +# \ingroup DRAFT +# \brief This module provides the code for the Draft Statusbar. import FreeCAD as App import FreeCADGui as Gui @@ -159,13 +158,6 @@ def _set_scale(action): scale = label_to_scale(text_scale) param.SetFloat("DraftAnnotationScale", scale) -#---------------------------------------------------------------------------- -# SNAP WIDGET FUNCTIONS -#---------------------------------------------------------------------------- - -def toggle_ortho(): - Gui.runCommand('Draft_Snap_Ortho',0) - #---------------------------------------------------------------------------- # MAIN DRAFT STATUSBAR FUNCTIONS #---------------------------------------------------------------------------- @@ -325,6 +317,12 @@ def show_draft_statusbar(): """ shows draft statusbar if present or initializes it """ + params = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft") + display_statusbar = params.GetBool("DisplayStatusbar", True) + + if not display_statusbar: + return + mw = Gui.getMainWindow() if mw: sb = mw.statusBar() @@ -333,13 +331,13 @@ def show_draft_statusbar(): "draft_status_scale_widget") if scale_widget: scale_widget.show() - else: + elif params.GetBool("DisplayStatusbarScaleWidget", True): init_draft_statusbar(sb) snap_widget = sb.findChild(QtGui.QToolBar,"draft_snap_widget") if snap_widget: snap_widget.show() - else: + elif params.GetBool("DisplayStatusbarSnapWidget", True): init_draft_statusbar(sb)