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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user