Assembly: Mark new features as experimental. To enable them you need to create a parameter called ExperimentalFeatures and set it to true.

This commit is contained in:
PaddleStroke
2024-04-17 15:39:29 +02:00
committed by Yorik van Havre
parent 3419d27077
commit ce455de2c5
2 changed files with 29 additions and 10 deletions

View File

@@ -64,21 +64,20 @@ class AssemblyWorkbench(Workbench):
from PySide import QtCore, QtGui
from PySide.QtCore import QT_TRANSLATE_NOOP
import CommandCreateAssembly, CommandInsertLink, CommandCreateJoint, CommandSolveAssembly, CommandExportASMT, CommandCreateView
from Preferences import PreferencesPage
# from Preferences import preferences
import Preferences
FreeCADGui.addLanguagePath(":/translations")
FreeCADGui.addIconPath(":/icons")
FreeCADGui.addPreferencePage(PreferencesPage, QT_TRANSLATE_NOOP("QObject", "Assembly"))
FreeCADGui.addPreferencePage(
Preferences.PreferencesPage, QT_TRANSLATE_NOOP("QObject", "Assembly")
)
# build commands list
cmdList = [
"Assembly_CreateAssembly",
"Assembly_InsertLink",
"Assembly_SolveAssembly",
"Assembly_CreateView",
]
cmdListMenuOnly = [
@@ -94,12 +93,17 @@ class AssemblyWorkbench(Workbench):
"Assembly_CreateJointSlider",
"Assembly_CreateJointBall",
"Assembly_CreateJointDistance",
"Separator",
"Assembly_CreateJointRackPinion",
"Assembly_CreateJointScrew",
"Assembly_CreateJointGearBelt",
]
if Preferences.preferences().GetBool("ExperimentalFeatures", False):
cmdList = cmdList + ["Assembly_CreateView"]
cmdListJoints = cmdListJoints + [
"Separator",
"Assembly_CreateJointRackPinion",
"Assembly_CreateJointScrew",
"Assembly_CreateJointGearBelt",
]
self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Assembly"), cmdList)
self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Assembly Joints"), cmdListJoints)

View File

@@ -57,6 +57,16 @@ TranslatedJointTypes = [
translate("Assembly", "Belt"),
]
TranslatedJointTypesNoExperimental = [
translate("Assembly", "Fixed"),
translate("Assembly", "Revolute"),
translate("Assembly", "Cylindrical"),
translate("Assembly", "Slider"),
translate("Assembly", "Ball"),
translate("Assembly", "Distance"),
]
JointTypes = [
"Fixed",
"Revolute",
@@ -1168,7 +1178,12 @@ class TaskAssemblyCreateJoint(QtCore.QObject):
if self.activeType == "Part":
self.form.setWindowTitle("Match parts")
self.form.jointType.hide()
self.form.jointType.addItems(TranslatedJointTypes)
if Preferences.preferences().GetBool("ExperimentalFeatures", True):
self.form.jointType.addItems(TranslatedJointTypes)
else:
self.form.jointType.addItems(TranslatedJointTypesNoExperimental)
self.form.jointType.setCurrentIndex(jointTypeIndex)
self.form.jointType.currentIndexChanged.connect(self.onJointTypeChanged)