import GafferUI editor = GafferUI.CompoundEditor() editor.setCompoundData( { "name" : "John", "surname" : "Doe", "age" : 35.5 } )
import GafferUI data = { "fruits" : ["apple", "banana", "orange"], "vegetables" : ["carrot", "broccoli", "spinach"] } editor = GafferUI.CompoundEditor() editor.setCompoundData(data) for section in data.keys(): sectionWidget = editor.addSection(section) for item in data[section]: itemWidget = editor.addItem(sectionWidget, item)
import GafferUI class Person: def __init__(self, name, age): self.name = name self.age = age def __getstate__(self): return { "name" : self.name, "age" : self.age } def __setstate__(self, state): self.name = state["name"] self.age = state["age"] person = Person("John", 35) editor = GafferUI.CompoundEditor() editor.setCompoundData(person.__getstate__()) sectionWidget = editor.addSection("Details") editor.addItem(sectionWidget, "name") editor.addItem(sectionWidget, "age")