moldesign.uibase package¶
Submodules¶
moldesign.uibase.components module¶
-
class
moldesign.uibase.components.AtomInspector(value=None, **kwargs)[source]¶ Bases:
ipywidgets.widgets.widget_string.HTML,moldesign.uibase.selector.Selector
-
class
moldesign.uibase.components.ReadOnlyRepr(*args, **kwargs)[source]¶ Bases:
ipywidgets.widgets.widget_box.BoxWhen a value is assigned, displays its __repr__ instead
-
value¶
-
-
class
moldesign.uibase.components.ReadoutFloatSlider(format=None, *args, **kwargs)[source]¶ Bases:
ipywidgets.widgets.widget_box.Box-
description¶ A trait for unicode strings.
-
update_readout¶
-
value¶ A float trait.
-
-
class
moldesign.uibase.components.SelBase(mol)[source]¶ Bases:
moldesign.uibase.components.ViewerToolBase-
selected_atoms¶
-
-
class
moldesign.uibase.components.StyledTab(*args, **kwargs)[source]¶ Bases:
ipywidgets.widgets.widget_selectioncontainer.TabObjects can inherit from this to maintain consistent styling. TODO: Probably better to do this with CSS?
-
class
moldesign.uibase.components.UnitText(value=None, units=None, **kwargs)[source]¶ Bases:
ipywidgets.widgets.widget_box.BoxWidget for a user to input a quantity with physical units.
Parameters: - value (u.Scalar) – initial value for the widget
- units (u.MdtUnit) – if provided, require that input has the same dimensionality as these units
Note
A very rough approximation of the FloatText, IntText, etc. widgets - this does NOT have a counterpart in JavaScript. But it will behave similarly when setting units and values from python.
-
INVALID= u'\u274c'¶
-
VALID= u'\u2705'¶
-
value¶
moldesign.uibase.logwidget module¶
-
class
moldesign.uibase.logwidget.Logger(title='log', **kwargs)[source]¶ Bases:
object-
debug(string)¶
-
error(string)¶
-
handled(string)¶
-
info(string)¶
-
status(string)¶
-
warning(string)¶
-
-
class
moldesign.uibase.logwidget.WidgetValueHandler(widget=None)[source]¶ Bases:
logging.HandlerAppends logging messages to a widget’s value field. Watch this for performance - we’re repeatedly +=’ing a string, which is not good
-
emit(record)[source]¶ Emit a record. If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.
-
-
moldesign.uibase.logwidget.display_log(obj, title=None, show=False)[source]¶ Registers a new view. This is mostly so that we can display all views from a cell in a LoggingTabs object. :param obj: The object to display. If it has a “get_display_object” method, its return value is displayed :param title: A name for the object (otherwise, str(obj) is used) :return:
moldesign.uibase.plotting module¶
-
moldesign.uibase.plotting.function_slice(f, v, dims, ranges)[source]¶ Return an arbitrary dimensional slice of function values :param f: function to be evaluated, call signature f(v) :param v: vector that sets the static coordinates :param dims: ndims-length list of dimensions to vary :param ranges: ndims-list of values along those dimensions :return: gridpoints, function values
-
moldesign.uibase.plotting.grid_map(f, v, dims, grids)[source]¶ Map function values along a grid :param f: function to be evaluated, call signature f(v) :param v: vector that sets the static coordinates :param dims: ndims-length list of dimensions to vary :param grids: ndims-length list of grid values for each dimension :return: function value grid
moldesign.uibase.selector module¶
-
class
moldesign.uibase.selector.SelectionGroup(*args, **kwargs)[source]¶ Bases:
ipywidgets.widgets.widget_box.BoxBroadcasts selections among a group of widgets. It doesn’t do much beside rebroadcast events: A SelectionGroup object will call the “handle_selection_event” methods of all of its children whenever its “update_selections” method is called.
-
set_color(*args, **kwargs)¶
-
unset_color(*args, **kwargs)¶
-
-
class
moldesign.uibase.selector.Selector(*args, **kwargs)[source]¶ Bases:
objectThis is the abstract base class for something that can make a selection.
-
class
moldesign.uibase.selector.ValueSelector(value_selects=None, **kwargs)[source]¶ Bases:
moldesign.uibase.selector.SelectorThis is an abstract mixin for a widget class
-
moldesign.uibase.selector.create_value_selector(widget, value_selects, **kwargs)[source]¶ Creates a UI element (slider, checkbox, etc.) to add to your selection group. :param widget: widget class (e.g. ipywidgets.FloatSlider) :param value_selects: What the value of the widget selects (e.g. time) :param kwargs: keyword arguments for the widget (e.g. description = “time”) :return: the constructed widget