| |
- BasicProperty(Propertied)
-
- BooleanProperty
- BooleansProperty
- ClassNameProperty
- ClassNamesProperty
- ClassProperty
- ClassProperty
- ClassesProperty
- ClassesProperty
- DateTimeDeltaProperty
- DateTimeProperty
- DecimalProperty
- FloatProperty
- FloatsProperty
- IntegerProperty
- IntegersProperty
- ListProperty
- LongProperty
- LongsProperty
- StringLocaleProperty
- StringProperty
- StringsProperty
- TimeOfDayProperty
class BooleanProperty(BasicProperty) |
|
Boolean property |
|
- Method resolution order:
- BooleanProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.basic_types.Boolean_DT'>
- Boolean-integer data-type specifier
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01CF9E30>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class BooleansProperty(BasicProperty) |
|
Booleans list property |
|
- Method resolution order:
- BooleansProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.list_types.listof_bools'>
- default = <basicproperty.defaults.DefaultCallable object at 0x016164F0>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FF30>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
ClassByNameProperty = class ClassProperty(BasicProperty) |
|
Class property |
|
- Method resolution order:
- ClassProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.basic_types.Class_DT'>
- Class-object data-type specifier
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FF30>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
ClassByNamesProperty = class ClassesProperty(BasicProperty) |
|
Classes list property |
|
- Method resolution order:
- ClassesProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.list_types.listof_classes'>
- default = <basicproperty.defaults.DefaultCallable object at 0x01623270>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class ClassNameProperty(BasicProperty) |
|
Class-name property |
|
- Method resolution order:
- ClassNameProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.basic_types.ClassName_DT'>
- Class-name data-type specifier
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class ClassNamesProperty(BasicProperty) |
|
ClassNames list property |
|
- Method resolution order:
- ClassNamesProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.list_types.listof_classnames'>
- default = <basicproperty.defaults.DefaultCallable object at 0x016230D0>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class ClassProperty(BasicProperty) |
|
Class property |
|
- Method resolution order:
- ClassProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.basic_types.Class_DT'>
- Class-object data-type specifier
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FCD0>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class ClassesProperty(BasicProperty) |
|
Classes list property |
|
- Method resolution order:
- ClassesProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.list_types.listof_classes'>
- default = <basicproperty.defaults.DefaultCallable object at 0x01623270>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FF30>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class DateTimeDeltaProperty(BasicProperty) |
|
DateTimeDelta property |
|
- Method resolution order:
- DateTimeDeltaProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.datemx_types.mxDateTimeDelta_DT'>
- Data type for an mx.DateTime.DateTimeDelta value
- default = <basicproperty.defaults.DefaultCallable object at 0x01B47D30>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FF30>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class DateTimeProperty(BasicProperty) |
|
DateTime property |
|
- Method resolution order:
- DateTimeProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.datemx_types.mxDateTime_DT'>
- Data type for an mx.DateTime.DateTime value
- default = <basicproperty.defaults.DefaultCallable object at 0x016232D0>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class DecimalProperty(BasicProperty) |
|
Decimal property |
|
- Method resolution order:
- DecimalProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.decimaldt.DecimalDT'>
- Numeric data-type descriptor for the new standard Decimal type
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FF30>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class FloatProperty(BasicProperty) |
|
Floating-point property |
|
- Method resolution order:
- FloatProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.basic_types.Float_DT'>
- Integer data-type specifier
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class FloatsProperty(BasicProperty) |
|
Floats list property |
|
- Method resolution order:
- FloatsProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.list_types.listof_floats'>
- default = <basicproperty.defaults.DefaultCallable object at 0x01616F90>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class IntegerProperty(BasicProperty) |
|
Integer property |
|
- Method resolution order:
- IntegerProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.basic_types.Int_DT'>
- Integer data-type specifier
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class IntegersProperty(BasicProperty) |
|
Ints list property |
|
- Method resolution order:
- IntegersProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.list_types.listof_ints'>
- default = <basicproperty.defaults.DefaultCallable object at 0x01616630>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FF30>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class ListProperty(BasicProperty) |
|
Generic list property |
|
- Method resolution order:
- ListProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.basic_types.List_DT'>
- List-of-objects data-type (no coercion of items)
Conceptually this is a listof_objects, but that would
make an inefficient type for such a common datatype.
- default = <basicproperty.defaults.DefaultCallable object at 0x016163F0>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FF30>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class LongProperty(BasicProperty) |
|
Long/large integer property |
|
- Method resolution order:
- LongProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.basic_types.Long_DT'>
- Long-integer data-type specifier
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FF30>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class LongsProperty(BasicProperty) |
|
Longs list property |
|
- Method resolution order:
- LongsProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.list_types.listof_longs'>
- default = <basicproperty.defaults.DefaultCallable object at 0x016164B0>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class StringLocaleProperty(BasicProperty) |
|
Byte-string (locale-specific) property
Normally used for storing low-level types such
as module or file names which are not unicode-
aware. |
|
- Method resolution order:
- StringLocaleProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.basic_types.StringLocale_DT'>
- String data-type specifier
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class StringProperty(BasicProperty) |
|
Human-friendly (unicode) text property |
|
- Method resolution order:
- StringProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.basic_types.String_DT'>
- String (Unicode) data-type specifier
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class StringsProperty(BasicProperty) |
|
Strings list property |
|
- Method resolution order:
- StringsProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.list_types.listof_strings'>
- default = <basicproperty.defaults.DefaultCallable object at 0x01623070>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class TimeOfDayProperty(BasicProperty) |
|
DateTimeDelta property |
|
- Method resolution order:
- TimeOfDayProperty
- BasicProperty
- Propertied
- object
Data and other attributes defined here:
- baseType = <class 'basictypes.datemx_types.mxTimeOfDay'>
- Representation of a time during a particular day
This implementation is simply a sub-class of
RelativeDateTime which provides the functionality
of a data-type definition
- default = <basicproperty.defaults.DefaultCallable object at 0x01B60230>
- A holder for a callable object producing default values
The callable object is called with the signature:
callable( property, client )
where client is the instance object and property
is the BasicProperty itself.
Methods inherited from BasicProperty:
- __delete__(self, client)
- Delete the current value of the property for the client
At the moment, this method does nothing beyond calling
_delValue( client ), as there does not appear to be
any common feature required from __delete__. The method is
here primarily to maintain the consistency of the interface
and allow for applications to override _delValue without
worrying about losing future features added to __delete__.
- __get__(self, client, klass=None)
- Retrieve the current value of the property for the client
This function provides the machinery for default value and
default function support. If the _getValue method raises
a KeyError or AttributeError, this method will attempt to
find a default value for the property using self.getDefault
- __init__(self, name, documentation='', **namedarguments)
- Create a new basic property object
name -- name of the property, used for storage and reporting
documentation -- appears in automated documentation systems
baseType -- an object representing the base-type of the
property's values. May include the following values:
coerce( value ) -- coerce value to acceptable type
check( value ) -- check that given value is acceptable,
return false if it is not.
factories( ) -- return a list of factory functions/classes
for creating new instances of the class
dataType -- string specifying a data-type key for the
values. This specifier is entirely local to the
properties system, with no neccessary relation to
class or type names. With that said, generally the
values are the dotted-name of the class/type allowed
for the property.
Note: This can be a dotted name with the trailing
items specifying more specific data types, so, for
instance, str.long will use the "long string" editor if
it's registered, or the "string" editor if not.
if coerce is not present, the class should have an initialiser
that allows passing a single value as the value to coerce.
if check is not present, check will be done as
isinstance( value, baseType).
if factories is not present, factories will be assumed to be
the baseType itself.
defaultValue -- static value to be used as default, if not
specified, not provided
defaultFunction -- function with signature function( property,
client ) which returns a dynamic default value
setDefaultOnGet -- if true (default), then retrieving a
default value causes the value to be explicitly set as the
current value
boundaries -- series of callable Boundary objects which are
(if present) called for each set/getDefault in order to
confirm that the given value abides by the boundaries
defined. Should generally only raise ValueError, TypeError,
KeyError or AttributeError (or sub-classes of those) as
appropriate to the boundary violation.
Called as:
boundary( value, property, client )
note that the basictypes.boundary module defines a number
of Boundary objects which are designed to be used in this
field of the property.
friendlyName -- user-friendly name for use in UIs and the like,
defaults to the current value of name
trueProperty -- if true, this property really does describe a
property, that is, a descriptor for an attribute which is
accessed using object.x notation.
if false, this property is used to interact with the
property system, but is not actually a property of an
object (for instance when the object is an old-style class
which cannot support properties, you can define virtual
properties for use with the class) The property system
can examine the value of trueProperty to determine whether
to use setattr(object,name,value) or call
property.__set__(object, value) to use the property.
Notes:
You can specify _any_ name=value set to store a value, so,
for instance, you could specify __get__ to override the
__get__ method, or similarly _getValue or getDefault.
Sub-classes may (and do) define extra name=value pairs to
support extended functionality. You will need to look at
the sub-class's documentation for details on other
significant attribute names.
- __repr__(self)
- Get a representation of this property object
- __set__(self, client, value)
- Set the current value of the property for the client
This function provides the machinery for coercion and
bounds checking. Before calling the _setValue method,
__set__ calls coerce( client, value ), with the return
value from the coercion becoming the value to be set.
Coercion may raise TypeError or ValueError exceptions,
and the application should be ready to catch these errors.
Once coercion is finished, __set__ calls
check( client, value ) to allow each boundary
condition to check the current value. The boundary
conditions may raise BoundaryErrors (with the particular
error classes generally being sub-classes of ValueError
or TypeError).
- __str__ = __repr__(self)
- Get a representation of this property object
- check(self, client, value)
- Use our basetype to check the coerced value's type
- checkBoundaries(self, value, client=None)
- Check given value against boundaries
- coerce(self, client, value)
- Attempt to convert the given value to an appropriate data type
Tries to use the baseType's coerce function,
failing that, calls the base type with the
value as the first positional parameter.
- getBaseType(self)
- Get our base-type object or None if not set
- getDataType(self)
- Get our data-type string
- getDefault(self, client)
- Get the default value of this property for the given client
This simply calls the Default object registered as self.default,
which, depending on whether defaultValue or defaultFunction was
specified during initialisation, will return a value or the
result of a function call. If neither was specified, an
AttributeError will be raised.
- getFactories(self)
- Attempt to determine the factory callables for this property
- getState(self, client)
- Helper for client.__getstate__, gets storable value for this property
- setState(self, client, value)
- Helper for client.__setstate__, sets storable value
Data and other attributes inherited from BasicProperty:
- boundaries = ()
- setDefaultOnGet = 1
- trueProperty = 1
Methods inherited from Propertied:
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01D4FE10>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
| |