enamlnative.core package¶
Submodules¶
enamlnative.core.api module¶
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on Apr 15, 2017
@author: jrm
enamlnative.core.app module¶
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
@author jrm
-
class
enamlnative.core.app.
Plugin
[source]¶ Bases:
atom.atom.Atom
Simplified way to load a plugin from an entry_point line. The enaml-native and p4a build process removes pkg_resources and all package related metadata this simply imports from an entry point string in the format “package.path.module:attr”
-
name
¶ A value of type unicode.
By default, plain strings will be promoted to unicode strings. Pass strict=True to the constructor to enable strict unicode checking.
-
source
¶ A value of type unicode.
By default, plain strings will be promoted to unicode strings. Pass strict=True to the constructor to enable strict unicode checking.
-
__atom_members__
= {'name': <atom.scalars.Unicode object at 0x7fb6a3ffb9b0>, 'source': <atom.scalars.Unicode object at 0x7fb6a3fb62d0>}¶
-
__module__
= 'enamlnative.core.app'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.app.
BridgedApplication
(*args, **kwargs)[source]¶ Bases:
enaml.application.Application
An abstract implementation of an Enaml application.
This serves as a base class for both Android and iOS applications and provides support for the python event loop, the development server and the bridge.
-
__id__
¶ A value of type int.
By default, ints are strictly typed. Pass strict=False to the constructor to enable int casting for longs and floats.
-
keep_screen_on
¶ Keep screen on by setting the WindowManager flag
-
state
¶ Application lifecycle state must be set by the implementation
-
view
¶ View to display within the activity
-
load_view
¶ Factory to create and show the view. It takes the app as the first arg
-
debug
¶ If true, debug bridge statements
-
dev
¶ Use dev server
-
loop
¶ Event loop
-
plugins
¶ Entry points to load plugins
-
__init__
(*args, **kwargs)[source]¶ Initialize the event loop error handler. Subclasses must properly initialize the proxy resolver.
-
deferred_call
(callback, *args, **kwargs)[source]¶ Invoke a callable on the next cycle of the main event loop thread.
Parameters:
-
timed_call
(ms, callback, *args, **kwargs)[source]¶ Invoke a callable on the main event loop thread at a specified time in the future.
Parameters:
-
is_main_thread
()[source]¶ Indicates whether the caller is on the main gui thread.
Returns: result – True if called from the main gui thread. False otherwise. Return type: bool
-
request_permissions
(permissions)[source]¶ Return a future that resolves with the result of the permission request
-
add_done_callback
(future, callback)[source]¶ Add a callback on a future object put here so it can be implemented with different event loops.
Parameters:
-
send_event
(name, *args, **kwargs)[source]¶ Send an event to the native handler. This call is queued and batched.
Parameters:
-
handle_event
(event)[source]¶ When we get an ‘event’ type from the bridge handle it by invoking the handler and if needed sending back the result.
-
handle_error
(callback)[source]¶ Called when an error occurs in an event loop callback. By default, sets the error view.
-
on_events
(data)[source]¶ Called when the bridge sends an event. For instance the return result of a method call or a callback from a widget event.
-
start_dev_session
()[source]¶ Start a client that attempts to connect to the dev server running on the host app.dev
-
get_plugins
(group)[source]¶ Was going to use entry points but that requires a ton of stuff which will be extremely slow.
-
load_plugin_widgets
()[source]¶ Pull widgets added via plugins using the enaml_native_widgets entry point. The entry point function must return a dictionary of Widget declarations to add to the core api.
- def install():
from charts.widgets.chart_view import BarChart, LineChart return {
‘BarChart’: BarChart, ‘LineCart’: LineChart,}
-
load_plugin_factories
()[source]¶ Pull widgets added via plugins using the enaml_native_ios_factories or enaml_native_android_factories entry points. The entry point function must return a dictionary of Widget declarations to add to the factories for this platform.
- def install():
- return {
- ‘MyWidget’:my_widget_factory, # etc…
}
-
__atom_members__
= {'__id__': <atom.scalars.Int object at 0x7fb6a3fb6370>, '_bridge_last_scheduled': <atom.scalars.Float object at 0x7fb6a3fb69b0>, '_bridge_max_delay': <atom.scalars.Float object at 0x7fb6a3fb6910>, '_bridge_queue': <atom.list.List object at 0x7fb6a411eec0>, '_counter': <atom.scalars.Value object at 0x7fb6a4061730>, '_dev_session': <atom.scalars.Value object at 0x7fb6a3fb67d0>, '_heap_lock': <atom.scalars.Value object at 0x7fb6a40617d0>, '_task_heap': <atom.list.List object at 0x7fb6a4431ad0>, 'debug': <atom.scalars.Bool object at 0x7fb6a3fb6690>, 'dev': <atom.scalars.Unicode object at 0x7fb6a3fb6730>, 'keep_screen_on': <atom.scalars.Bool object at 0x7fb6a3fb6410>, 'load_view': <atom.scalars.Callable object at 0x7fb6a3fb65f0>, 'loop': <atom.instance.Instance object at 0x7fb6a3fb6870>, 'plugins': <atom.dict.Dict object at 0x7fb6a3fb6a50>, 'resolver': <atom.typed.Typed object at 0x7fb6a4061690>, 'state': <atom.enum.Enum object at 0x7fb6a3fb64b0>, 'style_sheet': <atom.typed.ForwardTyped object at 0x7fb6a444d8f0>, 'view': <atom.scalars.Value object at 0x7fb6a3fb6550>}¶
-
__module__
= 'enamlnative.core.app'¶
-
__slots__
= ()¶
-
enamlnative.core.block module¶
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on Apr 15, 2017
@author: jrm
-
class
enamlnative.core.block.
Block
(parent=None, **kwargs)[source]¶ Bases:
enaml.core.declarative.Declarative
An object which dynamically insert’s its children into another block’s parent object.
The ‘Block’ object is used to cleanly and easily insert it’s children into the children of another object. The ‘Object’ instance assigned to the ‘block’ property of the ‘Block’ will be parented with the parent of the ‘Block’. Creating a ‘Block’ with no parent is a programming error.
-
block
¶ The Block to which this blocks children should be inserted into
-
mode
¶ If replace, replace all parent’s children (except the block of course)
-
initialize
()[source]¶ A reimplemented initializer.
This method will add the include objects to the parent of the include and ensure that they are initialized.
-
__atom_members__
= {'_children': <atom.list.List object at 0x7fb6a3785ec0>, '_d_engine': <atom.typed.Typed object at 0x7fb6a44900f0>, '_d_storage': <atom.typed.Typed object at 0x7fb6a4490230>, '_flags': <atom.scalars.Value object at 0x7fb6a4490c30>, '_parent': <atom.scalars.Value object at 0x7fb6a444a190>, 'block': <atom.instance.ForwardInstance object at 0x7fb6a3724558>, 'destroyed': <atom.event.Event object at 0x7fb6a444a410>, 'initialized': <atom.event.Event object at 0x7fb6a44904b0>, 'mode': <atom.enum.Enum object at 0x7fb6a372cd70>, 'name': <atom.scalars.Unicode object at 0x7fb6a44905f0>}¶
-
__module__
= 'enamlnative.core.block'¶
-
__slots__
= ()¶
-
enamlnative.core.bridge module¶
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on June 21, 2017
@author: jrm
-
class
enamlnative.core.bridge.
Command
[source]¶ -
CREATE
= 'c'¶
-
PROXY
= 'p'¶
-
METHOD
= 'm'¶
-
STATIC_METHOD
= 'sm'¶
-
FIELD
= 'f'¶
-
DELETE
= 'd'¶
-
RESULT
= 'r'¶
-
ERROR
= 'e'¶
-
DEF
= 'def'¶
-
__module__
= 'enamlnative.core.bridge'¶
-
-
class
enamlnative.core.bridge.
ExtType
[source]¶ -
REF
= 1¶
-
PROXY
= 2¶
-
__module__
= 'enamlnative.core.bridge'¶
-
-
enamlnative.core.bridge.
get_object_with_id
(id)[source]¶ Get the object with the given id in the cache
-
enamlnative.core.bridge.
get_app_class
()[source]¶ Avoid circular import. Probably indicates a poor design…
-
enamlnative.core.bridge.
msgpack_encoder
(sig, obj)[source]¶ When passing a BridgeObject encode it in a special way so it can properly be interpreted as a reference.
TODO: This should use the object hooks for doing this automatically
-
exception
enamlnative.core.bridge.
BridgeReferenceError
[source]¶ Bases:
exceptions.ReferenceError
-
__module__
= 'enamlnative.core.bridge'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
enamlnative.core.bridge.
get_handler
(ptr, method)[source]¶ Dereference the pointer and return the handler method.
-
class
enamlnative.core.bridge.
BridgeMethod
(*args, **kwargs)[source]¶ Bases:
atom.property.Property
A method that is callable via the bridge. When called, this serializes the call, packs the arguments, and delegates handling to a bridge in native code.
#: Define it class View(BridgeObject):
addView = BridgeMethod(‘android.view.View’)#: Create instance view = View() view2 = View()
#: Use it view.addView(view2)
-
__slots__
= ('__signature__', '__returns__', '__cache__', '__bridge_id__')¶
-
__returns__
¶
-
__signature__
¶
-
__cache__
¶
-
__bridge_id__
¶
-
pack_args
(obj, *args, **kwargs)[source]¶ Subclasses should implement this to pack args as needed for the native bridge implementation. Must return a tuple containing (“methodName”, [list, of, encoded, args])
-
__module__
= 'enamlnative.core.bridge'¶
-
-
class
enamlnative.core.bridge.
BridgeStaticMethod
(*args, **kwargs)[source]¶ Bases:
atom.property.Property
A method that is callable via the bridge. When called, this serializes the call, packs the arguments, and delegates handling to a bridge in native code.
#: Define it class Toast(BridgeObject):
makeToast = BridgeStaticMethod(*args)#: Use result = Toast.makeToast(*args)
-
__slots__
= ('__signature__', '__returns__', '__cache__', '__owner__', '__bridge_id__')¶
-
__returns__
¶
-
__signature__
¶
-
__owner__
¶
-
__cache__
¶
-
__bridge_id__
¶
-
pack_args
(obj, *args, **kwargs)[source]¶ Subclasses should implement this to pack args as needed for the native bridge implementation. Must return a tuple containing (“methodName”, [list, of, encoded, args])
-
__module__
= 'enamlnative.core.bridge'¶
-
-
class
enamlnative.core.bridge.
BridgeField
(arg)[source]¶ Bases:
atom.property.Property
Allows you to set fields or properties over the bridge using normal python syntax.
#: Define it class View(BridgeObject):
width = BridgeField(‘int’)#: Create instance view = View()
#: Set field view.width = 200
-
__slots__
= ('__signature__', '__bridge_id__', '__bridge_cached_')¶
-
__signature__
¶
-
__bridge_id__
¶
-
__module__
= 'enamlnative.core.bridge'¶
-
-
class
enamlnative.core.bridge.
BridgeCallback
(*args, **kwargs)[source]¶ Bases:
enamlnative.core.bridge.BridgeMethod
Description of a callback method of a View (or subclass) in Objc or Java. When called,it fires the connected callback. If no callback is connected it will try to lookup a default callback implementation matching the name _impl_<name>. If that does not exist, it will simply do nothing.
This is triggered when it receives an event from the bridge indicating the call has occurred.
#: Define it class View(BridgeObject):
onClick = BridgeCallback()#: Create instance view = View()
- def on_click():
- print(“Clicked!”)
#: Connect to callback view.onClick.connect(on_click)
You can define a “default” callback implementation by implementing the method with name of _impl_<name>. Connecting a callback will override this behavior.
#: Define it class LocationManager(BridgeObject):
hashCode = BridgeCallback()
- def _impl_hashCode(self):
- return self.__id__
-
__dict__
= dict_proxy({'__dict__': <attribute '__dict__' of 'BridgeCallback' objects>, '__module__': 'enamlnative.core.bridge', 'disconnect': <function disconnect>, 'connect': <function connect>, '__call__': <function __call__>, '__weakref__': <attribute '__weakref__' of 'BridgeCallback' objects>, '__doc__': ' Description of a callback method of a View (or subclass) in \n Objc or Java. When called,it fires the connected callback. If no callback \n is connected it will try to lookup a default callback implementation \n matching the name `_impl_<name>`. If that does not exist, it will simply \n do nothing.\n\n This is triggered when it receives an event from the bridge indicating the \n call has occurred.\n\n\n #: Define it\n class View(BridgeObject):\n onClick = BridgeCallback()\n\n #: Create instance\n view = View()\n\n def on_click():\n print("Clicked!")\n\n #: Connect to callback\n view.onClick.connect(on_click)\n\n\n You can define a "default" callback implementation by implementing the \n method with name of `_impl_<name>`. Connecting a callback will override \n this behavior.\n\n #: Define it\n class LocationManager(BridgeObject):\n hashCode = BridgeCallback()\n\n def _impl_hashCode(self):\n return self.__id__\n\n ', '__fget__': <function __fget__>})¶
-
__module__
= 'enamlnative.core.bridge'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
class
enamlnative.core.bridge.
BridgeObject
(*args, **kwargs)[source]¶ Bases:
atom.atom.Atom
A proxy to a class in java. This sends the commands over the bridge for execution. The object is stored in a map with the given id and is valid until this object is deleted.
Parameters: __id__ (Int, Future, or None) – If an __id__ keyword argument is passed during creation, then
If the __id__ is an int, this will assume the object was already created and only a reference to the object with the given id is needed.If the __id__ is a Future (as specified by the app event loop), then the __id__ of he future will be used. When the future completes this object will then be put into the cache. This allows passing results directly instead of using the .then() method.
-
__slots__
= ('__weakref__',)¶
-
__nativeclass__
¶ Native Class name
-
__signature__
¶ Constructor signature
-
__suppressed__
¶ Suppressed methods / fields
-
__callbacks__
¶ Callbacks
-
__id__
¶ Bridge object ID
-
__bridge_id__
¶ ID of this class
-
__prefix__
¶ Prefix to add to all names used during method and property calls used for nested objects
-
__app__
¶ Bridge
-
__del__
()[source]¶ Destroy this object and send a command to destroy the actual object reference the bridge implementation holds (allowing it to be released).
-
__atom_members__
= {'__app__': <atom.instance.ForwardInstance object at 0x7fb6a4103f68>, '__bridge_id__': <atom.scalars.Int object at 0x7fb6a3ffb2d0>, '__callbacks__': <atom.dict.Dict object at 0x7fb6a3ffb4b0>, '__id__': <atom.scalars.Int object at 0x7fb6a3ffb730>, '__nativeclass__': <atom.scalars.Unicode object at 0x7fb6a3ffb370>, '__prefix__': <atom.scalars.Unicode object at 0x7fb6a3ffb5f0>, '__signature__': <atom.tuple.Tuple object at 0x7fb6a3ffb550>, '__suppressed__': <atom.dict.Dict object at 0x7fb6a3ffb410>}¶
-
__module__
= 'enamlnative.core.bridge'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
class
enamlnative.core.bridge.
NestedBridgeObject
(root, attr, **kwargs)[source]¶ Bases:
enamlnative.core.bridge.BridgeObject
A nested object allows you to invoke methods and set properties of an object that is a property of another object using the dot notation.
Useful for setting nested properties without needing to first create a reference bridge object (thus saving the time waiting for the bridge to reply) for example:
- UIView view = [UIView new];
- view.yoga.width = YES;
Would require to create a reference to the “yoga” object first but instead we just add our nested object’s prefix and let the bridge resolve the actual property. It works like a regular BridgeObject but appends the “name’.
This object is NOT in the cache on either side of the bridge.
-
__root__
¶ Reference to the object this is referenced under
-
__del__
()[source]¶ Destroy this object and send a command to destroy the actual object reference the bridge implementation holds (allowing it to be released).
-
__atom_members__
= {'__app__': <atom.instance.ForwardInstance object at 0x7fb6a4103f68>, '__bridge_id__': <atom.scalars.Int object at 0x7fb6a3ffb2d0>, '__callbacks__': <atom.dict.Dict object at 0x7fb6a3ffb4b0>, '__id__': <atom.scalars.Int object at 0x7fb6a3ffb730>, '__nativeclass__': <atom.scalars.Unicode object at 0x7fb6a3ffb370>, '__prefix__': <atom.scalars.Unicode object at 0x7fb6a3ffb5f0>, '__root__': <atom.instance.Instance object at 0x7fb6a3ffb690>, '__signature__': <atom.tuple.Tuple object at 0x7fb6a3ffb550>, '__suppressed__': <atom.dict.Dict object at 0x7fb6a3ffb410>}¶
-
__module__
= 'enamlnative.core.bridge'¶
-
__slots__
= ()¶
enamlnative.core.dev module¶
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
@author jrm
-
enamlnative.core.dev.
COMPONENT_FIELD_TMPL
= '\n\n'¶ This is why enaml-web is awesome, doing this sucks!
-
class
enamlnative.core.dev.
DevClient
[source]¶ Bases:
atom.atom.Atom
Abstract dev client. Override start to implement
-
connection
¶ Current websocket connection
-
mode
¶ Mode of operation
-
__atom_members__
= {'connection': <atom.instance.Instance object at 0x7fb69006e5f0>, 'mode': <atom.enum.Enum object at 0x7fb69006e690>}¶
-
__module__
= 'enamlnative.core.dev'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.dev.
TornadoDevClient
[source]¶ Bases:
enamlnative.core.dev.DevClient
-
__atom_members__
= {'connection': <atom.instance.Instance object at 0x7fb69006e5f0>, 'mode': <atom.enum.Enum object at 0x7fb69006e690>}¶
-
__module__
= 'enamlnative.core.dev'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.dev.
TwistedDevClient
[source]¶ Bases:
enamlnative.core.dev.DevClient
-
__atom_members__
= {'connection': <atom.instance.Instance object at 0x7fb69006e5f0>, 'mode': <atom.enum.Enum object at 0x7fb69006e690>}¶
-
__module__
= 'enamlnative.core.dev'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.dev.
DevServer
[source]¶ Bases:
atom.atom.Atom
Abstract dev server. Override start to implement
-
render_code
()[source]¶ Try to load the previous code (if we had a crash or something) I should allow saving.
-
__atom_members__
= {}¶
-
__module__
= 'enamlnative.core.dev'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.dev.
TornadoDevServer
[source]¶ Bases:
enamlnative.core.dev.DevServer
-
__atom_members__
= {}¶
-
__module__
= 'enamlnative.core.dev'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.dev.
TwistedDevServer
[source]¶ Bases:
enamlnative.core.dev.DevServer
-
__atom_members__
= {}¶
-
__module__
= 'enamlnative.core.dev'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.dev.
DevServerSession
(*args, **kwargs)[source]¶ Bases:
atom.atom.Atom
Connect to a dev server running on the LAN or if host is 0.0.0.0 server a page to let code be pasted in. Note this should NEVER be used in a released app!
-
app
¶ Reference to the current Application
-
host
¶ Host to connect to (in client mode) or if set to “server” it will enable “server” mode
-
port
¶ Port to serve on (in server mode) or port to connect to (in client mode)
-
url
¶ URL to connect to (in client mode)
-
connected
¶ Websocket connection state
-
buf
¶ Message buffer
-
mode
¶ Dev session mode
-
hotswap
¶ Hotswap support class
-
servers
¶ Delegate dev server
-
server
¶ A value which allows objects of a given type or types.
Values will be tested using the PyObject_IsInstance C API call. This call is equivalent to isinstance(value, kind) and all the same rules apply.
The value of an Instance may be set to None.
-
clients
¶ Delegate dev client
-
client
¶ A value which allows objects of a given type or types.
Values will be tested using the PyObject_IsInstance C API call. This call is equivalent to isinstance(value, kind) and all the same rules apply.
The value of an Instance may be set to None.
-
__init__
(*args, **kwargs)[source]¶ Overridden constructor that forces only one instance to ever exist.
-
__atom_members__
= {'app': <atom.instance.ForwardInstance object at 0x7fb6a37246c8>, 'buf': <atom.scalars.Unicode object at 0x7fb69006e9b0>, 'client': <atom.instance.Instance object at 0x7fb69006ed70>, 'clients': <atom.list.List object at 0x7fb69007b248>, 'connected': <atom.scalars.Bool object at 0x7fb69006e910>, 'host': <atom.scalars.Unicode object at 0x7fb69006e730>, 'hotswap': <atom.instance.Instance object at 0x7fb69006eaf0>, 'mode': <atom.enum.Enum object at 0x7fb69006ea50>, 'port': <atom.scalars.Int object at 0x7fb69006e7d0>, 'server': <atom.instance.Instance object at 0x7fb69006ec30>, 'servers': <atom.list.List object at 0x7fb69007b1a0>, 'url': <atom.scalars.Unicode object at 0x7fb69006e870>}¶
-
__module__
= 'enamlnative.core.dev'¶
-
__slots__
= ()¶
-
enamlnative.core.http module¶
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
@author jrm
-
exception
enamlnative.core.http.
HttpError
(code, message=None, response=None)[source]¶ Bases:
exceptions.Exception
-
__init__
(code, message=None, response=None)[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
__module__
= 'enamlnative.core.http'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
class
enamlnative.core.http.
HttpRequest
(*args, **kwargs)[source]¶ Bases:
atom.atom.Atom
The request object created for fetch calls. It’s based on the design of Tornado’s HttpRequest.
-
url
¶ Request url
-
method
¶ Request method
-
headers
¶ Request headers
-
retries
¶ Retry count
-
data
¶ Request parameter data
-
content_type
¶ Content type
-
body
¶ Raw request body
-
callback
¶ Called when complete
-
streaming_callback
¶ Streaming callback
-
start_time
¶ Start time
-
response
¶ Response created
-
__atom_members__
= {'body': <atom.scalars.Unicode object at 0x7fb6a336c0f0>, 'callback': <atom.scalars.Callable object at 0x7fb6a336c190>, 'content_type': <atom.scalars.Unicode object at 0x7fb6a336c050>, 'data': <atom.dict.Dict object at 0x7fb6a361ff50>, 'headers': <atom.dict.Dict object at 0x7fb6a361fe10>, 'method': <atom.scalars.Unicode object at 0x7fb6a361fd70>, 'response': <atom.instance.ForwardInstance object at 0x7fb6a36153e8>, 'retries': <atom.scalars.Int object at 0x7fb6a361feb0>, 'start_time': <atom.scalars.Float object at 0x7fb6a336c2d0>, 'streaming_callback': <atom.scalars.Callable object at 0x7fb6a336c230>, 'url': <atom.scalars.Unicode object at 0x7fb6a361fcd0>}¶
-
__module__
= 'enamlnative.core.http'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.http.
HttpResponse
[source]¶ Bases:
atom.atom.Atom
The response object returned to an AsyncHttpClient fetch callback. It is based on the the tornado HttpResponse object.
-
request
¶ Request that created this response
-
code
¶ Numeric HTTP status code
-
reason
¶ Reason phrase for the status code
-
headers
¶ Response headers list of strings
-
ok
¶ Result success
-
body
¶ Response body Note: if a streaming_callback is given to the request then this is NOT used and will be empty
-
content_length
¶ Size
-
error
¶ Error message
-
progress
¶ Progress
-
request_time
¶ Done time
-
__atom_members__
= {'body': <atom.scalars.Unicode object at 0x7fb6a336c690>, 'code': <atom.scalars.Int object at 0x7fb6a336c410>, 'content_length': <atom.scalars.Int object at 0x7fb6a336c730>, 'error': <atom.instance.Instance object at 0x7fb6a336c7d0>, 'headers': <atom.dict.Dict object at 0x7fb6a336c550>, 'ok': <atom.scalars.Bool object at 0x7fb6a336c5f0>, 'progress': <atom.scalars.Int object at 0x7fb6a336c870>, 'reason': <atom.scalars.Unicode object at 0x7fb6a336c4b0>, 'request': <atom.instance.Instance object at 0x7fb6a336c370>, 'request_time': <atom.scalars.Float object at 0x7fb6a336c910>}¶
-
__module__
= 'enamlnative.core.http'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.http.
AbstractAsyncHttpClient
[source]¶ Bases:
atom.atom.Atom
An AsyncHttpClient that lets you fetch using a format similar to tornado’s AsyncHTTPClient but using a native library.
This is done instead of using a python library so it handles all SSL stuff for us. Otherwise we have to compile and link all the SSL libraries with python which makes the app huge (at least 5Mb in ssl libs alone) and the build process even more complicated.
-
request_factory
¶ Factory used to build the request
-
requests
¶ Pending requests
-
fetch
(url, callback=None, raise_error=True, **kwargs)[source]¶ Fetch the given url and fire the callback when ready. Optionally pass a streaming_callback to handle data from large requests.
Parameters: Returns: result – A future that resolves with the HttpResponse object when the request is complete.
Return type:
-
__atom_members__
= {'request_factory': <atom.subclass.Subclass object at 0x7fb6a336c9b0>, 'requests': <atom.list.List object at 0x7fb6a3785440>}¶
-
__module__
= 'enamlnative.core.http'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.http.
AbstractWebsocketClient
[source]¶ Bases:
atom.atom.Atom
An AsyncWebsocketClient that lets you handle WSS using a native library implementation.
This is done instead of using a python library so it handles all SSL stuff for us. Otherwise we have to compile and link all the SSL libraries with python which makes the app huge (at least 5Mb in ssl libs alone) and the build process even more complicated.
-
classmethod
connect
(url)[source]¶ Start a connection and return an instance
Parameters: url (string) – The url to connect to. Returns: result – A future that resolves with the AsyncWebsocketClient connection instance when the connection succeeds or fails. Return type: Future : AsyncWebsocketClient
-
__atom_members__
= {}¶
-
__module__
= 'enamlnative.core.http'¶
-
__slots__
= ()¶
-
classmethod
enamlnative.core.import_hooks module¶
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on July 10, 2017
@author: jrm
-
class
enamlnative.core.import_hooks.
ExtensionImporter
[source]¶ Bases:
object
Loads renamed extensions files from the app’s lib folder
-
extension_modules
= {}¶
-
find_module
(mod, path=None)[source]¶ Use this as the loader if the desired module is an extension within the given library folder.
-
__dict__
= dict_proxy({'load_module': <function load_module>, 'extension_modules': {}, '__module__': 'enamlnative.core.import_hooks', 'find_module': <function find_module>, '__dict__': <attribute '__dict__' of 'ExtensionImporter' objects>, '__weakref__': <attribute '__weakref__' of 'ExtensionImporter' objects>, '__doc__': " Loads renamed extensions files from the app's lib folder", '__init__': <function __init__>})¶
-
__module__
= 'enamlnative.core.import_hooks'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
enamlnative.core.loop module¶
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
@author jrm
-
class
enamlnative.core.loop.
EventLoop
[source]¶ Bases:
atom.atom.Atom
Event loop delegation api
-
name
¶ So users can check if needed
-
loop
¶ Actual event loop object
-
future
¶ Future implementation for type checks
-
classmethod
default
()[source]¶ Get the first available event loop implementation based on which packages are installed.
-
classmethod
available
()[source]¶ Test if the event loop implementation is available.
Returns: bool Return type: The event loop can be used.
-
deferred_call
(callback, *args, **kwargs)[source]¶ Schedule the given callback to be invoked at the next available time.
-
timed_call
(ms, callback, *args, **kwargs)[source]¶ Schedule the given callback to be invoked at a time ms later.
-
create_future
()[source]¶ Create a future instance for this event loop.
Adds a “javascript fetch” like api with “then” and “catch”.
The object returned MUST have a method named then that takes a callback that should be invoked when the future is complete and returns the future object.
And the object returned MUST have a method named catch that takes a callback that should be invoked if the future contains an exception and returns the future object.
Likewise the future must be tagged with an id using bridge.tag_object_with_id(obj) so it can be resolved by the bridge.
-
add_done_callback
(future, callback)[source]¶ Add a callback will be triggered when the callback completes.
-
set_future_result
(future, result)[source]¶ Set the result of a Future to trigger any attached callbacks.
-
log_error
(callback, error=None)[source]¶ Log the error that occurred when running the given callback.
-
__atom_members__
= {'_handler': <atom.scalars.Callable object at 0x7fb6a3ffbb90>, 'future': <atom.scalars.Value object at 0x7fb6a3ffbc30>, 'loop': <atom.scalars.Value object at 0x7fb6a3ffbaf0>, 'name': <atom.scalars.Unicode object at 0x7fb6a3ffba50>}¶
-
__module__
= 'enamlnative.core.loop'¶
-
__slots__
= ()¶
-
-
class
enamlnative.core.loop.
TornadoEventLoop
[source]¶ Bases:
enamlnative.core.loop.EventLoop
Eventloop using tornado’s ioloop
-
base_future
¶ A member class which supports value initialization.
A plain Value provides support for default values and factories, but does not perform any type checking or validation. It serves as a useful base class for scalar members and can be used for cases where type checking is not needed (like private attributes).
-
classmethod
available
()[source]¶ Test if the event loop implementation is available.
Returns: bool Return type: The event loop can be used.
-
deferred_call
(callback, *args, **kwargs)[source]¶ Schedule the given callback to be invoked at the next available time.
-
timed_call
(ms, callback, *args, **kwargs)[source]¶ Schedule the given callback to be invoked at a time ms later.
-
__atom_members__
= {'_handler': <atom.scalars.Callable object at 0x7fb6a3ffbb90>, 'base_future': <atom.scalars.Value object at 0x7fb6a3ffbcd0>, 'future': <atom.scalars.Value object at 0x7fb6a3ffb7d0>, 'loop': <atom.scalars.Value object at 0x7fb6a3ffbeb0>, 'name': <atom.scalars.Unicode object at 0x7fb6a3ffbd70>}¶
-
__module__
= 'enamlnative.core.loop'¶
-
__slots__
= ()¶
-
future
¶ A member class which supports value initialization.
A plain Value provides support for default values and factories, but does not perform any type checking or validation. It serves as a useful base class for scalar members and can be used for cases where type checking is not needed (like private attributes).
-
loop
¶ A member class which supports value initialization.
A plain Value provides support for default values and factories, but does not perform any type checking or validation. It serves as a useful base class for scalar members and can be used for cases where type checking is not needed (like private attributes).
-
name
¶ A value of type unicode.
By default, plain strings will be promoted to unicode strings. Pass strict=True to the constructor to enable strict unicode checking.
-
-
class
enamlnative.core.loop.
TwistedEventLoop
[source]¶ Bases:
enamlnative.core.loop.EventLoop
Eventloop using twisted’s reactor
-
classmethod
available
()[source]¶ Test if the event loop implementation is available.
Returns: bool Return type: The event loop can be used.
-
deferred_call
(callback, *args, **kwargs)[source]¶ We have to wake up the reactor after every call because it may calculate a long delay where it can sleep which causes events that happen during this period to seem really slow as they do not get processed until after the reactor “wakes up”
-
timed_call
(ms, callback, *args, **kwargs)[source]¶ We have to wake up the reactor after every call because it may calculate a long delay where it can sleep which causes events that happen during this period to seem really slow as they do not get processed until after the reactor “wakes up”
-
__atom_members__
= {'_handler': <atom.scalars.Callable object at 0x7fb6a3ffbb90>, 'future': <atom.scalars.Value object at 0x7fb6a3fb60f0>, 'loop': <atom.scalars.Value object at 0x7fb6a3fb6050>, 'name': <atom.scalars.Unicode object at 0x7fb6a3ffbf50>}¶
-
__module__
= 'enamlnative.core.loop'¶
-
__slots__
= ()¶
-
future
¶ A member class which supports value initialization.
A plain Value provides support for default values and factories, but does not perform any type checking or validation. It serves as a useful base class for scalar members and can be used for cases where type checking is not needed (like private attributes).
-
loop
¶ A member class which supports value initialization.
A plain Value provides support for default values and factories, but does not perform any type checking or validation. It serves as a useful base class for scalar members and can be used for cases where type checking is not needed (like private attributes).
-
name
¶ A value of type unicode.
By default, plain strings will be promoted to unicode strings. Pass strict=True to the constructor to enable strict unicode checking.
-
classmethod
-
class
enamlnative.core.loop.
BuiltinEventLoop
[source]¶ Bases:
enamlnative.core.loop.TornadoEventLoop
Use the built in event loop. It’s a stripped down version of tornado, It’s currently slightly slower than tornado at the moment so use tornado if possible.
-
classmethod
available
()[source]¶ Test if the event loop implementation is available.
Returns: bool Return type: The event loop can be used.
-
log_error
(callback, error=None)[source]¶ Log the error that occurred when running the given callback.
-
__atom_members__
= {'_handler': <atom.scalars.Callable object at 0x7fb6a3ffbb90>, 'base_future': <atom.scalars.Value object at 0x7fb6a3fb6230>, 'future': <atom.scalars.Value object at 0x7fb6a3ffb7d0>, 'loop': <atom.scalars.Value object at 0x7fb6a3fb6190>, 'name': <atom.scalars.Unicode object at 0x7fb6a3ffbd70>}¶
-
__module__
= 'enamlnative.core.loop'¶
-
__slots__
= ()¶
-
base_future
¶ A member class which supports value initialization.
A plain Value provides support for default values and factories, but does not perform any type checking or validation. It serves as a useful base class for scalar members and can be used for cases where type checking is not needed (like private attributes).
-
loop
¶ A member class which supports value initialization.
A plain Value provides support for default values and factories, but does not perform any type checking or validation. It serves as a useful base class for scalar members and can be used for cases where type checking is not needed (like private attributes).
-
classmethod
enamlnative.core.remotehooks module¶
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on Dec 11, 2017
@author jrm