Page Contents

This Page

enaml.stdlib

The enaml.stdlib package contains the standard library built around the widgets and core functionnalities.

fields Module

The following fields all inherit from Field, and do the appropriate type of validation:

Enaml declared component enaml.stdlib.fields.IntField(derives from <class 'enaml.widgets.field.Field'>)

A field that only accept integer inputs.

Enaml declared component enaml.stdlib.fields.FloatField(derives from <class 'enaml.widgets.field.Field'>)

A Field that only accept floating point values.

Enaml declared component enaml.stdlib.fields.RegexField(derives from <class 'enaml.widgets.field.Field'>)

A Field that only accepts values validated by a given regular expression.

sessions Module

Enaml Standard Library - Sessions

This module contains some Session subclasses and associated utilities that handle common Session use cases.

class enaml.stdlib.sessions.SimpleSession(sess_callable, *args, **kwargs)[source]

Bases: enaml.session.Session

A concrete Session class that receives a callable, positional, and keyword arguments and creates the associated view(s).

__init__(sess_callable, *args, **kwargs)[source]

Initialize the session with the callable and arguments.

on_open()[source]

Create the view from the callable

__implements__

alias of __NoInterface__

enaml.stdlib.sessions.simple_session(sess_name, sess_descr, sess_callable, *args, **kwargs)[source]

Creates a SessionFactory instance for a callable.

This creates a SessionFactory instance which will create instances of SimpleSession when prompted by the application.

Parameters:
  • sess_name (str) – A unique, human-friendly name for the session.
  • sess_descr (str) – A brief description of the session.
  • sess_callable (callable) – A callable which will return an Enaml view or iterable of views.
*args, **kwargs
Optional positional and keyword arguments to pass to the callable when the session is created.
enaml.stdlib.sessions.view_factory(sess_name=None, sess_descr=None)[source]

A decorator that creates a session factory from a callable.

This can be used in the following ways:

@view_factory def view(...):

... return View(...)

@view_factory(‘my-views’, ‘This is several views’) def views(...):

... return [View1(...), View2(...)]

simple = view_factory(Main)

enaml.stdlib.sessions.show_simple_view(view, toolkit='qt', description='')[source]

Display a simple view to the screen in the local process.

Parameters:
  • view (Object) – The top level Object to use as the view.
  • toolkit (string, optional) – The toolkit backend to use to display the view. Currently supported values are ‘qt’ and ‘wx’. The default is ‘qt’. Note that not all functionality is available on Wx.
  • description (string, optional) – An optional description to give to the session.