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.
This commit is contained in:
Morgan 'ARR\!' Allen
2023-06-29 23:01:57 -07:00
parent 3a5655ea4b
commit c330c31b6a

View File

@@ -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)