ScriptableExtension Class Reference
from PyKDE4.kparts import *
Inherits: QObject
Namespace: KParts
Detailed Description
An extension class that permits KParts to be scripted (such as when embedded inside a KHTMLPart) and to access the host's scriptable objects as well.
See ScriptValueTypes for how values are passed to/from various methods here.
- Since:
- 4.5
Method Documentation
__init__ | ( | self, | ||
QObject | parent | |||
) |
Values are passed to and from scriptable methods or properties as QVariants. Valid values may be bools, strings, and numbers (doubles), as well as the following custom types:
acquire | ( | self, | ||
long | objid | |||
) |
increases reference count of object objId
QVariant callAsConstructor | ( | self, | ||
KParts.ScriptableExtension | callerPrincipal, | |||
long | objId, | |||
[QVariant] | args | |||
) |
Try to use the object objId associated with 'this' as a constructor (corresponding to ECMAScript's new foo(bar, baz, glarch) expression).
QVariant callAsFunction | ( | self, | ||
KParts.ScriptableExtension | callerPrincipal, | |||
long | objId, | |||
[QVariant] | args | |||
) |
Try to use the object objId associated with 'this' as a function.
QVariant callFunctionReference | ( | self, | ||
KParts.ScriptableExtension | callerPrincipal, | |||
long | objId, | |||
QString | f, | |||
[QVariant] | args | |||
) |
Try to use a function reference to field f of object @objId as a function
QVariant enclosingObject | ( | self ) |
Returns an object that represents the host()'s view of us. For example, if the host is an HTML part, it would return a DOM node of an <object> handled by this part. May be undefined or null
Implemented in terms of objectForKid
bool enumerateProperties | ( | self, | ||
KParts.ScriptableExtension | callerPrincipal, | |||
long | objId, | |||
QStringList | result | |||
) |
Tries to enumerate all fields of object objId associated with this to result. Returns true on success
QVariant evaluateScript | ( | self, | ||
KParts.ScriptableExtension | callerPrincipal, | |||
long | contextObjectId, | |||
QString | code, | |||
KParts.ScriptableExtension.ScriptLanguage | language=KParts.ScriptableExtension.ECMAScript | |||
) |
Tries to evaluate a script code with the given object as its context. The parameter language specifies the language to execute it as. Use isScriptLanguageSupported to check for support.
QVariant get | ( | self, | ||
KParts.ScriptableExtension | callerPrincipal, | |||
long | objId, | |||
QString | propName | |||
) |
Tries to get field propName from object objId associated with 'this'.
bool hasProperty | ( | self, | ||
KParts.ScriptableExtension | callerPrincipal, | |||
long | objId, | |||
QString | propName | |||
) |
Returns true if the object objId associated with 'this' has the property propName.
KParts.ScriptableExtension host | ( | self ) |
Returns any registered parent scripting context. May be 0 if setHost was not called (or not call yet).
bool isScriptLanguageSupported | ( | self, | ||
KParts.ScriptableExtension.ScriptLanguage | lang | |||
) |
returns true if this extension can execute scripts in the given language
bool put | ( | self, | ||
KParts.ScriptableExtension | callerPrincipal, | |||
long | objId, | |||
QString | propName, | |||
QVariant | value | |||
) |
Tries to set the field propName from object objId associated with 'this' to value. Returns true on success
release | ( | self, | ||
long | objid | |||
) |
decreases reference count of object objId
bool removeProperty | ( | self, | ||
KParts.ScriptableExtension | callerPrincipal, | |||
long | objId, | |||
QString | propName | |||
) |
Tries to remove the field d propName from object objId associated with 'this'. Returns true on success
QVariant rootObject | ( | self ) |
Return the root scriptable object of this KPart. For example for an HTML part, it would represent a Window object. May be undefined or null
bool setException | ( | self, | ||
KParts.ScriptableExtension | callerPrincipal, | |||
QString | message | |||
) |
Tries to raise an exception with given message in this extension's scripting context. Returns true on success
setHost | ( | self, | ||
KParts.ScriptableExtension | host | |||
) |
Reports the hosting ScriptableExtension to a child. It's the responsibility of a parent part to call this method on all of its kids' ScriptableExtensions as soon as possible.
Static Method Documentation
Helper that calls acquire on any object or function reference base stored in v.
- Returns:
- a copy of the passed in value
KParts.ScriptableExtension adapterFromLiveConnect | ( | QObject | parentObj, | |
KParts.LiveConnectExtension | oldApi | |||
) |
This returns a bridge object that permits KParts implementing the older LiveConnectExtension to be used via the ScriptableExtension API. The bridge's parent will be the parentObj.
KParts.ScriptableExtension childObject | ( | QObject | obj | |
) |
Queries obj for a child object which inherits from this ScriptableExtension class. Convenience method.
Helper that calls release on any object or function reference base stored in v.
- Returns:
- a copy of the passed in value
Enumeration Documentation
ScriptLanguage |
- Enumerator:
-
ECMAScript EnumLimit = 0xFFFF