Package pycocoa :: Module runtime :: Class ObjCInstance
[frames] | no frames]

Class ObjCInstance

          object --+        
                   |        
internals._Objectype --+    
                       |    
               _ObjCBase --+
                           |
                          ObjCInstance
Known Subclasses:

Python wrapper for an ObjC instance.

Instance Methods
 
__del__(self)
 
__getattr__(self, name)
Return a callable ObjC method or Python property with the given name.
 
__str__(self)
str(x)
 
retained(self, *retain)
Get/set this instance' cache retention (bool).
 
set_ivar(self, name, value, ctype=None)
Set an instance variable (ivar) to the given value.

Inherited from _ObjCBase: __repr__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Static Methods
a new object with type S, a subtype of T
__new__(cls, objc_ptr, cached=True)
New ObjCInstance or a previously created, cached one.
Properties
  from_py2NS
Get this instance' origin (bool).
  inPool
Get this instance' NSAutoreleasePool identifier (int or 0 iff global).
  objc_class
Get this instance' ObjC class (ObjCClass).
  objc_classname
Get this instance' ObjC class name (str).
  name
Get this instance' ObjC class name (str).
  objc_description
Get this instance' ObjC description (str).
  ptr
Get this instance' ObjC object (Id_t).
  Type
Get the Python Type for this instance' ObjC class (class).

Inherited from _ObjCBase: description

Inherited from internals._Objectype: typename

Inherited from object: __class__

Method Details

__new__(cls, objc_ptr, cached=True)
Static Method

 

New ObjCInstance or a previously created, cached one.

Parameters:
  • objc_ptr - The ObjC instance (Id_t or c_void_p).
  • cached - Cache the new instance (bool), required for most objects.
Returns: a new object with type S, a subtype of T
Raises:
Overrides: object.__new__

__getattr__(self, name)
(Qualification operator)

 

Return a callable ObjC method or Python property with the given name.

Parameters:
  • name - The method or property name (str).
Returns:
A bound class or instance method (ObjCBound[Class]Method) or this instance's Python property get function.
Raises:
  • AttributeError - No name method or property.
  • RuntimeError - This instance' ObjC object has been deallocated and no longer exists.

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

retained(self, *retain)

 

Get/set this instance' cache retention (bool).

Parameters:
  • retain - If True retain, if False do not retain this instance.
Returns:
The previous value (bool).

Note: Use sel/method retain, to retain this instance in NSAutoreleasePools.

set_ivar(self, name, value, ctype=None)

 

Set an instance variable (ivar) to the given value.

Parameters:
  • name - Name of the ivar (str).
  • value - Value for the ivar (any).
  • ctype - The type code of the ivar (ctypes).
Returns:
The ivar (Ivar_t).
Raises:
  • ArgumentError - Invalid name, value or ctype.
  • TypeError - Invalid name, value or ctype type.

Property Details

from_py2NS

Get this instance' origin (bool).

Get Method:
from_py2NS(self) - Get this instance' origin (bool).
Set Method:
Read_Only(inst, value) - Throws an AttributeError, always.

inPool

Get this instance' NSAutoreleasePool identifier (int or 0 iff global).

Get Method:
inPool(self) - Get this instance' NSAutoreleasePool identifier (int or 0 iff global).
Set Method:
Read_Only(inst, value) - Throws an AttributeError, always.

objc_class

Get this instance' ObjC class (ObjCClass).

Get Method:
objc_class(self) - Get this instance' ObjC class (ObjCClass).
Set Method:
Read_Only(inst, value) - Throws an AttributeError, always.

objc_classname

Get this instance' ObjC class name (str).

Get Method:
objc_classname(self) - Get this instance' ObjC class name (str).
Set Method:
Read_Only(inst, value) - Throws an AttributeError, always.

name

Get this instance' ObjC class name (str).

Get Method:
objc_classname(self) - Get this instance' ObjC class name (str).
Set Method:
Read_Only(inst, value) - Throws an AttributeError, always.

objc_description

Get this instance' ObjC description (str).

Get Method:
objc_description(self) - Get this instance' ObjC description (str).
Set Method:
Read_Only(inst, value) - Throws an AttributeError, always.

ptr

Get this instance' ObjC object (Id_t).

Get Method:
ptr(self) - Get this instance' ObjC object (Id_t).
Set Method:
Read_Only(inst, value) - Throws an AttributeError, always.

Type

Get the Python Type for this instance' ObjC class (class).

Get Method:
Type(self) - Get the Python Type for this instance' ObjC class (class).
Set Method:
Read_Only(inst, value) - Throws an AttributeError, always.