chore: archive QuickNav and ZTools into reference folder (#345)
All checks were successful
Build and Test / build (pull_request) Successful in 32m17s
All checks were successful
Build and Test / build (pull_request) Successful in 32m17s
Copy QuickNav and ZTools source trees into reference/ for developer reference during the UI/UX rework. These are plain directories (not submodules) and are not included in the build. - reference/quicknav/ — QuickNav addon source - reference/ztools/ — ZTools addon source Part of the UI/UX rework preparation. See #346.
This commit is contained in:
285
reference/quicknav/quicknav/workbench_map.py
Normal file
285
reference/quicknav/quicknav/workbench_map.py
Normal file
@@ -0,0 +1,285 @@
|
||||
"""Static workbench slot assignments and command groupings.
|
||||
|
||||
Phase 1 uses hardcoded data from the QuickNav spec (SPEC.md section 5).
|
||||
Phase 2 replaces this with dynamic toolbar introspection.
|
||||
"""
|
||||
|
||||
# Fixed Ctrl+N workbench assignments
|
||||
WORKBENCH_SLOTS = {
|
||||
1: {
|
||||
"key": "sketcher",
|
||||
"class_name": "SketcherWorkbench",
|
||||
"display": "Sketcher",
|
||||
},
|
||||
2: {
|
||||
"key": "partdesign",
|
||||
"class_name": "PartDesignWorkbench",
|
||||
"display": "Part Design",
|
||||
},
|
||||
3: {
|
||||
"key": "assembly",
|
||||
"class_name": "AssemblyWorkbench",
|
||||
"display": "Assembly",
|
||||
},
|
||||
4: {
|
||||
"key": "spreadsheet",
|
||||
"class_name": "SpreadsheetWorkbench",
|
||||
"display": "Spreadsheet",
|
||||
},
|
||||
5: {
|
||||
"key": "techdraw",
|
||||
"class_name": "TechDrawWorkbench",
|
||||
"display": "TechDraw",
|
||||
},
|
||||
}
|
||||
|
||||
# Command groupings per workbench. Each grouping has a name and up to
|
||||
# 9 commands as (FreeCAD_command_id, display_name) tuples.
|
||||
WORKBENCH_GROUPINGS = {
|
||||
"sketcher": [
|
||||
{
|
||||
"name": "Primitives",
|
||||
"commands": [
|
||||
("Sketcher_CreateLine", "Line"),
|
||||
("Sketcher_CreateRectangle", "Rectangle"),
|
||||
("Sketcher_CreateCircle", "Circle"),
|
||||
("Sketcher_CreateArc", "Arc"),
|
||||
("Sketcher_CreatePoint", "Point"),
|
||||
("Sketcher_CreateSlot", "Slot"),
|
||||
("Sketcher_CreateBSpline", "B-Spline"),
|
||||
("Sketcher_CreatePolyline", "Polyline"),
|
||||
("Sketcher_CreateEllipseByCenter", "Ellipse"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Constraints",
|
||||
"commands": [
|
||||
("Sketcher_ConstrainCoincidentUnified", "Coincident"),
|
||||
("Sketcher_ConstrainHorizontal", "Horizontal"),
|
||||
("Sketcher_ConstrainVertical", "Vertical"),
|
||||
("Sketcher_ConstrainParallel", "Parallel"),
|
||||
("Sketcher_ConstrainPerpendicular", "Perpendicular"),
|
||||
("Sketcher_ConstrainTangent", "Tangent"),
|
||||
("Sketcher_ConstrainEqual", "Equal"),
|
||||
("Sketcher_ConstrainSymmetric", "Symmetric"),
|
||||
("Sketcher_ConstrainBlock", "Block"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Dimensions",
|
||||
"commands": [
|
||||
("Sketcher_ConstrainDistance", "Distance"),
|
||||
("Sketcher_ConstrainDistanceX", "Horiz. Distance"),
|
||||
("Sketcher_ConstrainDistanceY", "Vert. Distance"),
|
||||
("Sketcher_ConstrainRadius", "Radius"),
|
||||
("Sketcher_ConstrainDiameter", "Diameter"),
|
||||
("Sketcher_ConstrainAngle", "Angle"),
|
||||
("Sketcher_ConstrainLock", "Lock"),
|
||||
("Sketcher_ConstrainSnellsLaw", "Refraction"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Construction",
|
||||
"commands": [
|
||||
("Sketcher_ToggleConstruction", "Toggle Constr."),
|
||||
("Sketcher_External", "External Geom."),
|
||||
("Sketcher_CarbonCopy", "Carbon Copy"),
|
||||
("Sketcher_Offset", "Offset"),
|
||||
("Sketcher_Trimming", "Trim"),
|
||||
("Sketcher_Extend", "Extend"),
|
||||
("Sketcher_Split", "Split"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Tools",
|
||||
"commands": [
|
||||
("Sketcher_Symmetry", "Mirror"),
|
||||
("Sketcher_RectangularArray", "Linear Array"),
|
||||
("Sketcher_Move", "Move"),
|
||||
("Sketcher_Rotate", "Rotate"),
|
||||
("Sketcher_Scale", "Scale"),
|
||||
("Sketcher_CloseShape", "Close Shape"),
|
||||
("Sketcher_ConnectLines", "Connect Edges"),
|
||||
],
|
||||
},
|
||||
],
|
||||
"partdesign": [
|
||||
{
|
||||
"name": "Additive",
|
||||
"commands": [
|
||||
("PartDesign_Pad", "Pad"),
|
||||
("PartDesign_Revolution", "Revolution"),
|
||||
("PartDesign_AdditiveLoft", "Add. Loft"),
|
||||
("PartDesign_AdditivePipe", "Add. Pipe"),
|
||||
("PartDesign_AdditiveHelix", "Add. Helix"),
|
||||
("PartDesign_CompPrimitiveAdditive", "Add. Primitive"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Subtractive",
|
||||
"commands": [
|
||||
("PartDesign_Pocket", "Pocket"),
|
||||
("PartDesign_Hole", "Hole"),
|
||||
("PartDesign_Groove", "Groove"),
|
||||
("PartDesign_SubtractiveLoft", "Sub. Loft"),
|
||||
("PartDesign_SubtractivePipe", "Sub. Pipe"),
|
||||
("PartDesign_SubtractiveHelix", "Sub. Helix"),
|
||||
("PartDesign_CompPrimitiveSubtractive", "Sub. Primitive"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Datums",
|
||||
"commands": [
|
||||
("PartDesign_NewSketch", "New Sketch"),
|
||||
("PartDesign_Plane", "Datum Plane"),
|
||||
("PartDesign_Line", "Datum Line"),
|
||||
("PartDesign_Point", "Datum Point"),
|
||||
("PartDesign_ShapeBinder", "Shape Binder"),
|
||||
("PartDesign_SubShapeBinder", "Sub-Shape Binder"),
|
||||
("ZTools_DatumCreator", "ZT Datum Creator"),
|
||||
("ZTools_DatumManager", "ZT Datum Manager"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Transformations",
|
||||
"commands": [
|
||||
("PartDesign_Mirrored", "Mirrored"),
|
||||
("PartDesign_LinearPattern", "Linear Pattern"),
|
||||
("PartDesign_PolarPattern", "Polar Pattern"),
|
||||
("PartDesign_MultiTransform", "MultiTransform"),
|
||||
("ZTools_RotatedLinearPattern", "ZT Rot. Linear"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Modeling",
|
||||
"commands": [
|
||||
("PartDesign_Fillet", "Fillet"),
|
||||
("PartDesign_Chamfer", "Chamfer"),
|
||||
("PartDesign_Draft", "Draft"),
|
||||
("PartDesign_Thickness", "Thickness"),
|
||||
("PartDesign_Boolean", "Boolean"),
|
||||
("ZTools_EnhancedPocket", "ZT Enh. Pocket"),
|
||||
],
|
||||
},
|
||||
],
|
||||
"assembly": [
|
||||
{
|
||||
"name": "Components",
|
||||
"commands": [
|
||||
("Assembly_InsertLink", "Insert Component"),
|
||||
("Assembly_InsertNewPart", "Create Part"),
|
||||
("Assembly_CreateAssembly", "Create Assembly"),
|
||||
("Assembly_ToggleGrounded", "Ground"),
|
||||
("Assembly_CreateBom", "BOM"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Joints",
|
||||
"commands": [
|
||||
("Assembly_CreateJointFixed", "Fixed"),
|
||||
("Assembly_CreateJointRevolute", "Revolute"),
|
||||
("Assembly_CreateJointCylindrical", "Cylindrical"),
|
||||
("Assembly_CreateJointSlider", "Slider"),
|
||||
("Assembly_CreateJointBall", "Ball"),
|
||||
("Assembly_CreateJointDistance", "Distance"),
|
||||
("Assembly_CreateJointAngle", "Angle"),
|
||||
("Assembly_CreateJointParallel", "Parallel"),
|
||||
("Assembly_CreateJointPerpendicular", "Perpendicular"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Patterns",
|
||||
"commands": [
|
||||
("ZTools_AssemblyLinearPattern", "Linear Pattern"),
|
||||
("ZTools_AssemblyPolarPattern", "Polar Pattern"),
|
||||
],
|
||||
},
|
||||
],
|
||||
"spreadsheet": [
|
||||
{
|
||||
"name": "Editing",
|
||||
"commands": [
|
||||
("Spreadsheet_MergeCells", "Merge Cells"),
|
||||
("Spreadsheet_SplitCell", "Split Cell"),
|
||||
("Spreadsheet_SetAlias", "Alias"),
|
||||
("Spreadsheet_Import", "Import CSV"),
|
||||
("Spreadsheet_Export", "Export CSV"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Formatting",
|
||||
"commands": [
|
||||
("ZTools_SpreadsheetStyleBold", "Bold"),
|
||||
("ZTools_SpreadsheetStyleItalic", "Italic"),
|
||||
("ZTools_SpreadsheetStyleUnderline", "Underline"),
|
||||
("ZTools_SpreadsheetAlignLeft", "Align Left"),
|
||||
("ZTools_SpreadsheetAlignCenter", "Align Center"),
|
||||
("ZTools_SpreadsheetAlignRight", "Align Right"),
|
||||
("ZTools_SpreadsheetBgColor", "BG Color"),
|
||||
("ZTools_SpreadsheetTextColor", "Text Color"),
|
||||
("ZTools_SpreadsheetQuickAlias", "Quick Alias"),
|
||||
],
|
||||
},
|
||||
],
|
||||
"techdraw": [
|
||||
{
|
||||
"name": "Views",
|
||||
"commands": [
|
||||
("TechDraw_PageDefault", "New Page"),
|
||||
("TechDraw_View", "Insert View"),
|
||||
("TechDraw_ProjectionGroup", "Projection Group"),
|
||||
("TechDraw_SectionView", "Section View"),
|
||||
("TechDraw_DetailView", "Detail View"),
|
||||
("TechDraw_ActiveView", "Active View"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Dimensions",
|
||||
"commands": [
|
||||
("TechDraw_LengthDimension", "Length"),
|
||||
("TechDraw_HorizontalDimension", "Horizontal"),
|
||||
("TechDraw_VerticalDimension", "Vertical"),
|
||||
("TechDraw_RadiusDimension", "Radius"),
|
||||
("TechDraw_DiameterDimension", "Diameter"),
|
||||
("TechDraw_AngleDimension", "Angle"),
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Annotations",
|
||||
"commands": [
|
||||
("TechDraw_Annotation", "Annotation"),
|
||||
("TechDraw_Balloon", "Balloon"),
|
||||
("TechDraw_LeaderLine", "Leader Line"),
|
||||
("TechDraw_CosmeticVertex", "Cosmetic Vertex"),
|
||||
("TechDraw_Midpoints", "Midpoints"),
|
||||
("TechDraw_CenterLine", "Center Line"),
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def get_workbench_slot(n):
|
||||
"""Return workbench info dict for Ctrl+N, or None if unassigned."""
|
||||
return WORKBENCH_SLOTS.get(n)
|
||||
|
||||
|
||||
def get_groupings(workbench_key):
|
||||
"""Return the grouping list for a workbench key."""
|
||||
return WORKBENCH_GROUPINGS.get(workbench_key, [])
|
||||
|
||||
|
||||
def get_grouping(workbench_key, grouping_idx):
|
||||
"""Return a specific grouping dict by 0-based index, or None."""
|
||||
groupings = get_groupings(workbench_key)
|
||||
if 0 <= grouping_idx < len(groupings):
|
||||
return groupings[grouping_idx]
|
||||
return None
|
||||
|
||||
|
||||
def get_command(workbench_key, grouping_idx, n):
|
||||
"""Return the FreeCAD command ID for the Nth command (1-based), or None."""
|
||||
grouping = get_grouping(workbench_key, grouping_idx)
|
||||
if grouping and 1 <= n <= len(grouping["commands"]):
|
||||
return grouping["commands"][n - 1][0]
|
||||
return None
|
||||
Reference in New Issue
Block a user