def createPropertyForFalagardElement(self, falagardElement, attributeName, attributeValue, attributeCeguiType, helpText): """ Create a FalagardElementEditorProperty based on a type-specific property for the FalagardElement's attribute """ from ceed.editors.looknfeel.falagard_element_interface import FalagardElementInterface falagardElementTypeStr = FalagardElementInterface.getFalagardElementTypeAsString(falagardElement) # Get the python type representing the cegui type and also the editor options pythonDataType, editorOptions = self.getPythonCeguiTypeAndEditorOptions(self.propertyMap, falagardElementTypeStr, attributeName, attributeCeguiType) # Get the pythonised type of the value and also its editor-propertytype pythonTypeValue, propertyType = self.getEditorPropertyTypeAndValue(pythonDataType, attributeValue) # Unmap the reference in case we reference to the WidgetLookFeel if attributeName == "look" and falagardElementTypeStr == "SectionSpecification" and pythonTypeValue: from ceed.editors.looknfeel.tabbed_editor import LookNFeelTabbedEditor pythonTypeValue, _ = LookNFeelTabbedEditor.unmapMappedNameIntoOriginalParts(pythonTypeValue) typedProperty = propertyType(name=attributeName, category=falagardElementTypeStr, helpText=helpText, value=pythonTypeValue, defaultValue=pythonTypeValue, readOnly=False, editorOptions=editorOptions, createComponents=True ) # create and return the multi wrapper return FalagardElementEditorProperty(typedProperty, falagardElement, attributeName, self.visual)
def __init__(self, falagardProperty, visual, falagardElement, attributeName, newValue, ignoreNextCallback=False): super(FalagardElementAttributeEdit, self).__init__() self.visual = visual """ :type : LookNFeelVisualEditing """ self.falagardElement = falagardElement self.attributeName = attributeName self.falagardProperty = falagardProperty """ :type : FalagardElementEditorProperty""" # We retrieve the momentary value using the getter callback and store it as old value from falagard_element_interface import FalagardElementInterface self.oldValue, ceguiType = FalagardElementInterface.getAttributeValue( falagardElement, attributeName, visual.tabbedEditor) self.oldValueAsString = unicode(self.oldValue) # If the value is a subtype of from ceed.cegui import ceguitypes newValueType = type(newValue) if issubclass(newValueType, ceguitypes.Base): # if it is a subclass of our ceguitypes, do some special handling self.newValueAsString = unicode(newValue) self.newValue = newValueType.toCeguiType(self.newValueAsString) elif newValueType is bool or newValueType is unicode: self.newValue = newValue self.newValueAsString = unicode(newValue) else: raise Exception("Unexpected type encountered") # Get the Falagard element's type as string so we can display better info from ceed.editors.looknfeel.falagard_element_interface import FalagardElementInterface self.falagardElementName = FalagardElementInterface.getFalagardElementTypeAsString( falagardElement) self.refreshText() self.ignoreNextCall = ignoreNextCallback
def createPropertyForFalagardElement(self, falagardElement, attributeName, attributeValue, attributeCeguiType, helpText): """ Create a FalagardElementEditorProperty based on a type-specific property for the FalagardElement's attribute """ from ceed.editors.looknfeel.falagard_element_interface import FalagardElementInterface falagardElementTypeStr = FalagardElementInterface.getFalagardElementTypeAsString( falagardElement) # Get the python type representing the cegui type and also the editor options pythonDataType, editorOptions = self.getPythonCeguiTypeAndEditorOptions( self.propertyMap, falagardElementTypeStr, attributeName, attributeCeguiType) # Get the pythonised type of the value and also its editor-propertytype pythonTypeValue, propertyType = self.getEditorPropertyTypeAndValue( pythonDataType, attributeValue) # Unmap the reference in case we reference to the WidgetLookFeel if attributeName == "look" and falagardElementTypeStr == "SectionSpecification" and pythonTypeValue: from ceed.editors.looknfeel.tabbed_editor import LookNFeelTabbedEditor pythonTypeValue, _ = LookNFeelTabbedEditor.unmapMappedNameIntoOriginalParts( pythonTypeValue) typedProperty = propertyType(name=attributeName, category=falagardElementTypeStr, helpText=helpText, value=pythonTypeValue, defaultValue=pythonTypeValue, readOnly=False, editorOptions=editorOptions, createComponents=True) # create and return the multi wrapper return FalagardElementEditorProperty(typedProperty, falagardElement, attributeName, self.visual)
def __init__(self, falagardProperty, visual, falagardElement, attributeName, newValue, ignoreNextCallback=False): super(FalagardElementAttributeEdit, self).__init__() self.visual = visual """ :type : LookNFeelVisualEditing """ self.falagardElement = falagardElement self.attributeName = attributeName self.falagardProperty = falagardProperty """ :type : FalagardElementEditorProperty""" # We retrieve the momentary value using the getter callback and store it as old value from falagard_element_interface import FalagardElementInterface self.oldValue, ceguiType = FalagardElementInterface.getAttributeValue(falagardElement, attributeName, visual.tabbedEditor) self.oldValueAsString = unicode(self.oldValue) # If the value is a subtype of from ceed.cegui import ceguitypes newValueType = type(newValue) if issubclass(newValueType, ceguitypes.Base): # if it is a subclass of our ceguitypes, do some special handling self.newValueAsString = unicode(newValue) self.newValue = newValueType.toCeguiType(self.newValueAsString) elif newValueType is bool or newValueType is unicode: self.newValue = newValue self.newValueAsString = unicode(newValue) else: raise Exception("Unexpected type encountered") # Get the Falagard element's type as string so we can display better info from ceed.editors.looknfeel.falagard_element_interface import FalagardElementInterface self.falagardElementName = FalagardElementInterface.getFalagardElementTypeAsString(falagardElement) self.refreshText() self.ignoreNextCall = ignoreNextCallback