Inherits from
- HasTraits: enthought.traits.has_traits.HasTraits
Attributes
- bind_event
This event is fired whenever a scriptable object is bound or unbound. It is intended to be used by an interactive Python shell to give the advanced user access to the scriptable objects. If an object is created via a factory then the event is fired when the factory is called, and not when the factory is bound.
bind_event = Event(IBindEvent)
- recording
This is set if user actions are being recorded as a script. It is maintained by the script manager.
recording = Bool(False)
- script
This is the text of the script currently being recorded (or the last recorded script if none is currently being recorded). It is updated automatically as the user performs actions.
script = Property(Unicode)
- script_updated
This event is fired when the recorded script changes. The value of the event will be the ScriptManager instance.
script_updated = Event(IScriptManager)
Inherited from base classes
Method summary
- arg_as_string(arg, so_needed)
- args_as_string_list(args, kwargs, so_needed = None)
- bind(self, obj, name = None, bind_policy = 'unique', api = None, includes = None, excludes = None)
- bind_factory(self, factory, name, bind_policy = 'unique', api = None, includes = None, excludes = None)
- new_object(self, obj, scripted_type, args = None, kwargs = None, name = None, bind_policy = 'auto')
- record_method(self, func, args, kwargs)
- record_trait_get(self, obj, name, result)
- record_trait_set(self, obj, name, value)
- run(self, script)
- run_file(self, file_name)
- start_recording(self)
- stop_recording(self)
Inherited from base classes
- __deepcopy__(self, memo)
- __getstate__(self)
- __prefix_trait__(self, name, is_set)
- __reduce_ex__(self, protocol)
- __setstate__(self, state, trait_change_notify = True)
- add_class_trait(cls, name, *trait)
- add_trait(self, name, *trait)
- add_trait_category(cls, category)
- add_trait_listener(self, object, prefix = '')
- all_trait_names(self)
- base_trait(self, name)
- class_default_traits_view(cls)
- class_editable_traits(cls)
- class_trait_names(cls, **metadata)
- class_trait_view(cls, name = None, view_element = None)
- class_trait_view_elements(cls)
- class_traits(cls, **metadata)
- clone_traits(self, traits = None, memo = None, copy = None, **metadata)
- configure_traits(self, filename = None, view = None, kind = None, edit = True, context = None, handler = None, id = '', scrollable = None, **args)
- copy_traits(self, other, traits = None, memo = None, copy = None, **metadata)
- copyable_trait_names(self, **metadata)
- default_traits_view(self)
- edit_traits(self, view = None, parent = None, kind = None, context = None, handler = None, id = '', scrollable = None, **args)
- editable_traits(self)
- has_traits_interface(self, *interfaces)
- on_trait_change(self, handler, name = None, remove = False, dispatch = 'same', priority = False, deferred = False)
- print_traits(self, show_help = False, **metadata)
- remove_trait(self, name)
- remove_trait_listener(self, object, prefix = '')
- reset_traits(self, traits = None, **metadata)
- set_trait_dispatch_handler(cls, name, klass, override = False)
- sync_trait(self, trait_name, object, alias = None, mutual = True, remove = False)
- trait(self, name, force = False, copy = False)
- trait_context(self)
- trait_get(self, *names, **metadata)
- trait_monitor(cls, handler, remove = False)
- trait_names(self, **metadata)
- trait_set(self, trait_change_notify = True, **traits)
- trait_setq(self, **traits)
- trait_subclasses(cls, all = False)
- trait_view(self, name = None, view_element = None)
- trait_view_elements(self)
- trait_views(self, klass = None)
- traits(self, **metadata)
- validate_trait(self, name, value)
Methods
- arg_as_string(arg, so_needed)
Return the string representation of an argument. Update the so_needed list if the argument refers to a scriptable object. Any delayed conversion exception is handled here.
- args_as_string_list(args, kwargs, so_needed = None)
Return a complete argument list from sets of positional and keyword arguments. Update the optional so_needed list for those arguments that refer to a scriptable object.
- bind(self, obj, name = None, bind_policy = 'unique', api = None, includes = None, excludes = None)
Bind obj to name and make (by default) its public methods and traits (ie. those not beginning with an underscore) scriptable. The default value of name is the type of obj with the first character forced to lower case. name may be a dotted name (eg. 'abc.def.xyz').
bind_policy determines what happens if the name is already bound. If the policy is 'auto' then a numerical suffix will be added to the name, if necessary, to make it unique. If the policy is 'unique' then an exception is raised. If the policy is 'rebind' then the previous binding is discarded. The default is 'unique'
If api is given then it is a class, or a list of classes, that define the attributes that will be made scriptable.
Otherwise if includes is given it is a list of names of attributes that will be made scriptable.
Otherwise all the public attributes of scripted_type will be made scriptable except those in the excludes list.
- bind_factory(self, factory, name, bind_policy = 'unique', api = None, includes = None, excludes = None)
Bind factory to name. This does the same as the bind() method except that it uses a factory that will be called later on to create the object only if the object is needed.
See the documentation for bind() for a description of the remaining arguments.
- new_object(self, obj, scripted_type, args = None, kwargs = None, name = None, bind_policy = 'auto')
Register a scriptable object and the arguments used to create it. If no arguments were provided then assume the object is being explicitly bound.
- record_method(self, func, args, kwargs)
Record the call of a method of a ScriptableObject instance and return the result. This is intended to be used only by the scriptable decorator.
- record_trait_get(self, obj, name, result)
Record the get of a trait of a scriptable object. This is intended to be used only by the Scriptable trait getter.
- record_trait_set(self, obj, name, value)
Record the set of a trait of a scriptable object. This is intended to be used only by the Scriptable trait getter.
- run(self, script)
Run the given script, either a string or a file-like object.
- run_file(self, file_name)
Run the given script file.
- start_recording(self)
Start the recording of user actions. The 'script' trait is cleared and all subsequent actions are added to 'script'. The 'recording' trait is updated appropriately.
- stop_recording(self)
Stop the recording of user actions. The 'recording' trait is updated appropriately.