web.protocols Module

paraviewweb_protocols is a module that contains a set of ParaViewWeb related protocols that can be combined together to provide a flexible way to define very specific web application.

class paraview.web.protocols.ParaViewWebColorManager(pathToColorMaps=None, showBuiltin=True, **kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

colorBy(representation, colorMode, arrayLocation='POINTS', arrayName='', vectorMode='Magnitude', vectorComponent=0, rescale=False)[source]

Choose the array to color by, and optionally specify magnitude or a vector component in the case of vector array.

getCurrentScalarRange(proxyId)[source]
getLutImage(representation, numSamples, customRange=None)[source]
getLutImages(numSamples)[source]
getOpacityFunctionPoints(arrayName)[source]
getRgbPoints(arrayName)[source]
getScalarBarVisibilities(proxyIdList)[source]

Returns whether or not each specified scalar bar is visible.

getSurfaceOpacity(representation)[source]
getSurfaceOpacityByArray(arrayName)[source]
listColorMapNames()[source]

List the names of all color map presets available on the server. This list will contain the names of any presets you provided in the file you supplied to the constructor of this protocol.

rescaleTransferFunction(options)[source]

Rescale the color transfer function to fit either the data range, the data range over time, or to a custom range, for the array by which the representation is currently being colored.

selectColorMap(representation, paletteName)[source]

Choose the color map preset to use when coloring by an array.

setOpacityFunctionPoints(arrayName, pointArray, enableOpacityMapping=False)[source]
setRgbPoints(arrayName, rgbInfo)[source]
setScalarBarVisibilities(proxyIdMap)[source]

Sets the visibility of the scalar bar corresponding to each specified proxy. The representation for each proxy is found using the filter/source proxy id and the current view.

setSurfaceOpacity(representation, enabled)[source]
setSurfaceOpacityByArray(arrayName, enabled)[source]
class paraview.web.protocols.ParaViewWebExportData(basePath, **kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

exportData(proxy_id, path)[source]
class paraview.web.protocols.ParaViewWebFileListing(basePath, name, excludeRegex='^\\.|~$|^\\$', groupRegex='[0-9]+\\.', **kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

handleMultiRoot(relativeDir)[source]
handleSingleRoot(baseDirectory, relativeDir, startPath=None)[source]
listServerDirectory(relativeDir='.')[source]

RPC Callback to list a server directory relative to the basePath provided at start-up.

class paraview.web.protocols.ParaViewWebKeyValuePairStore(**kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

retrieveKeyPair(key)[source]
storeKeyPair(key, value)[source]
class paraview.web.protocols.ParaViewWebLocalRendering(**kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

addViewObserver(viewId)[source]
getArray(dataHash, binary=False)[source]
getViewState(viewId, newSubscription=False)[source]
removeViewObserver(viewId)[source]
class paraview.web.protocols.ParaViewWebMouseHandler(**kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

mouseInteraction(event)[source]

RPC Callback for mouse interactions.

class paraview.web.protocols.ParaViewWebProgressUpdate(**kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

listenToProgress()[source]
progressObserverTag = None
updateProgress(caller)[source]
class paraview.web.protocols.ParaViewWebProtocol[source]

Bases: vtkmodules.web.protocols.vtkWebProtocol

debug(msg)[source]
getAbsolutePath(relativePath)[source]
getView(vid)[source]

Returns the view for a given view ID, if vid is None then return the current active view. :param vid: The view ID :type vid: str

mapIdToProxy(id)[source]

Maps global-id for a proxy to the proxy instance. May return None if the id is not valid.

publish(topic, event)[source]
setBaseDirectory(basePath)[source]
updateScalarBars(view=None, mode=1)[source]

Manage scalarbar state

view:

A view proxy or the current active view will be used.

mode:

HIDE_UNUSED_SCALAR_BARS = 0x01, SHOW_USED_SCALAR_BARS = 0x02

class paraview.web.protocols.ParaViewWebProxyManager(allowedProxiesFile=None, baseDir=None, fileToLoad=None, allowUnconfiguredReaders=True, groupProxyEditorWidgets=True, respectPropertyGroups=True, **kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

VTK_DATA_TYPES = ['void', 'bit', 'char', 'unsigned_char', 'short', 'unsigned_short', 'int', 'unsigned_int', 'long', 'unsigned_long', 'float', 'double', 'id_type', 'unspecified', 'unspecified', 'signed_char', 'long_long', 'unsigned_long_long']
applyDomains(parentProxy, proxy_id)[source]

This function is used to apply the domains so that queries for specific values like range min and max retrieve something useful.

available(typeOfProxy)[source]

Returns a list of the available sources or filters, depending on the argument typeOfProxy, which can be either ‘filters’ or ‘sources’. If typeOfProxy is anything other than ‘filter’ or ‘source’, the empty list will be returned.

Any attempt to create a source or filter not returned by this method will result in an error response. The returned list has the following form:

[ ‘Wavelet’, ‘Cone’, ‘Sphere’, … ]

or

[ ‘Contour’, ‘Clip’, ‘Slice’, … ]

configureFiltersOrSources(key, flist)[source]
configureReaders(rlist)[source]
create(functionName, parentId, initialValues={}, skipDomain=False, subProxyValues={})[source]

Creates a new filter/source proxy as a child of the specified parent proxy. Returns the proxy state for the newly created proxy as a JSON object.

delete(proxyId)[source]

Checks if the proxy can be deleted (it is not the input to another proxy), and then deletes it if so. Returns True if the proxy was deleted, False otherwise.

extractParentAttributes(property, attributes)[source]
fillPropertyList(proxy_id, propertyList, dependency=None)[source]
findProxyId(groupName, proxyName)[source]
get(proxyId, ui=True)[source]

Returns the proxy state for the given proxyId as a JSON object.

getColorInformation(proxy)[source]

Generates a block of color information, given a representation proxy.

colorBy: {

‘representation’: ‘652’, ‘scalarBar’: 0, ‘mode’: ‘color’ # ‘array’ ‘color’: [ 0.5, 1.0, 1.0 ], ‘array’: [ ‘POINTS’, ‘RTData’, -1 ], ‘colorMap’: ‘Blue to Red’

}

getDataInformation(proxy)[source]
getProxyDefinition(group, name)[source]
getProxyListFromProperty(proxy, proxyPropElement, inPropGroup, group, parentGroup, detailsKey)[source]
getProxyXmlDefinitions(proxy)[source]
getUiProperties(proxyId, proxyProperties)[source]

Generates an array of objects, parallel to the properties, containing the information needed to render ui for each property. Not all of the following attributes will always be present.

ui[ {

‘name’: ‘Clip Type’, ‘advanced’: 1, # 0 ‘doc’: ‘Documentation string for the property’, ‘dependency’: ‘498:ClipFunction:Sphere:1’, ‘values’: { ‘Plane’: ‘456’, ‘Box’: ‘457’, ‘Scalar’: ‘458’, ‘Sphere’: ‘459’ }, ‘type’: ‘int’, # ‘float’, ‘int’, ‘str’, ‘proxy’, ‘input’, … ‘widget’: ‘textfield’, # ‘checkbox’, ‘textarea’, ‘list-1’, ‘list-n’ ‘size’: -1, # -1, 0, 2, 3, 6 ‘range’: [ { ‘min’: 0, ‘max’: 1 }, { ‘min’: 4, ‘max’: 7 }, … ]

}, …

]

list(viewId=None)[source]

Returns the current proxy list, specifying for each proxy it’s name, id, and parent (input) proxy id. A ‘parent’ of ‘0’ means the proxy has no input.

open(relativePath)[source]

Open relative file paths, attempting to use the file extension to select from the configured readers.

processXmlElement(proxy, xmlElement, inPropGroup, group, parentGroup, belongsToProxyProperty=None)[source]
readAllowedProxies(filepathOrConfig)[source]
reorderProperties(rootProxyId, proxyProperties)[source]
restructureProperties(groupList, propList, uiList)[source]
setProperty(property, propertyValue)[source]
trackProperty(detailsKey, name, panelVis, panelVisQualifier, size, inPropGroup, group, parentGroup, belongsToProxyProperty=None)[source]
update(propertiesList)[source]

Takes a list of properties and updates the corresponding proxies.

validate(functionName)[source]
class paraview.web.protocols.ParaViewWebPublishImageDelivery(decode=True, **kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

addRenderObserver(viewId)[source]
animate(renderAllViews=True)[source]
enableView(viewId, enabled)[source]
getCurrentFrameRate()[source]
imagePush(options)[source]
invalidateCache(viewId)[source]
mouseInteraction(event)[source]

RPC Callback for mouse interactions.

progressiveRender(viewId='-1')[source]
pushRender(vId, ignoreAnimation=False, staleCount=0)[source]
removeRenderObserver(viewId)[source]
renderStaleImage(vId, staleCount=0)[source]
setLinkChangeCallback(fn)[source]
setMaxFrameRate(fps=30)[source]
setViewQuality(viewId, quality, ratio=1, updateLinkedView=True)[source]
setViewSize(viewId, width, height)[source]
startViewAnimation(viewId='-1')[source]
stillRender(options)[source]

RPC Callback to render a view and obtain the rendered image.

stopViewAnimation(viewId='-1')[source]
updateZoomFromWheel(event)[source]
class paraview.web.protocols.ParaViewWebRemoteConnection[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

connect(options)[source]

Creates a connection to a remote pvserver. Expect an option argument which should override any of those default properties:

{
'host': 'localhost',
'port': 11111,
'rs_host': None,
'rs_port': 11111
}
pvDisconnect(message)[source]

Free the current active session

reverseConnect(port=11111)[source]

Create a reverse connection to a server. Listens on port and waits for an incoming connection from the server.

class paraview.web.protocols.ParaViewWebSaveData(baseSavePath='', **kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

saveData(filePath, options=None)[source]

Save some data on the server side. Can save data from a proxy, a screenshot, or else the current state. Options may be different depending on the type of data to be save. Saving a screenshot can take an optional size array indicating the desired width and height of the saved image. Saving data can take an optional proxy id specifying which filter or source to save output from.

options = {

‘proxyId’: ‘426’, ‘size’: [ <imgWidth>, <imgHeight> ]

}

class paraview.web.protocols.ParaViewWebSelectionHandler(**kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

endSelection(area, extract)[source]

Method used to finalize an interactive selection by providing the [ startPointX, startPointY, endPointX, endPointY ] area where (0,0) match the lower left corner of the pixel screen.

startSelection(viewId, selectionType)[source]

Method used to initialize an interactive selection

class paraview.web.protocols.ParaViewWebStartupPluginLoader(plugins=None, pathSeparator=':', **kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

loaded = False
class paraview.web.protocols.ParaViewWebStartupRemoteConnection(dsHost=None, dsPort=11111, rsHost=None, rsPort=22221, rcPort=- 1, **kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

connected = False
class paraview.web.protocols.ParaViewWebStateLoader(state_path=None, **kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

loadState(state_file)[source]

Load a state file and return the list of view ids

class paraview.web.protocols.ParaViewWebTestProtocols[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

clearAll()[source]
getColoringInfo(proxyId)[source]
getReprFromSource(srcProxyId)[source]
class paraview.web.protocols.ParaViewWebTimeHandler(**kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

getTimeStep()[source]
getTimeValue()[source]
getTimeValues()[source]
nextPlay()[source]
play(deltaT=0.1)[source]
setTimeStep(timeIdx)[source]
setTimeValue(t)[source]
stop()[source]
updateTime(action)[source]
class paraview.web.protocols.ParaViewWebViewPort(scale=1.0, maxWidth=2560, maxHeight=1440, **kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

getCamera(view_id)[source]
resetCamera(viewId)[source]

RPC callback to reset camera.

updateCamera(view_id, focal_point, view_up, position, forceUpdate=True)[source]
updateCenterAxesVisibility(viewId, showAxis)[source]

RPC callback to show/hide CenterAxesVisibility.

updateOrientationAxesVisibility(viewId, showAxis)[source]

RPC callback to show/hide OrientationAxis.

updateSize(view_id, width, height)[source]
class paraview.web.protocols.ParaViewWebViewPortGeometryDelivery(**kwargs)[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

getCachedWebGLData(sha)[source]
getSceneMetaData(view_id)[source]
getSceneMetaDataAllTimesteps(view_id=- 1)[source]
getWebGLData(view_id, object_id, part)[source]
class paraview.web.protocols.ParaViewWebViewPortImageDelivery[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

stillRender(options)[source]

RPC Callback to render a view and obtain the rendered image.

class paraview.web.protocols.ParaViewWebWidgetManager[source]

Bases: paraview.web.protocols.ParaViewWebProtocol

CreateWidgetRepresentation(view, name)[source]
addRuler(view_id=- 1)[source]
createWidgetRepresentation(proxy_id, view_id)[source]
paraview.web.protocols.alphanum_key(s)[source]

Turn a string into a list of string and number chunks. “z23a” -> [“z”, 23, “a”]

paraview.web.protocols.sanitizeKeys(mapObj)[source]
paraview.web.protocols.tryint(s)[source]