API

Core Data

glue.core.component Module

Classes

Component(data[, units]) Stores the actual, numerical information for a particular quantity
DerivedComponent(data, link[, units]) A component which derives its data from a function
CategoricalComponent(categorical_data[, …]) Container for categorical data.
CoordinateComponent(data, axis[, world]) Components associated with pixel or world coordinates

glue.core.component_id Module

Classes

ComponentID(label[, parent]) References a glue.core.component.Component object within a Data object.
PixelComponentID(axis, label[, parent]) The ID of a component which is a pixel position in the data - this allows us to make assumptions in certain places.
ComponentIDDict(data, **kwargs)
ComponentIDList

glue.core.coordinates Module

Functions

coordinates_from_header(header) Convert a FITS header into a glue Coordinates object.
coordinates_from_wcs(wcs) Convert an Astropy WCS object into a glue Coordinates object.

Classes

Coordinates() Base class for coordinate transformation
WCSCoordinates([header, wcs]) Class for coordinate transformation based on the WCS FITS standard.

glue.core.data Module

Classes

Data([label, coords]) The basic data container in Glue.
BaseCartesianData() Base class for any glue data object which indicates which methods should be provided at a minimum.
BaseData() Base class for any glue data object which indicates which methods should be provided at a minimum.

glue.core.data_collection Module

Classes

DataCollection([data]) The top-level object for interacting with datasets in Glue.

glue.core.hub Module

Classes

Hub(*args) The hub manages communication between subscribers.
HubListener The base class for any object that subscribes to hub messages.

glue.core.subset Module

Functions

combine_multiple(subsets, operator)
roi_to_subset_state(roi[, x_att, y_att, …]) Given a 2D ROI and attributes on the x and y axis, determine the corresponding subset state.

Classes

Subset(data[, color, alpha, label]) Base class to handle subsets of data.
SubsetState() The base class for all subset states.
RoiSubsetState([xatt, yatt, roi]) A subset defined as the set of points in two dimensions that lie inside a region of interest (ROI).
CategoricalROISubsetState([att, roi]) A subset defined as the set of values for a categorical data attribute that fall inside a categorical region of interest (ROI).
RangeSubsetState(lo, hi[, att]) A subset defined as the set of values inside a range.
MultiRangeSubsetState(pairs[, att]) A subset state defined by multiple discontinuous ranges
CompositeSubsetState(state1[, state2]) The base class for combinations of subset states.
OrState(state1[, state2]) An ‘or’ logical combination of subset states.
AndState(state1[, state2]) An ‘and’ logical combination of subset states.
XorState(state1[, state2]) An ‘exclusive or’ logical combination of subset states.
InvertState(state1[, state2]) A inverted subset state.
MaskSubsetState(mask, cids) A subset defined by a boolean mask.
CategorySubsetState(att, categories) A subset defined by the set of categorical values that are equal to a set of categories.
ElementSubsetState([indices, data]) A subset defined by a set of indices to apply to the data.
InequalitySubsetState(left, right, operator) A subset defined by a mathematical comparison of a attribute values to a reference value or attribute values.
CategoricalMultiRangeSubsetState(ranges, …) A subset state defined by two attributes where one attribute is categorical and the other is numerical, and where for each category, there are multiple possible subset ranges.
CategoricalROISubsetState2D(categories, …) A subset defined as the set of values for two categorical data attributes that fall inside a categorical region of interest (ROI).
SliceSubsetState(reference_data, slices) A subset defined by a set of array slices.
MultiOrState(states) A state for many states to be or’d together.

glue.core.subset_group Module

A SubsetGroup unites a group of Subset instances together with a consistent state, label, and style.

While subsets are internally associated with particular datasets, it’s confusing for the user to juggle multiple similar or identical subsets, applied to different datasets. Because of this, the GUI manages SubsetGroups, and presents each group to the user as a single entity. The individual subsets are held in-sync by the SubsetGroup.

Client code should only create Subset Groups via DataCollection.new_subset_group. It should not call Data.add_subset or Data.new_subset directly

Classes

GroupedSubset(data, group) A member of a SubsetGroup, whose internal representation is shared with other group members
SubsetGroup([color, alpha, label, subset_state]) Create a new empty SubsetGroup

glue.core.roi Module

Classes

Roi A geometrical 2D region of interest.
RectangularROI([xmin, xmax, ymin, ymax]) A 2D rectangular region of interest.
CircularROI([xc, yc, radius]) A 2D circular region of interest.
PolygonalROI([vx, vy]) A class to define 2D polygonal regions-of-interest
AbstractMplRoi(axes[, roi]) Base class for objects which use Matplotlib user events to edit/display ROIs
MplRectangularROI(axes) A subclass of RectangularROI that also renders the ROI to a plot
MplCircularROI(axes) Class to display / edit circular ROIs using matplotlib
MplPolygonalROI(axes[, roi]) Defines and displays polygonal ROIs on matplotlib plots
MplXRangeROI(axes)
param axes:A matplotlib Axes object to attach the graphical ROI to
MplYRangeROI(axes)
param axes:A matplotlib Axes object to attach the graphical ROI to
XRangeROI([min, max])
RangeROI(orientation[, min, max])
param orientation:
 ’x’ or ‘y’. Sets which axis to range
YRangeROI([min, max])
VertexROIBase([vx, vy])
param vx:initial x vertices
CategoricalROI([categories]) A ROI abstraction to represent selections of categorical data.

glue.core.data_factories Package

Functions

aastex_factory(file, **kwargs)
astropy_tabular_data(*args, **kwargs) Build a data set from a table.
auto_data(filename, *args, **kwargs) Attempt to automatically construct a data object
casalike_cube(filename, **kwargs) This provides special support for 4D CASA FITS - like cubes, which have 2 spatial axes, a spectral axis, and a stokes axis in that order.
cds_factory(file, **kwargs)
daophot_factory(file, **kwargs)
data_label(path) Convert a file path into a data label, by stripping out slashes, file extensions, etc.
find_factory(filename, **kwargs)
fits_reader(source[, auto_merge, …]) Read in all extensions from a FITS file.
has_extension(exts) A simple default filetype identifier function
hdf5_reader(filename[, auto_merge, memmap]) Read in all datasets from an HDF5 file
img_data(file_name) Load common image files into a Glue data object
ipac_factory(file, **kwargs)
is_casalike(filename, **kwargs) Check if a FITS file is a CASA like cube, with (P, P, V, Stokes) layout
is_fits(filename)
is_hdf5(filename)
is_npy_npz(filename) The first bytes are x93NUMPY (for npy) or PKx03x04 (for npz)
latex_factory(file, **kwargs)
load_data(path[, factory]) Use a factory to load a file and assign a label.
npy_npz_reader(filename[, format, auto_merge]) Read in a Numpy structured array saved to a .npy or .npz file.
pandas_read_table(path, **kwargs) A factory for reading tabular data using pandas :param path: path/to/file :param kwargs: All kwargs are passed to pandas.read_csv :returns: glue.core.data.Data object
sextractor_factory(file, **kwargs)
tabular_data(path, **kwargs)

Classes

FileWatcher(path, callback[, poll_interval]) Watch a path for modifications, and perform an action on change
LoadLog(path, factory, kwargs) This class attaches some metadata to data created from load_data, so that the data can be re-constructed when loading saved state.

glue.core.fitters Module

Glue’s fitting classes are designed to be easily subclassed for performing custom model fitting in Glue.

See the guide on writing custom fit plugins for help with using custom fitting utilities in Glue.

Classes

BaseFitter1D(**params) Base class for 1D fitters.
PolynomialFitter(**params) A polynomial model.
AstropyFitter1D(**params) A base class for wrapping astropy.modeling.
SimpleAstropyGaussianFitter(**params) Gaussian fitter using astropy.modeling.
BasicGaussianFitter(**params) Fallback Gaussian fitter, for astropy < 0.3.

glue.core.state_objects Module

Classes

State(**kwargs) A class to represent the state of a UI element.
StateAttributeCacheHelper(state, attribute) Generic class to help with caching values on a per-attribute basis
StateAttributeLimitsHelper(state, attribute) This class is a helper for attribute-dependent min/max level values.
StateAttributeSingleValueHelper(state, …)

glue.core.session Module

Classes

Session([application, data_collection, …])

User Interface

glue.viewers.common.viewer Module

Classes

BaseViewer(session) The base class for all viewers.
Viewer(session[, state]) A viewer class that uses a state class to represent the overall viewer state, and uses layer artists and state classes to handle each dataset and subset in the data viewer.

glue.viewers.common.qt.data_viewer Module

Classes

DataViewer(session[, state, parent]) Base class for all Qt DataViewer widgets.

glue.viewers.common.qt.base_widget Module

Classes

BaseQtViewerWidget([parent]) Base Qt class for all DataViewer widgets.

glue.viewers.matplotlib.state Module

Classes

DeferredDrawSelectionCallbackProperty([…]) A callback property where drawing is deferred until after notify has called all callback functions.
DeferredDrawCallbackProperty([default, …]) A callback property where drawing is deferred until after notify has called all callback functions.
MatplotlibDataViewerState(*args, **kwargs) A base class that includes common attributes for viewers based on Matplotlib.
MatplotlibLayerState([viewer_state]) A base class that includes common attributes for all layers in viewers based on Matplotlib.

glue.viewers.matplotlib.layer_artist Module

Classes

MatplotlibLayerArtist(axes, viewer_state[, …])

glue.viewers.matplotlib.qt.data_viewer Module

Classes

MatplotlibDataViewer(session[, parent, wcs, …])

glue.core.layer_artist Module

LayerArtist classes handle the visualization of an individual subset or dataset.

Visualization clients in Glue typically compose visualizations by stacking visualizations of several datasets and subsets on top of each other. They do this by creating and managing a collection of LayerArtists, one for each Data or Subset to view.

LayerArtists contain the bulk of the logic for actually rendering things

Classes

LayerArtistBase(layer) Create a new LayerArtist
LayerArtistContainer() A collection of LayerArtists

glue.viewers.common.state Module

Classes

ViewerState(**kwargs) A base class for all viewer states.
LayerState([viewer_state]) A base class for all layer states.

glue.viewers.common.layer_artist Module

Classes

LayerArtist(viewer_state[, layer_state, layer])

glue.viewers.common.qt.tool Module

Classes

Tool([viewer]) The base class for all toolbar tools.
CheckableTool([viewer]) A tool that is checkable.
DropdownTool(*args, **kwargs) A base class for all tools that show a drop-down menu.
SimpleToolMenu(*args, **kwargs) A base class for tools that have no action it themselves but show a dropdown of other tools.

glue.viewers.common.qt.mouse_mode Module

MouseModes define various mouse gestures.

MouseModes are generally activated and deactivated by toolbar buttons, although not necessarily so. The toolbar maintains a list of MouseModes from the visualization it is assigned to, and sees to it that only one MouseMode is active at a time.

Each MouseMode appears as an Icon in the toolbar. Classes can assign methods to the press_callback, move_callback, and release_callback methods of each Mouse Mode, to implement custom functionality

The basic usage pattern is thus:
  • visualization object instantiates the MouseModes it wants
  • each of these is passed to the add_tool method of the toolbar
  • visualization object optionally attaches methods to the 3 _callback methods in a MouseMode, for additional behavior

Classes

MouseMode(viewer[, press_callback, …]) The base class for all MouseModes.

glue.viewers.common.qt.toolbar_mode Module

ToolbarModes are CheckableTools that enable various MouseModes.

The toolbar maintains a list of MouseModes from the visualization it is assigned to, and sees to it that only one MouseMode is active at a time.

Each ToolbarMode appears as an Icon in the toolbar. Classes can assign methods to the press_callback, move_callback, and release_callback methods of each Mouse Mode, to implement custom functionality

The basic usage pattern is thus:
  • visualization object instantiates the MouseModes it wants
  • each of these is passed to the add_tool method of the toolbar
  • visualization object optionally attaches methods to the 3 _callback methods in a MouseMode, for additional behavior

Classes

ToolbarModeBase(viewer, **kwargs) All ToolbarModes are both MouseModes and CheckableTools
RoiModeBase(viewer, **kwargs) Base class for defining ROIs.
RoiMode(viewer, **kwargs) Define Roi Modes via click+drag events.
PersistentRoiMode(viewer, **kwargs) Same functionality as RoiMode, but the Roi is never finalized, and remains rendered after mouse gestures
ClickRoiMode(viewer, **kwargs) Generate ROIs using clicks and click+drags.
RectangleMode(viewer, **kwargs) Defines a Rectangular ROI, accessible via the roi() method
PathMode(viewer, **kwargs)
CircleMode(viewer, **kwargs) Defines a Circular ROI, accessible via the roi() method
PolyMode(viewer, **kwargs) Defines a Polygonal ROI, accessible via the roi() method
LassoMode(viewer, **kwargs) Defines a Polygonal ROI, accessible via the roi() method
HRangeMode(viewer, **kwargs) Defines a Range ROI, accessible via the roi() method.
VRangeMode(viewer, **kwargs) Defines a Range ROI, accessible via the roi() method.
PickMode(viewer, **kwargs) Defines a PointROI.
ContrastMode(viewer, **kwargs) Uses right mouse button drags to set bias and contrast, DS9-style.
ColormapMode([viewer]) A tool to change the colormap used in a viewer.

glue.viewers.common.qt.toolbar Module

Classes

BasicToolbar(str, parent) Create a new toolbar object

glue.viewers.matplotlib.mpl_axes Module

Functions

update_appearance_from_settings(axes)
init_mpl([figure, axes, wcs, axes_factory])

glue.viewers.matplotlib.viewer Module

glue.viewers.matplotlib.qt.toolbar Module

Classes

MatplotlibTool([viewer])
MatplotlibCheckableTool([viewer])
HomeTool([viewer])
SaveTool([viewer])
PanTool([viewer])
ZoomTool([viewer])

glue.viewers.scatter.viewer Module

glue.viewers.scatter.state Module

Classes

ScatterViewerState(**kwargs) A state class that includes all the attributes for a scatter viewer.
ScatterLayerState([viewer_state, layer]) A state class that includes all the attributes for layers in a scatter plot.

glue.viewers.scatter.qt Package

Functions

setup()

Classes

ScatterViewer(session[, parent, state])

glue.viewers.image.viewer Module

glue.viewers.image.state Module

Classes

ImageViewerState(**kwargs) A state class that includes all the attributes for an image viewer.
ImageLayerState([layer, viewer_state]) A state class that includes all the attributes for data layers in an image plot.
ImageSubsetLayerState([viewer_state]) A state class that includes all the attributes for subset layers in an image plot.
AggregateSlice([slice, center, function])

glue.viewers.image.qt Package

Functions

setup()

Classes

ImageViewer(session[, parent, state])
StandaloneImageViewer([image, wcs, parent]) A simplified image viewer, without any brushing or linking, but with the ability to adjust contrast and resample.

glue.viewers.histogram.viewer Module

glue.viewers.histogram.state Module

Classes

HistogramViewerState(**kwargs) A state class that includes all the attributes for a histogram viewer.
HistogramLayerState([viewer_state]) A state class that includes all the attributes for layers in a histogram plot.

glue.viewers.histogram.qt Package

Functions

setup()

Classes

HistogramViewer(session[, parent, state])

glue.viewers.table.qt Package

Functions

setup()

Classes

TableLayerArtist(table_viewer, viewer_state)
TableViewer(session[, state, parent, widget])

glue.viewers.custom.qt.custom_viewer Module

This module provides utilities for creating custom data viewers. The goal of this module is to make it easy for users to make new data viewers by focusing on matplotlib visualization logic, and not UI or event processing logic.

The end user typically interacts with this code via glue.custom_viewer()

Classes

AttributeWithInfo An array subclass wrapping a Component of a dataset It is an array with the following additional attributes: id contains the ComponentID or string name of the Component, and categories is an array or None.
ViewerUserState Empty object for users to store data inside.
UserDefinedFunction(name) Descriptor to specify a UserDefinedFunction.
CustomViewer(viewer) Base class for custom data viewers.
CustomViewerMeta Metaclass to construct CustomViewer and subclasses
CustomSubsetState(coordinator, roi) A SubsetState subclass that uses a CustomViewer’s “select” function
CustomViewer(viewer) Base class for custom data viewers.
CustomLayerArtist(coordinator, *args, **kwargs) LayerArtist for simple custom viewers that use Matplotlib
CustomMatplotlibDataViewer(session[, parent]) Base Qt widget class for simple custom viewers that use Matplotlib

glue.core.application_base Module

Classes

Application([data_collection, session])

glue.app.qt.application Module

Classes

GlueApplication([data_collection, session]) The main GUI application for the Qt frontend

glue.qglue Module

Utility function to load a variety of python objects into glue

Functions

qglue(**kwargs) Quickly send python variables to Glue for visualization.

glue Package

Functions

custom_viewer(name, **kwargs) Create a custom interactive data viewer.
qglue(**kwargs) Quickly send python variables to Glue for visualization.
test([no_optional_skip])

Utilities

glue.config Module

Classes

Registry() Container to hold groups of objects or settings.
SettingRegistry() Stores key/value settings that code can use to customize Glue
ExporterRegistry() Stores functions which can export an applocation to an output file
ColormapRegistry() Stores colormaps for the Image Viewer.
DataFactoryRegistry() Stores data factories.
QtClientRegistry() Stores QT widgets to visualize data.
LinkFunctionRegistry() Stores functions to convert between quantities
LinkHelperRegistry() Stores helper objects that compute many ComponentLinks at once
ViewerToolRegistry()
LayerActionRegistry() Stores custom menu actions available when the user select one or more datasets, subset group, or subset in the data collection view.
ProfileFitterRegistry()
DictRegistry() Base class for registries that are based on dictionaries instead of lists of objects.
PreferencePanesRegistry() Stores preference panes
DataExporterRegistry() Stores data exporters.
SubsetMaskExporterRegistry() Stores mask exporters.
SubsetMaskImporterRegistry() Stores mask importers.
StartupActionRegistry()
QtFixedLayoutTabRegistry() Stores Qt pre-defined tabs (non-MDI)
KeyboardShortcut() Stores keyboard shortcuts.
LayerArtistMakerRegistry() A registry that allows customization of layer artists based on the data and viewer type.

glue.core.simpleforms Module

The descriptors in this module are meant to be added to classes, to specify simple user-settable forms. These classes are used to automatically construct GUIs, without having to write GUI code in the form class itself.

Option objects are defined at the class-level. To instances of these classes, an Option behaves like a normal instance attribute.

See Custom fitting plugins for example usage.

Classes

BoolOption([label, default]) A boolean-valued option.
FloatOption([min, max, default, label]) A floating-point option.
IntOption([min, max, default, label]) An integer-valued option.
Option(default, label) Base class for other options.

glue.core.data_combo_helper Module

Classes

ComponentIDComboHelper(state, selection_property) The purpose of this class is to set up a combo (represented by a SelectionCallbackProperty) showing componentIDs for one or more datasets, and to update these componentIDs if needed, for example if new components are added to a dataset, or if componentIDs are renamed.
ManualDataComboHelper(state, selection_property) This is a helper for combo boxes that need to show a list of data objects that is manually curated.
DataCollectionComboHelper(state, …) This is a helper for combo boxes that need to show a list of data objects that is always in sync with a DataCollection.
ComboHelper(state, selection_property) Base class for any combo helper represented by a SelectionCallbackProperty.
BaseDataComboHelper(state, selection_property) This is a base class for helpers for combo boxes that need to show a list of data objects.

glue.core.message Module

Classes

Message(sender[, tag]) Base class for messages that the hub handles.
ErrorMessage(sender[, tag]) Used to send general purpose error messages
SubsetMessage(sender[, tag]) A general message issued by a subset.
SubsetCreateMessage(sender[, tag]) A message that a subset issues when its state changes
SubsetUpdateMessage(sender[, attribute, tag]) A message that a subset issues when its state changes.
SubsetDeleteMessage(sender[, tag]) A message that a subset issues when it is deleted
DataMessage(sender[, tag]) The base class for messages that data objects issue
DataAddComponentMessage(sender, component_id)
DataUpdateMessage(sender, attribute[, tag])
DataCollectionMessage(sender[, tag])
DataCollectionActiveChange(sender[, tag])
DataCollectionActiveDataChange(sender[, tag])
DataCollectionAddMessage(sender, data[, tag])
DataCollectionDeleteMessage(sender, data[, tag])
ApplicationClosedMessage(sender[, tag]) A general message issued when Glue application is closed.
DataRemoveComponentMessage(sender, component_id)
LayerArtistEnabledMessage(sender[, tag])
LayerArtistDisabledMessage(sender[, tag])
DataRenameComponentMessage(sender, component_id)
DataReorderComponentMessage(sender, …[, tag])
LayerArtistVisibilityMessage(sender[, tag])

glue.core.util Module

Functions

relim(lo, hi[, log])
split_component_view(arg) Split the input to data or subset.__getitem__ into its pieces.
join_component_view(component, view) Pack a ComponentID and optional view into single tuple.
facet_subsets(data_collection, cid[, lo, …]) Create a series of subsets that partition the values of a particular attribute into several bins
colorize_subsets(subsets, cmap[, lo, hi]) Re-color a list of subsets according to a colormap.
disambiguate(label, taken) If necessary, add a suffix to label to avoid name conflicts
small_view(data, attribute) Extract a downsampled view from a dataset, for quick statistical summaries
small_view_array(data) Same as small_view, except using a numpy array as input
visible_limits(artists, axis) Determines the data limits for the data in a set of artists.
tick_linker(all_categories, pos, *args)
update_ticks(axes, coord, kinds, is_log, …) Changes the axes to have the proper tick formatting based on the type of component.

glue.core.visual Module

Classes

VisualAttributes([parent, washout, color, alpha]) This class is used to define visual attributes for any kind of objects

glue.utils.array Module

Functions

unique(array) Return the unique elements of the array U, as well as the index array I such that U[I] == array
shape_to_string(shape) On Windows, shape tuples use long ints which results in formatted shapes such as (2L, 3L).
view_shape(shape, view) Return the shape of a view of an array.
stack_view(shape, *views)
coerce_numeric(arr) Coerce an array into a numeric array, replacing non-numeric elements with nans.
check_sorted(array) Return True if the array is sorted, False otherwise.
broadcast_to(array, shape) Compatibility function - can be removed once we support only Numpy 1.10 and above
unbroadcast(array) Given an array, return a new array that is the smallest subset of the original array that can be re-broadcasted back to the original array.
iterate_chunks(shape[, chunk_shape, n_max]) Given a data shape and a chunk shape (or maximum chunk size), iteratively return slice objects that can be used to slice the array.
combine_slices(slice1, slice2, length) Given two slices that can be applied to a 1D array and the length of that array, this returns a new slice which is the one that should be applied to the array instead of slice2 if slice1 has already been applied.
nanmean(array[, axis])
nanmedian(array[, axis])
nansum(array[, axis])
nanmin(array[, axis])
nanmax(array[, axis])
format_minimal(values) Find the shortest format that can be used to represent all values in an array such that all the string representations are different.
compute_statistic(statistic, data[, mask, …]) Compute a statistic for the data.
index_lookup(data, items) Lookup which index in items each data value is equal to

Classes

categorical_ndarray A Numpy array subclass that includes properties to find the categories and unique integer codes for array values.

glue.utils.geometry Module

Functions

points_inside_poly(x, y, vx, vy)
polygon_line_intersections(px, py[, xval, yval]) Find all the segments of intersection between a polygon and an infinite horizontal/vertical line.
floodfill(data, start_coords, threshold)

glue.utils.matplotlib Module

Functions

renderless_figure()
all_artists(fig) Build a set of all Matplotlib artists in a Figure
new_artists(fig, old_artists) Find the newly-added artists in a figure
remove_artists(artists) Remove a collection of matplotlib artists from a scene
get_extent(view[, transpose])
view_cascade(data, view) Return a set of views progressively zoomed out of input at roughly constant pixel count
fast_limits(data, plo, phi) Quickly estimate percentiles in an array, using a downsampled version
defer_draw(func) Decorator that globally defers all Agg canvas draws until function exit.
color2rgb(color)
point_contour(x, y, data) Calculate the contour that passes through (x,y) in data
cache_axes(axes, toolbar) Set up caching for an axes object.
datetime64_to_mpl(d) Convert numpy.datetime64 or an ndarray of those types to Gregorian date as UTC float.
mpl_to_datetime64(dt)
color2hex(color)

glue.utils.misc Module

Functions

nonpartial(func, *args, **kwargs) Like functools.partial, this returns a function which, when called, calls func(*args, **kwargs).
lookup_class(ref) Look up an object via its module string (e.g., ‘glue.core.data.Data’)
as_variable_name(x) Convert a string to a legal python variable name
as_list(x)
file_format(filename)
common_prefix(strings[, exclude_punctuation]) Given a list of strings, find the longest prefix common to all of them
queue_to_list(q) Get all the values in a queue.Queue object and return a list.

Classes

DeferredMethod(method) This class stubs out a method, and provides a callable interface that logs its calls.
CallbackMixin() A mixin that provides a utility for attaching callback functions to methods
PropertySetMixin An object that provides a set of properties that are meant to encapsulate state information
Pointer(key)

glue.utils.qt Package

Functions

cmap2pixmap(cmap[, steps, size]) Convert a matplotlib colormap into a QPixmap
combo_as_string(combo) Return the text labels of a combo box as a string to make it easier to check the content of a combo box in tests.
connect_color(client, prop, widget)
fix_tab_widget_fontsize(tab_widget) Because of a bug in Qt, tab titles on MacOS X don’t have the right font size
get_qapp([icon_path])
get_text([title, default]) Prompt the user to enter text using Qt
load_ui(path[, parent, directory]) Load a .ui file
mpl_to_qt_color(color[, alpha]) Convert a matplotlib color string into a Qt QColor object
pick_class(classes[, sort]) Prompt the user to pick from a list of classes using Qt
pick_item(items, labels[, title, label, default]) Prompt the user to choose an item
process_dialog([delay, accept, reject, function]) Context manager to automatically capture the active dialog and carry out certain actions.
qt_to_mpl_color(qcolor) Convert a QColor object into a string that matplotlib understands
qurl_to_path(url) Convert a local QUrl to a normal path
set_cursor(shape) Set the Qt cursor for the duration of a function call, and unset
set_cursor_cm(shape) Context manager equivalent for set_cursor().
tint_pixmap(bm, color) Re-color a monochrome pixmap object using color
update_combobox(combo, labeldata[, …]) Redefine the items in a QComboBox

Classes

CenteredDialog A dialog that is centered on the screen.
ColorProperty(att[, docstring])
CompletionTextEdit(parent, parent)
GlueItemWidget([parent]) A mixin for QtWidgets.QListWidget/GlueTreeWidget subclasses, that provides drag+drop functionality.
GlueTabBar(parent)
HtmlItemDelegate An item delegate that can be used for e.g.
PyMimeData([instance]) A custom MimeData object that stores live python objects
PythonListModel(items[, parent]) A Qt Model that wraps a python list, and exposes a list-like interface
QColorBox(parent, flags, …)
QColormapCombo(parent)
Worker(parent) Execute a function call on a different thread.
die_on_error(msg)
messagebox_on_error(msg[, sep, exit])

glue.utils.qt.widget_properties Module

The classes in this module provide a property-like interface to widget instance variables in a class. These properties translate essential pieces of widget state into more convenient python objects (for example, the check state of a button to a bool).

Example Use:

class Foo(object):
    bar = ButtonProperty('_button')

    def __init__(self):
        self._button = QtWidgets.QCheckBox()

f = Foo()
f.bar = True  # equivalent to f._button.setChecked(True)
assert f.bar == True

Classes

WidgetProperty(att[, docstring]) Base class for widget properties
CurrentComboDataProperty(att[, docstring]) Wrapper around the data in QComboBox.
CurrentComboTextProperty(att[, docstring]) Wrapper around the text in QComboBox.
CurrentTabProperty(att[, docstring]) Wrapper around QTabWidget.
TextProperty(att[, docstring]) Wrapper around the text() and setText() methods for QLabel etc
ButtonProperty(att[, docstring]) Wrapper around the check state for QAbstractButton widgets
FloatLineProperty(att[, docstring]) Wrapper around the text state for QLineEdit widgets.
ValueProperty(att[, docstring, value_range, log]) Wrapper around widgets with value() and setValue()

Bundled third-party packages

glue.external.echo Package

Functions

add_callback(instance, prop, callback[, …]) Attach a callback function to a property in an instance
callback_property(getter) A decorator to build a CallbackProperty.
ignore_callback(instance, *props) Temporarily ignore any callbacks from one or more callback properties
remove_callback(instance, prop, callback) Remove a callback function from a property in an instance

Classes

CallbackList(callback, *args, **kwargs) A list that calls a callback function when it is modified.
CallbackProperty([default, docstring, …]) A property that callback functions can be added to.
ChoiceSeparator
HasCallbackProperties() A class that adds functionality to subclasses that use callback properties.
ListCallbackProperty([default, docstring, …]) A list property that calls callbacks when its contents are modified
SelectionCallbackProperty([default_index, …])
delay_callback(instance, *props) Delay any callback functions from one or more callback properties
keep_in_sync(instance1, prop1, instance2, prop2)

glue.external.echo.qt Package

Functions

autoconnect_callbacks_to_qt(instance, widget) Given a class instance with callback properties and a Qt widget/window, connect callback properties to Qt widgets automatically.
connect_checkable_button(instance, prop, widget) Connect a boolean callback property with a Qt button widget.
connect_combo_data(instance, prop, widget) Connect a callback property with a QComboBox widget based on the userData.
connect_combo_selection(instance, prop, widget)
connect_combo_text(instance, prop, widget) Connect a callback property with a QComboBox widget based on the text.
connect_float_text(instance, prop, widget[, fmt]) Connect a numerical callback property with a Qt widget containing text.
connect_text(instance, prop, widget) Connect a string callback property with a Qt widget containing text.
connect_value(instance, prop, widget[, …]) Connect a numerical callback property with a Qt widget representing a value.