From b407a1a36e44a6aabc242207a65db34820075081 Mon Sep 17 00:00:00 2001 From: "Morgan 'ARR\\!' Allen" Date: Thu, 29 Jun 2023 23:01:57 -0700 Subject: [PATCH] Migrate to using opPropertyEnumerations to set defaults This feels a bit heavy but I still feel like it's helpful to inform the path forward to consolidate these default properties. --- src/Mod/Path/Path/Op/Custom.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Mod/Path/Path/Op/Custom.py b/src/Mod/Path/Path/Op/Custom.py index 3382e64268..beb4a5c9ac 100644 --- a/src/Mod/Path/Path/Op/Custom.py +++ b/src/Mod/Path/Path/Op/Custom.py @@ -70,10 +70,25 @@ class ObjectCustom(PathOp.ObjectOp): QT_TRANSLATE_NOOP("App::Property", "The G-code to be inserted"), ) - obj.Source = [ "Text", "File" ] obj.Proxy = self self.setEditorModes(obj) + def opPropertyEnumerations(self, dateType="data"): + enum = super().opPropertyEnumerations(dateType) + + props = [ + (translate("PathCustom", "Text"), "Text"), + (translate("PathCustom", "File"), "File") + ] + + if dateType == "raw": + enum["Source"] = props + return enum + + enum.append(("Source", [ p[1][1] for p in enumerate(props) ])) + + return enum + def onChanged(self, obj, prop): if prop == "Source": self.setEditorModes(obj)