def setPropertyInitialiserValue(propertyInitialiser, value): valueType = type(value) pythonType = FalagardElementAttributesManager.getPythonTypeFromCeguiType(valueType) from ceed.cegui import ceguitypes if issubclass(pythonType, ceguitypes.Base): # if the value's type is a subclass of a python ceguitype, convert the value to a string valueAsString = pythonType.toString(value) else: valueAsString = unicode(value) propertyInitialiser.setInitialiserValue(valueAsString)
def setPropertyInitialiserValue(propertyInitialiser, value): valueType = type(value) pythonType = FalagardElementAttributesManager.getPythonTypeFromCeguiType(valueType) from ceed.cegui import ceguitypes if issubclass(pythonType, ceguitypes.Base): # if the value's type is a subclass of a python ceguitype, convert the value to a string valueAsString = pythonType.toString(value) else: valueAsString = unicode(value) propertyInitialiser.setInitialiserValue(valueAsString)
def convertToCeguiValueAndCeguiType(valueAsString, dataTypeAsString): """ Converts a string based CEGUI value and CEGUI type to the native CEGUI value and CEGUI type :param valueAsString: str :param dataTypeAsString: str :return: """ from ceed.propertysetinspector import CEGUIPropertyManager pythonDataType = CEGUIPropertyManager.getPythonTypeFromStringifiedCeguiType(dataTypeAsString) value = FalagardElementInterface.getCeguiTypeValueFromString(pythonDataType, valueAsString) valueType = FalagardElementAttributesManager.getCeguiTypeTypeFromPythonType(pythonDataType) return value, valueType
def convertToCeguiValueAndCeguiType(valueAsString, dataTypeAsString): """ Converts a string based CEGUI value and CEGUI type to the native CEGUI value and CEGUI type :param valueAsString: str :param dataTypeAsString: str :return: """ from ceed.propertysetinspector import CEGUIPropertyManager pythonDataType = CEGUIPropertyManager.getPythonTypeFromStringifiedCeguiType(dataTypeAsString) value = FalagardElementInterface.getCeguiTypeValueFromString(pythonDataType, valueAsString) valueType = FalagardElementAttributesManager.getCeguiTypeTypeFromPythonType(pythonDataType) return value, valueType