The template-class¶
In [2]:
Copied!
import evince as ev
import evince as ev
In [2]:
Copied!
ev.Template()
ev.Template()
Out[2]:
In [3]:
Copied!
# View above should display a dark blue background with a black sphere in the center.
# View above should display a dark blue background with a black sphere in the center.
In [3]:
Copied!
help(ev.Template)
help(ev.Template)
Help on class Template in module evince.template: class Template(ipywidgets.widgets.domwidget.DOMWidget) | Template(*args: Any, **kwargs: Any) -> Any | | A template widget for Evince. | | Method resolution order: | Template | ipywidgets.widgets.domwidget.DOMWidget | ipywidgets.widgets.widget.Widget | ipywidgets.widgets.widget.LoggingHasTraits | traitlets.traitlets.HasTraits | traitlets.traitlets.HasDescriptors | builtins.object | | Data descriptors defined here: | | value | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {} | | ---------------------------------------------------------------------- | Methods inherited from ipywidgets.widgets.domwidget.DOMWidget: | | add_class(self, className) | Adds a class to the top level element of the widget. | | Doesn't add the class if it already exists. | | blur(self) | Blur the widget. | | focus(self) | Focus on the widget. | | remove_class(self, className) | Removes a class from the top level element of the widget. | | Doesn't remove the class if it doesn't exist. | | ---------------------------------------------------------------------- | Data descriptors inherited from ipywidgets.widgets.domwidget.DOMWidget: | | layout | | tabbable | | tooltip | | ---------------------------------------------------------------------- | Methods inherited from ipywidgets.widgets.widget.Widget: | | __del__(self) | Object disposal | | __init__(self, **kwargs) | Public constructor | | __repr__(self) | Return repr(self). | | add_traits(self, **traits) | Dynamically add trait attributes to the Widget. | | close(self) | Close method. | | Closes the underlying comm. | When the comm is closed, all of the widget views are automatically | removed from the front-end. | | get_state(self, key=None, drop_defaults=False) | Gets the widget state, or a piece of it. | | Parameters | ---------- | key : unicode or iterable (optional) | A single property's name or iterable of property names to get. | | Returns | ------- | state : dict of states | metadata : dict | metadata for each field: {key: metadata} | | get_view_spec(self) | | hold_sync(self) | Hold syncing any state until the outermost context manager exits | | notify_change(self, change) | Called when a property has changed. | | on_msg(self, callback, remove=False) | (Un)Register a custom msg receive callback. | | Parameters | ---------- | callback: callable | callback will be passed three arguments when a message arrives:: | | callback(widget, content, buffers) | | remove: bool | True if the callback should be unregistered. | | open(self) | Open a comm to the frontend if one isn't already open. | | send(self, content, buffers=None) | Sends a custom msg to the widget model in the front-end. | | Parameters | ---------- | content : dict | Content of the message to send. | buffers : list of binary buffers | Binary buffers to send with message | | send_state(self, key=None) | Sends the widget state, or a piece of it, to the front-end, if it exists. | | Parameters | ---------- | key : unicode, or iterable (optional) | A single property's name or iterable of property names to sync with the front-end. | | set_state(self, sync_data) | Called when a state is received from the front-end. | | ---------------------------------------------------------------------- | Class methods inherited from ipywidgets.widgets.widget.Widget: | | close_all() from traitlets.traitlets.MetaHasTraits | | handle_control_comm_opened(comm, msg) from traitlets.traitlets.MetaHasTraits | Class method, called when the comm-open message on the | "jupyter.widget.control" comm channel is received | | ---------------------------------------------------------------------- | Static methods inherited from ipywidgets.widgets.widget.Widget: | | get_manager_state(drop_defaults=False, widgets=None) | Returns the full state for a widget manager for embedding | | :param drop_defaults: when True, it will not include default value | :param widgets: list with widgets to include in the state (or all widgets when None) | :return: | | handle_comm_opened(comm, msg) | Static method, called when a widget is constructed. | | on_widget_constructed(callback) | Registers a callback to be called when a widget is constructed. | | The callback must have the following signature: | callback(widget) | | ---------------------------------------------------------------------- | Readonly properties inherited from ipywidgets.widgets.widget.Widget: | | model_id | Gets the model id of this widget. | | If a Comm doesn't exist yet, a Comm will be created automagically. | | ---------------------------------------------------------------------- | Data descriptors inherited from ipywidgets.widgets.widget.Widget: | | comm | | keys | | ---------------------------------------------------------------------- | Data descriptors inherited from ipywidgets.widgets.widget.LoggingHasTraits: | | log | | ---------------------------------------------------------------------- | Methods inherited from traitlets.traitlets.HasTraits: | | __getstate__(self) | | __setstate__(self, state) | | has_trait(self, name) | Returns True if the object has a trait with the specified name. | | hold_trait_notifications(self) | Context manager for bundling trait change notifications and cross | validation. | | Use this when doing multiple trait assignments (init, config), to avoid | race conditions in trait notifiers requesting other trait values. | All trait notifications will fire after all values have been assigned. | | observe(self, handler, names=traitlets.All, type='change') | Setup a handler to be called when a trait changes. | | This is used to setup dynamic notifications of trait changes. | | Parameters | ---------- | handler : callable | A callable that is called when a trait changes. Its | signature should be ``handler(change)``, where ``change`` is a | dictionary. The change dictionary at least holds a 'type' key. | * ``type``: the type of notification. | Other keys may be passed depending on the value of 'type'. In the | case where type is 'change', we also have the following keys: | * ``owner`` : the HasTraits instance | * ``old`` : the old value of the modified trait attribute | * ``new`` : the new value of the modified trait attribute | * ``name`` : the name of the modified trait attribute. | names : list, str, All | If names is All, the handler will apply to all traits. If a list | of str, handler will apply to all names in the list. If a | str, the handler will apply just to that name. | type : str, All (default: 'change') | The type of notification to filter by. If equal to All, then all | notifications are passed to the observe handler. | | on_trait_change(self, handler=None, name=None, remove=False) | DEPRECATED: Setup a handler to be called when a trait changes. | | This is used to setup dynamic notifications of trait changes. | | Static handlers can be created by creating methods on a HasTraits | subclass with the naming convention '_[traitname]_changed'. Thus, | to create static handler for the trait 'a', create the method | _a_changed(self, name, old, new) (fewer arguments can be used, see | below). | | If `remove` is True and `handler` is not specified, all change | handlers for the specified name are uninstalled. | | Parameters | ---------- | handler : callable, None | A callable that is called when a trait changes. Its | signature can be handler(), handler(name), handler(name, new), | handler(name, old, new), or handler(name, old, new, self). | name : list, str, None | If None, the handler will apply to all traits. If a list | of str, handler will apply to all names in the list. If a | str, the handler will apply just to that name. | remove : bool | If False (the default), then install the handler. If True | then unintall it. | | set_trait(self, name, value) | Forcibly sets trait attribute, including read-only attributes. | | setup_instance(*args, **kwargs) | This is called **before** self.__init__ is called. | | trait_defaults(self, *names, **metadata) | Return a trait's default value or a dictionary of them | | Notes | ----- | Dynamically generated default values may | depend on the current state of the object. | | trait_has_value(self, name) | Returns True if the specified trait has a value. | | This will return false even if ``getattr`` would return a | dynamically generated default value. These default values | will be recognized as existing only after they have been | generated. | | Example | | .. code-block:: python | | class MyClass(HasTraits): | i = Int() | | mc = MyClass() | assert not mc.trait_has_value("i") | mc.i # generates a default value | assert mc.trait_has_value("i") | | trait_metadata(self, traitname, key, default=None) | Get metadata values for trait by key. | | trait_names(self, **metadata) | Get a list of all the names of this class' traits. | | trait_values(self, **metadata) | A ``dict`` of trait names and their values. | | The metadata kwargs allow functions to be passed in which | filter traits based on metadata values. The functions should | take a single value as an argument and return a boolean. If | any function returns False, then the trait is not included in | the output. If a metadata key doesn't exist, None will be passed | to the function. | | Returns | ------- | A ``dict`` of trait names and their values. | | Notes | ----- | Trait values are retrieved via ``getattr``, any exceptions raised | by traits or the operations they may trigger will result in the | absence of a trait value in the result ``dict``. | | traits(self, **metadata) | Get a ``dict`` of all the traits of this class. The dictionary | is keyed on the name and the values are the TraitType objects. | | The TraitTypes returned don't know anything about the values | that the various HasTrait's instances are holding. | | The metadata kwargs allow functions to be passed in which | filter traits based on metadata values. The functions should | take a single value as an argument and return a boolean. If | any function returns False, then the trait is not included in | the output. If a metadata key doesn't exist, None will be passed | to the function. | | unobserve(self, handler, names=traitlets.All, type='change') | Remove a trait change handler. | | This is used to unregister handlers to trait change notifications. | | Parameters | ---------- | handler : callable | The callable called when a trait attribute changes. | names : list, str, All (default: All) | The names of the traits for which the specified handler should be | uninstalled. If names is All, the specified handler is uninstalled | from the list of notifiers corresponding to all changes. | type : str or All (default: 'change') | The type of notification to filter by. If All, the specified handler | is uninstalled from the list of notifiers corresponding to all types. | | unobserve_all(self, name=traitlets.All) | Remove trait change handlers of any type for the specified name. | If name is not specified, removes all trait notifiers. | | ---------------------------------------------------------------------- | Class methods inherited from traitlets.traitlets.HasTraits: | | class_own_trait_events(name) from traitlets.traitlets.MetaHasTraits | Get a dict of all event handlers defined on this class, not a parent. | | Works like ``event_handlers``, except for excluding traits from parents. | | class_own_traits(**metadata) from traitlets.traitlets.MetaHasTraits | Get a dict of all the traitlets defined on this class, not a parent. | | Works like `class_traits`, except for excluding traits from parents. | | class_trait_names(**metadata) from traitlets.traitlets.MetaHasTraits | Get a list of all the names of this class' traits. | | This method is just like the :meth:`trait_names` method, | but is unbound. | | class_traits(**metadata) from traitlets.traitlets.MetaHasTraits | Get a ``dict`` of all the traits of this class. The dictionary | is keyed on the name and the values are the TraitType objects. | | This method is just like the :meth:`traits` method, but is unbound. | | The TraitTypes returned don't know anything about the values | that the various HasTrait's instances are holding. | | The metadata kwargs allow functions to be passed in which | filter traits based on metadata values. The functions should | take a single value as an argument and return a boolean. If | any function returns False, then the trait is not included in | the output. If a metadata key doesn't exist, None will be passed | to the function. | | trait_events(name=None) from traitlets.traitlets.MetaHasTraits | Get a ``dict`` of all the event handlers of this class. | | Parameters | ---------- | name : str (default: None) | The name of a trait of this class. If name is ``None`` then all | the event handlers of this class will be returned instead. | | Returns | ------- | The event handlers associated with a trait name, or all event handlers. | | ---------------------------------------------------------------------- | Readonly properties inherited from traitlets.traitlets.HasTraits: | | cross_validation_lock | A contextmanager for running a block with our cross validation lock set | to True. | | At the end of the block, the lock's value is restored to its value | prior to entering the block. | | ---------------------------------------------------------------------- | Static methods inherited from traitlets.traitlets.HasDescriptors: | | __new__(*args: Any, **kwargs: Any) -> Any | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from traitlets.traitlets.HasDescriptors: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined)