[Draft] Improved Snapper Toolbar Behaviour

Changed snap toolbar behaviour:
- create a list of available snaps (Gui.Snapper.snaps)
- make it consistent with Snap Gui Commands (in gui_snaps module)
- create a list of active snaps (Gui.Snapper.active_snaps)
- refactor the isEnabled() method to allow it to check if the given snap is in Gui.Snapper.active_snaps and not if the snap toolbar button isChecked()
- updated and reordered the new list of gui snap commands in draftutils.init_tools and used it as a base to refactor the creation of draft toolbar
- updated all the draft snap gui tools to make them control the toolbar buttons directly
.


.


.
This commit is contained in:
carlopav
2020-03-21 10:09:34 +01:00
committed by Yorik van Havre
parent add624353d
commit 55e537d79d
4 changed files with 259 additions and 220 deletions

View File

@@ -115,15 +115,15 @@ def get_draft_utility_commands():
def get_draft_snap_commands():
"""Return the snapping commands list."""
return ['Draft_Snap_Lock', 'Draft_Snap_Midpoint',
'Draft_Snap_Perpendicular',
'Draft_Snap_Grid', 'Draft_Snap_Intersection',
'Draft_Snap_Parallel',
'Draft_Snap_Endpoint', 'Draft_Snap_Angle',
'Draft_Snap_Center',
'Draft_Snap_Extension', 'Draft_Snap_Near',
'Draft_Snap_Ortho', 'Draft_Snap_Special',
'Draft_Snap_Dimensions', 'Draft_Snap_WorkingPlane']
return ['Draft_Snap_Lock',
'Draft_Snap_Endpoint', 'Draft_Snap_Midpoint',
'Draft_Snap_Center', 'Draft_Snap_Angle',
'Draft_Snap_Intersection', 'Draft_Snap_Perpendicular',
'Draft_Snap_Extension', 'Draft_Snap_Parallel',
'Draft_Snap_Special', 'Draft_Snap_Near',
'Draft_Snap_Ortho', 'Draft_Snap_Grid',
'Draft_Snap_WorkingPlane', 'Draft_Snap_Dimensions',
]
def init_draft_toolbars(workbench):