Attribute (hwx.inspire.Attributes)#
- class Attribute(fget=None, fset=None, doc=None, default=None, **kwds)#
Bases:
property
Python descriptor to set or get serializable values of Inspire objects.
Base class for all the attributes.
# Name
Type
Value
NoneType
attr
NoneType
baseUnits
category
str
computed
bool
create
bool
default
NoneType
incore
bool
listCls
NoneType
listListCls
NoneType
name
NoneType
readonly
bool
units
str
# Name
Description
apply
(**kwds)Context manager to specify Attribute constructor kwds
castForGet
(self, obj, value)Converts and returns the attribute value to its external type.
castForSet
(self, obj, value)Converts and validates the value of the attribute before setting.
classifyObject
(self, obj)createList
(self, listAttr, obj)createListList
(self, listAttr, obj)disable
(self, obj)Called by GeneralObject when destroyed (or undo of a create)
enable
(self, obj)Called by GeneralObject when created (or undo of a destroy)
getCreateArgs
(self)Helper used in create methods
getDisplayName
(self, obj)getGuiValue
(self, obj)Returns the formatted value, as shown in the Property Editor.
getInCoreValue
(self, obj)getReadonly
(self, obj)getUnits
(self, obj)getValue
(self, obj)getValueList
(self, obj)getValueListList
(self, obj)initialize
(self, objCls, name)Initializes the attribute.
loadValue
(self, obj, value)Called by GeneralObject.loadAttributeValues during stmod deserialization
populateGuiValue
(self, obj, prop)Override to customize, prop.value, displayValue, allowedValues.
populatePropertyEditor
(self, obj, prop, **kwds)Customize how attribute appears in Property Editor and ObjectTables.
setInCoreValue
(self, obj, value)setValue
(self, obj, value)setValueList
(self, obj, value)setValueListList
(self, obj, value)usingUnits
(self, units)- initialize(objCls, name)#
Initializes the attribute.
- Parameters:
objCls (class) – Object class this attribute belongs to.
name (str) – Name of the attribute.
- getCreateArgs()#
Helper used in create methods
- castForSet(obj, value)#
Converts and validates the value of the attribute before setting.
Converts the value it to its internal type (and base units if applicable).
- Parameters:
obj (GeneralObject) – Object this attribute belongs to.
value (Any) – Value of the attribute to set.
- Returns:
Validated and converted value.
- Return type:
value (Any)
- castForGet(obj, value)#
Converts and returns the attribute value to its external type.
- Parameters:
obj (GeneralObject) – Object this attribute belongs to.
value (Any) – Value of the attribute to be converted.
- Returns:
Converted value.
- Return type:
value (Any)
- populatePropertyEditor(obj, prop, **kwds)#
Customize how attribute appears in Property Editor and ObjectTables.
- Parameters:
obj (GeneralObject) –
prop (hwt::Property) – Property Editor interface.
component (int) – 0, 1, 2 Only passed when showing Triples 1 value at a time.
- populateGuiValue(obj, prop)#
Override to customize, prop.value, displayValue, allowedValues.
The prop.value type determines which editor widget used: - bool -> checkbox - str -> line edit - hwtypes.Color -> color picker
Setting prop.allowedValues yields a ComboBox.
prop.displayValue is a str shown when the editor loses focus.
- loadValue(obj, value)#
Called by GeneralObject.loadAttributeValues during stmod deserialization
- getGuiValue(obj)#
Returns the formatted value, as shown in the Property Editor.
- enable(obj)#
Called by GeneralObject when created (or undo of a destroy)
- disable(obj)#
Called by GeneralObject when destroyed (or undo of a create)