ccpn.ui.gui.lib.OpenGL package

Module Documentation here

ccpn.ui.gui.lib.OpenGL.util_find_library_OSX11Patch(name)[source]

Submodules

ccpn.ui.gui.lib.OpenGL.CcpnOpenGL module

By Functionality:

Zoom and pan:

Left-drag: pans the spectrum.

shift-left-drag: draws a zooming box and zooms the viewing window. shift-middle-drag: draws a zooming box and zooms the viewing window. shift-right-drag: draws a zooming box and zooms the viewing window. Two successive shift-right-clicks: define zoombox control-right click: reset the zoom

Peaks:

Left-click: select peak near cursor in a spectrum display, deselecting others Control(Cmd)-left-click: (de)select peak near cursor in a spectrum display, adding/removing to selection. Control(Cmd)-left-drag: selects peaks in an area specified by the dragged region. Middle-drag: Moves a selected peak. Control(Cmd)-Shift-Left-click: picks a peak at the cursor position, adding to selection Control(Cmd)-shift-left-drag: picks peaks in an area specified by the dragged region.

Others:

Right-click: raises the context menu.

By Mouse button:

Left-click: select peak near cursor in a spectrum display, deselecting others Control(Cmd)-left-click: (de)select peak near cursor in a spectrum display, adding/removing to selection. Control(Cmd)-Shift-Left-click: picks a peak at the cursor position, adding to selection

Left-drag: pans the spectrum. shift-left-drag: draws a zooming box and zooms the viewing window. Control(Cmd)-left-drag: selects peaks in an area specified by the dragged region. Control(Cmd)-shift-left-drag: picks peaks in an area specified by the dragged region.

shift-middle-drag: draws a zooming box and zooms the viewing window.

Right-click: raises the context menu. control-right click: reset the zoom Two successive shift-right-clicks: define zoombox

shift-right-drag: draws a zooming box and zooms the viewing window.

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGL.CcpnGLItem(parentItem=None)[source]

Bases: object

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGL.CcpnGLWidget(strip=None, mainWindow=None, stripIDLabel=None, antiAlias=4)[source]

Bases: PyQt5.QtWidgets.QOpenGLWidget

Widget to handle all visible spectra/peaks/integrals/multiplets

AXISLOCKEDBUTTON = True
AXISLOCKEDBUTTONALLSTRIPS = True
AXIS_INSIDE = False
AXIS_LINE = 7
AXIS_MARGINBOTTOM = 25
AXIS_MARGINRIGHT = 50
AXIS_MOUSEYOFFSET = 32
AXIS_OFFSET = 3
INVERTXAXIS = True
INVERTYAXIS = True
SHOWSPECTRUMONPHASING = True
SPECTRUMXZOOM = 10.0
SPECTRUMYZOOM = 10.0
XAXES = ['[ppm]', '[Hz]', '[pnts]']
YAXES = ['[ppm]', '[Hz]', '[pnts]']
YAXISUSEEFORMAT = False
addExternalRegion(values=None, axisCode=None, orientation=None, brush=None, colour='blue', movable=True, visible=True, bounds=None, obj=None, **kwds)[source]
addInfiniteLine(values=None, axisCode=None, orientation=None, brush=None, colour='blue', movable=True, visible=True, bounds=None, obj=None, lineStyle='dashed', lineWidth=1.0)[source]
addRegion(values=None, axisCode=None, orientation=None, brush=None, colour='blue', movable=True, visible=True, bounds=None, obj=None)[source]
property aspectRatioMode

- None, mutable -

property aspectRatios

- None, mutable -

autoRange()[source]
property axesVisible

- None, mutable -

property axisCodes

- None, mutable -

property axisOrder

- None, mutable -

between(val, l, r)[source]
buildAllContours()[source]
buildAxisLabels(refresh=False)[source]
buildCursors()[source]

Build and draw the cursors/doubleCursors

buildGrid()[source]

Build the grids for the mainGrid and the bottom/right axes

buildMarksRulers()[source]
buildMouseCoords(refresh=False)[source]
buildOverlayStrings()[source]
buildRegions()[source]
buildSpectra()[source]
buildStaticTraces()[source]
clearStaticTraces()[source]
close(self) bool[source]
disableTextClientState()[source]
disableTexture()[source]
drawAxisLabels()[source]
drawCursors()[source]

Draw the cursors/doubleCursors

drawDottedCursor()[source]
drawGrid()[source]
drawInfiniteLines()[source]
drawLastCursors()[source]

Draw the cursors/doubleCursors

drawMarksAxisCodes()[source]
drawMarksRulers()[source]
drawMouseCoords()[source]
drawMouseMoveLine()[source]

Draw the line for the middleMouse dragging of peaks

drawOverlayText(refresh=False)[source]

Draw extra information to the screen

drawRegions()[source]
drawSelectionBox()[source]
drawTraces()[source]
emitAllAxesChanged(allStrips=False)[source]

Signal all strips in the spectrumDisplay to refresh Strips will be scaled to the Y-Axis if aspect ratio is set to Locked/Fixed :param allStrips: True/False, if true, apply scaling to all strips; False, ignore the current strip in spectrumDisplay

emitXAxisChanged(allStrips=False, aspectRatios=None)[source]

Signal all strips in the spectrumDisplay to refresh Strips will be scaled to the X-Axis if aspect ratio is set to Locked/Fixed :param allStrips: True/False, if true, apply scaling to all strips; False, ignore the current strip in spectrumDisplay

emitYAxisChanged(allStrips=False, aspectRatios=None)[source]

Signal all strips in the spectrumDisplay to refresh Strips will be scaled to the Y-Axis if aspect ratio is set to Locked/Fixed :param allStrips: True/False, if true, apply scaling to all strips; False, ignore the current strip in spectrumDisplay

enableTextClientState()[source]
enableTexture()[source]
enterEvent(self, QEvent)[source]
exportToPDF(filename='default.pdf', params=None)[source]
exportToPNG(filename='default.png', params=None)[source]
exportToPS(filename='default.ps', params=None)[source]
exportToSVG(filename='default.svg', params=None)[source]
focusInEvent(self, QFocusEvent)[source]
focusOutEvent(self, QFocusEvent)[source]
getAxesVisible()[source]

Get the visibility of the axes

getAxisPosition(axisIndex)[source]
getAxisRegion(axisIndex)[source]

Return the region for visible axisIndex 0/1 (for X/Y) if axis is reversed, the region will be returned as (max, min)

getAxisWidth(axisIndex)[source]
getCurrentCursorCoordinate()[source]
getCurrentDoubleCursorCoordinates()[source]
getMousePosition()[source]

Get the coordinates of the mouse in the window (in ppm) based on the current axes

getObjectsUnderMouse()[source]

Return a list of objects under the mouse position as a dict dict is of the form: {object plural name: list, …}

e.g. {‘peaks’: []}

Current objects returned are: peaks, integrals, multiplets :return: dict of objects

getSmallFont(transparent=False)[source]

Get the current active font

glBlocking()[source]
glKeyPressEvent(aDict)[source]

Process the key events from GLsignals

highlightCurrentStrip(current)[source]
initialiseAxes(strip=None)[source]

setup the correct axis range and padding

initializeGL(self)[source]
keyPressEvent(event: PyQt5.QtGui.QKeyEvent)[source]

Process key events or pass to current strip of required

leaveEvent(self, QEvent)[source]
mainViewHeight()[source]
mainViewSize()[source]

Return the width/height for the mainView of the OpenGL widget

mapMouseToAxis(pnt)[source]
mouseDoubleClickEvent(self, QMouseEvent)[source]
mouseMoveEvent(self, QMouseEvent)[source]
mousePressEvent(self, QMouseEvent)[source]
mousePressIn1DArea(regions)[source]
mousePressInCornerButtons(mx, my)[source]

Check if the mouse has been pressed in the lock button

mousePressInIntegralLists()[source]

Check whether the mouse has been pressed in an integral

mousePressInLabel(mx, my, ty)[source]

Check if the mouse has been pressed in the stripIDlabel

mousePressInRegion(regions)[source]
mousePressInfiniteLine(regions)[source]
mouseReleaseEvent(self, QMouseEvent)[source]
newTrace(position=None)[source]
nextZoom()[source]

Move to the next stored zoom

property orderedAxes

- None, mutable -

paintGL()[source]

Handle the GL painting

previousZoom()[source]

Move to the previous stored zoom

profile(asText=False)

Get the stats of all related calls firing from inside a specific function/method. Add on top of a function/method to profile it. E.g.:

@profile(dirPath=’/myDesktopPath/’) def my function(*args): …

Parameters
  • dirPath – str, dir where to dump the pstat file.

  • asText – bool. Make a pstat copy as a human readable text file.

rebuildTraces()[source]
refreshDevicePixelRatio()[source]

refresh the devicePixelRatio for the viewports

removeExternalRegion(region)[source]
removeInfiniteLine(line)[source]
rescale(rescaleOverlayText=True, rescaleMarksRulers=True, rescaleIntegralLists=True, rescaleRegions=True, rescaleSpectra=True, rescaleStaticHTraces=True, rescaleStaticVTraces=True, rescaleSpectrumLabels=True, rescaleLegend=True)[source]

Change to axes of the view, axis visibility, scale and rebuild matrices when necessary to improve display speed

rescaleMarksRulers()[source]

rescale the marks

rescaleSpectra()[source]
rescaleStaticHTraces()[source]
rescaleStaticTraces()[source]
rescaleStaticVTraces()[source]
resetAllZoom()[source]
resetRangeLimits(allLimits=True)[source]
resetXZoom()[source]
resetYZoom()[source]
resetZoom()[source]
resizeGL(w, h)[source]

Resize event from the openGL architecture

restoreZoom(zoomState=None)[source]

Restore zoom to the last stored zoom zoomState = (axisL, axisR, axisB, axisT)

set3DProjection()[source]
setAxesVisible(rightAxisVisible=True, bottomAxisVisible=False)[source]

Set the visibility of the axes

setAxisPosition(axisIndex, position, rescale=True, update=True)[source]
setAxisRegion(axisIndex, range, rescale=True, update=True)[source]
setAxisWidth(axisIndex, width, rescale=True, update=True)[source]
setBackgroundColour(col, silent=False)[source]

set all background colours in the shaders :param col - vec4, 4 element list e.g.: [0.05, 0.05, 0.05, 1.0], very dark gray

setBottomAxisVisible(axisVisible=True)[source]

Set the visibility of the bottom axis

setClearColor(c)[source]
setColor(c)[source]
setInfiniteLineColour(infLine, colour)[source]
setRightAxisVisible(axisVisible=True)[source]

Set the visibility of the right axis

setStackingMode(value)[source]
setStackingValue(val)[source]
setStripID(name)[source]
setXRegion(axisL=None, axisR=None)[source]
setYRegion(axisT=None, axisB=None)[source]
property showSpectraOnPhasing

- None, mutable -

sign(x)[source]
storeZoom()[source]

Store the current axis values to the zoom stack Sets this to the top of the stack, removing everything after

threadUpdate()[source]
toggleAxes()[source]
toggleShowSpectraOnPhasing()[source]
update(mode=PaintModes.PAINT_ALL)[source]

Update the glWidget with the correct refresh mode

property updateHTrace

- None, mutable -

updateTraces()[source]
property updateVTrace

- None, mutable -

updateVisibleSpectrumViews()[source]
viewRange()[source]
wheelEvent(self, QWheelEvent)[source]
property xUnits

- None, mutable -

property yUnits

- None, mutable -

zoom(xRegion: Tuple[float, float], yRegion: Tuple[float, float])[source]

Zooms strip to the specified region

zoomIn()[source]
zoomOut()[source]
property zoomState

- None, immutable -

zoomX(x1: float, x2: float)[source]

Zooms x axis of strip to the specified region

zoomY(y1: float, y2: float)[source]

Zooms y axis of strip to the specified region

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGL.CcpnTransform3D(*args)[source]

Bases: PyQt5.QtGui.QMatrix4x4

Extension of QMatrix4x4 with some helpful methods added.

inverted(self) Tuple[QMatrix4x4, bool][source]
map(obj)[source]

Extends QMatrix4x4.map() to allow mapping (3, …) arrays of coordinates

matrix(nd=3)[source]

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLABC module

By Functionality:

Zoom and pan:

Left-drag: pans the spectrum.

shift-left-drag: draws a zooming box and zooms the viewing window. shift-middle-drag: draws a zooming box and zooms the viewing window. shift-right-drag: draws a zooming box and zooms the viewing window. Two successive shift-right-clicks: define zoombox control-right click: reset the zoom

Peaks:

Left-click: select peak near cursor in a spectrum display, deselecting others Control(Cmd)-left-click: (de)select peak near cursor in a spectrum display, adding/removing to selection. Control(Cmd)-left-drag: selects peaks in an area specified by the dragged region. Middle-drag: Moves a selected peak. Control(Cmd)-Shift-Left-click: picks a peak at the cursor position, adding to selection Control(Cmd)-shift-left-drag: picks peaks in an area specified by the dragged region.

Others:

Right-click: raises the context menu.

By Mouse button:

Left-click: select peak near cursor in a spectrum display, deselecting others Control(Cmd)-left-click: (de)select peak near cursor in a spectrum display, adding/removing to selection. Control(Cmd)-Shift-Left-click: picks a peak at the cursor position, adding to selection

Left-drag: pans the spectrum. shift-left-drag: draws a zooming box and zooms the viewing window. Control(Cmd)-left-drag: selects peaks in an area specified by the dragged region. Control(Cmd)-shift-left-drag: picks peaks in an area specified by the dragged region.

shift-middle-drag: draws a zooming box and zooms the viewing window.

Right-click: raises the context menu. control-right click: reset the zoom Two successive shift-right-clicks: define zoombox

shift-right-drag: draws a zooming box and zooms the viewing window.

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLABC.CcpnGLWidgetABC(parent=None, mainWindow=None, **kwds)[source]

Bases: PyQt5.QtWidgets.QOpenGLWidget

Widget to handle all visible spectra/peaks/integrals/multiplets

AXISLOCKEDBUTTON = True
AXISLOCKEDBUTTONALLSTRIPS = True
AXIS_INSIDE = False
AXIS_LINE = 7
AXIS_MARGINBOTTOM = 25
AXIS_MARGINRIGHT = 50
AXIS_MOUSEYOFFSET = 32
AXIS_OFFSET = 3
INVERTXAXIS = True
INVERTYAXIS = True
SHOWSPECTRUMONPHASING = True
SPECTRUMXZOOM = 10.0
SPECTRUMYZOOM = 10.0
XAXES = ['[ppm]', '[Hz]', '[pnts]']
YAXES = ['[ppm]', '[Hz]', '[pnts]']
YAXISUSEEFORMAT = False
close(self) bool[source]
disableTexture()[source]
enableTexture()[source]
initializeGL(self)[source]
paintGL(self)[source]
refreshDevicePixelRatio()[source]

refresh the devicePixelRatio for the viewports

resetRangeLimits(allLimits=True)[source]
setBackgroundColour(col, silent=False)[source]

set all background colours in the shaders :param col - vec4, 4 element list e.g.: [0.05, 0.05, 0.05, 1.0], very dark gray

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLArrays module

GL routines used to draw vertex buffer objects (VBOs)

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLArrays.GLLabelArray(GLContext=None, spectrumView=None, objListView=None)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLArrays.GLVertexArray

Array class to handle labels.

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLArrays.GLSymbolArray(GLContext=None, spectrumView=None, objListView=None)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLArrays.GLVertexArray

Array class to handle symbols.

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLArrays.GLVertexArray(numLists=1, renderMode=0, refreshMode=0, blendMode=False, drawMode=GL_LINES, fillMode=None, dimension=3, GLContext=None, clearArrays=True)[source]

Bases: object

clearArrays()[source]

Clear and reset all arrays

clearVertices()[source]

Clear the vertex array only.

defineAliasedIndexVBO()[source]

Define the buffers on the graphics card. Indexed mode with vertices and colour. If undefined, create new VBOs otherwise overwrite existing.

Includes:

vertices: (x, y) * vertices colors: (R, G, B, a) * vertices indices: array of indexes into vertex list _ attribs: array of float for defining aliasPosition

defineIndexVBO()[source]

Define the buffers on the graphics card. Indexed mode with vertices and colour. If undefined, create new VBOs otherwise overwrite existing.

Includes:

vertices: (x, y) * vertices colors: (R, G, B, a) * vertices indices: array of indexes into vertex list _ attribs: array of float for defining aliasPosition

defineTextArrayVBO()[source]

Define the buffers on the graphics card. Indexed mode with vertices/colours/texture co-ordinates/attribs. If undefined, create new VBOs otherwise overwrite existing.

Includes:

vertices: (x, y) * vertices colors: (R, G, B, a) * vertices indices: array of indexes into vertex list texcoords (u, v) * vertices attribs (a, b) * vertices

defineVertexColorVBO()[source]

Define the buffers on the graphics card. Not indexed mode with vertices and colour. If undefined, create new VBOs otherwise overwrite existing.

Includes:

vertices: (x, y) * vertices colors: (R, G, B, a) * vertices

drawAliasedIndexArrayNoColor()[source]

Draw the vertex buffers in indexed array mode. Arrays are copied from main memory each time. Indexed mode using only vertices, no colour.

drawAliasedIndexVBO()[source]

Draw the vertex buffers in indexed array mode. Arrays are drawn from buffers already bound to graphics card memory. Indexed mode with vertices and colour.

drawIndexArray()[source]

Draw the vertex buffers in indexed array mode. Arrays are copied from main memory each time. Indexed with vertices and colour.

drawIndexArrayNoColor()[source]

Draw the vertex buffers in indexed array mode. Arrays are copied from main memory each time. Indexed mode using only vertices, no colour.

drawIndexVBO()[source]

Draw the vertex buffers in indexed array mode. Arrays are drawn from buffers already bound to graphics card memory. Indexed mode with vertices and colour.

drawTextArray()[source]

Draw the texture buffers in indexed array mode. Arrays are copied from main memory each time. Facilitates drawing of fonts.

drawTextArrayVBO(enableClientState=False, disableClientState=False)[source]

Draw the texture buffers in indexed array mode. Arrays are drawn from buffers already bound to graphics card memory. Indexed mode with vertices, colour, texture and attributes.

drawVertexColor()[source]

Draw the vertex buffers in direct array mode. Arrays are copied from main memory each time. Only vertices and colour required.

drawVertexColorVBO()[source]

Draw the vertex buffers in direct array mode. Arrays are drawn from buffers already bound to graphics card memory. Only vertices and colour required.

drawVertexNoColor()[source]

Draw the vertex buffers in direct array mode. Arrays are copied from main memory each time. Only vertices are required.

initialise(numLists=1, renderMode=0, refreshMode=0, blendMode=False, drawMode=GL_LINES, fillMode=None, dimension=3, GLContext=None, clearArrays=True)[source]

Initialise the vertexArray object.

updateAliasedIndexVBO()[source]

Update the buffers on the graphics card. Indexed mode with vertices and colour.

updateAliasedIndexVBOIndices()[source]

Update the buffers on the graphics card. Only the index array.

updateIndexVBO()[source]

Update the buffers on the graphics card. Indexed mode with vertices and colour.

updateIndexVBOIndices()[source]

Update the buffers on the graphics card. Only the index array.

updateTextArrayVBO()[source]

Update the buffers on the graphics card. Indexed mode with vertices, colour, texture and attributes.

updateTextArrayVBOAttribs()[source]

Update the buffers on the graphics card. Only update the attributes used for moving text.

updateTextArrayVBOColour()[source]

Update the buffers on the graphics card. Only update the colour, used for highlighting text.

updateVertexColorVBO()[source]

Update the buffers on the graphics card. Direct mode with vertices and colour.

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLDefs module

Module Documentation here

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLDefs.AxisModes(value)[source]

Bases: ccpn.util.LabelledEnum.LabelledEnum

An enumeration.

AXIS_DEFAULT = 1
AXIS_FULLHEIGHT = 2
AXIS_OFF = 0
class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLDefs.CursorFrameCounterModes(value)[source]

Bases: ccpn.util.LabelledEnum.LabelledEnum

An enumeration.

CURSOR_DEFAULT = 0
CURSOR_DRAWLAST = 1
CURSOR_DRAWNEXT = 2
class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLDefs.PaintModes(value)[source]

Bases: enum.Enum

An enumeration.

PAINT_ALL = 1
PAINT_MOUSEONLY = 2
PAINT_NONE = 0

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLExport module

Code for exporting OpenGL stripDisplay to pdf and svg files.

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLExport.Clipped_Flowable(width=0.0, height=0.0, mainPlot=None, mainDim=None)[source]

Bases: reportlab.platypus.flowables.Flowable

draw()[source]
class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLExport.GLExporter(parent, strip, filename, params)[source]

Bases: object

Class container for exporting OpenGL stripDisplay to a file or object

between(val, l, r)[source]
clipLine(_parent, subjectPolygon)[source]

Apply Sutherland-Hodgman algorithm for clipping polygons

clipPoly(_parent, subjectPolygon)[source]

Apply Sutherland-Hodgman algorithm for clipping polygons

lineFit(_parent, lineList, x=0.0, y=0.0, width=0.0, height=0.0, checkIntegral=False)[source]
lineVisible(_parent, lineList, x=0.0, y=0.0, width=0.0, height=0.0, checkIntegral=False)[source]

return the list of visible lines

pointVisible(_parent, lineList, x=0.0, y=0.0, width=0.0, height=0.0)[source]

return true if the line has visible endpoints

report()[source]

Return the current report for the GL widget. This is the vector image for the current strip containing the GL widget, it is a reportlab Flowable type object that can be added to reportlab documents. :return reportlab.platypus.Flowable:

writePDFFile()[source]

Output a PDF file for the GL widget.

writePNGFile()[source]

Output a PNG file for the GL widget.

writePSFile()[source]

Output a PS file for the GL widget.

writeSVGFile()[source]

Output an SVG file for the GL widget.

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLExport.alphaClip(value)[source]

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLFonts module

Module Documentation here

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLFonts.CcpnGLFont(fileName=None, base=0, fontTransparency=None, activeTexture=0, scale=None)[source]

Bases: object

closestFont(size)[source]

Get the closest font to the required size

get_kerning(fromChar, prevChar, glyphs)[source]

Get the kerning required between the characters

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLFonts.GLGlyphTuple(GlyphXpos, GlyphYpos, GlyphWidth, GlyphHeight, GlyphXoffset, GlyphYoffset, GlyphOrigW, GlyphOrigH, GlyphKerns, GlyphTX0, GlyphTY0, GlyphTX1, GlyphTY1, GlyphPX0, GlyphPY0, GlyphPX1, GlyphPY1)

Bases: tuple

GlyphHeight

Alias for field number 3

GlyphKerns

Alias for field number 8

GlyphOrigH

Alias for field number 7

GlyphOrigW

Alias for field number 6

GlyphPX0

Alias for field number 13

GlyphPX1

Alias for field number 15

GlyphPY0

Alias for field number 14

GlyphPY1

Alias for field number 16

GlyphTX0

Alias for field number 9

GlyphTX1

Alias for field number 11

GlyphTY0

Alias for field number 10

GlyphTY1

Alias for field number 12

GlyphWidth

Alias for field number 2

GlyphXoffset

Alias for field number 4

GlyphXpos

Alias for field number 0

GlyphYoffset

Alias for field number 5

GlyphYpos

Alias for field number 1

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLFonts.GLString(text=None, font=None, obj=None, colour=(1.0, 1.0, 1.0, 1.0), x=0.0, y=0.0, ox=0.0, oy=0.0, angle=0.0, width=None, height=None, GLContext=None, blendMode=True, clearArrays=False, serial=None, pixelScale=None, alias=0)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLArrays.GLVertexArray

buildString()[source]

Build the string

drawTextArray()[source]

Draw text array with textures MUST be called inside GL current context, i.e., after GL.makeCurrent or inside initializeGL, paintGL

drawTextArrayVBO(enableClientState=False, disableClientState=False)[source]

Draw text array with textures and VBO MUST be called inside GL current context, i.e., after GL.makeCurrent or inside initializeGL, paintGL

setStringColour(col)[source]
setStringHexColour(hexColour, alpha=1.0)[source]
setStringOffset(attrib)[source]

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLGlobal module

Module Documentation here

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLGlobal.AliasedPixelShader[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLGlobal.PixelShader

Pixel shader for aliased peak plotting

Uses the projection/viewport matrices to calculate the gl_Position, and passes through the gl_Color to set the pixel. gl_Color is modified for peaks at different aliased positions

CCPNSHADER = True
fragmentShader = '\n        #version 120\n\n        uniform vec4  background;\n        uniform float aliasShade;\n        uniform int   aliasEnabled;\n        varying vec4  _FC;\n        varying float _aliased;\n        \n        void main()\n        {\n            // set the pixel colour\n            if (abs(_aliased) < 0.5) {\n                gl_FragColor = _FC;\n            }\n            else if (aliasEnabled != 0) {\n                // set the colour if aliasEnabled (set opaque or set the alpha)\n                gl_FragColor = (aliasShade * _FC) + (1 - aliasShade) * background;\n                //gl_FragColor = vec4(_FC.xyz, _FC.w * aliasShade);\n            }\n            else {\n                // skip the pixel\n                discard;\n            }\n        }\n        '
name = 'aliasedPixelShader'
setAliasEnabled(aliasEnabled)[source]

Set the alias enabled: bool True/False Used to determine visibility of aliased peaks, using aliasShade False = disable visibility of aliased peaks :param aliasEnabled: bool

setAliasPosition(aliasX, aliasY)[source]

Set the alias position: Used to calculate whether the current peak is in the aliased region :param aliasX: X alias region :param aliasY: Y alias region

setAliasShade(aliasShade)[source]

Set the alias shade: a single float in range [0.0, 1.0] Used to determine visibility of aliased peaks, 0.0 -> background colour :param aliasShade: single float32

setBackground(colour)[source]

Set the background colour, for use with the solid text colour is tuple/list of 4 float/np.float32 elements in range 0.0-1.0 values outside range will be clipped :param colour: tuple/list

vertexShader = '\n        #version 120\n\n        uniform   mat4  pMatrix;\n        uniform   mat4  mvMatrix;\n        attribute float alias;\n        uniform   float aliasPosition;\n        varying   float _aliased;\n        varying   vec4  _FC;\n        \n        void main()\n        {\n            // calculate the position, set shading value\n            gl_Position = pMatrix * mvMatrix * vec4(gl_Vertex.xy, 0.0, 1.0);\n            _FC = gl_Color;\n            _aliased = (aliasPosition - alias);\n        }\n        '
class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLGlobal.AliasedTextShader[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLGlobal.TextShader

Text shader for displaying text in aliased regions

Shader for plotting text, uses a billboard technique by using an _offset to determine pixel positions Colour of the pixel is set by glColorPointer array. Alpha value is grabbed from the texture to give anti-aliasing and modified by the ‘alpha’ attribute to affect overall transparency.

CCPNSHADER = True
fragmentShader = '\n        #version 120\n\n        uniform sampler2D texture;\n        uniform vec4      background;\n        uniform int       blendEnabled;\n        uniform float     alpha;\n        uniform float     aliasShade;\n        uniform int       aliasEnabled;\n        varying vec4      _FC;\n        varying vec2      _texCoord;\n        vec4              _texFilter;\n        float             _opacity;\n        varying float     _aliased;\n        \n        void main()\n        {\n            _texFilter = texture2D(texture, _texCoord);\n            // colour for blending enabled\n            _opacity = _texFilter.w * alpha;\n                        \n            // set the pixel colour\n            if (abs(_aliased) < 0.5)\n                if (blendEnabled != 0)\n                    // multiply the character fade by the color fade to give the actual transparency\n                    gl_FragColor = vec4(_FC.xyz, _FC.w * _opacity);\n                \n                else   \n                    // plot a background box around the character\n                    gl_FragColor = vec4((_FC.xyz * _opacity) + (1.0 - _opacity) * background.xyz, 1.0);\n\n            else if (aliasEnabled != 0) {\n                // modify the opacity\n                _opacity *= aliasShade;\n                \n                if (blendEnabled != 0)\n                    // multiply the character fade by the color fade to give the actual transparency\n                    gl_FragColor = vec4(_FC.xyz, _FC.w * _opacity);\n    \n                else   \n                    // plot a background box around the character\n                    gl_FragColor = vec4((_FC.xyz * _opacity) + (1.0 - _opacity) * background.xyz, 1.0);\n            }\n            else\n                // skip the pixel\n                discard;\n        }\n        '
name = 'aliasedTextShader'
setAliasEnabled(aliasEnabled)[source]

Set the alias enabled: bool True/False Used to determine visibility of aliased peaks, using aliasShade False = disable visibility of aliased peaks :param aliasEnabled: bool

setAliasPosition(aliasX, aliasY)[source]

Set the alias position: Used to calculate whether the current peak is in the aliased region :param aliasX: X alias region :param aliasY: Y alias region

setAliasShade(aliasShade)[source]

Set the alias shade: a single float in range [0.0, 1.0] Used to determine visibility of aliased peaks, 0.0 -> background colour :param aliasShade: single float32

setMVMatrix(matrix)[source]

Set the contents of viewport mvMatrix :param matrix: consisting of 16 float32 elements

vertexShader = '\n        #version 120\n\n        uniform   mat4  pTexMatrix;\n        uniform   mat4  mvMatrix;\n        uniform   vec4  axisScale;\n        uniform   vec2  stackOffset;\n        uniform   float aliasPosition;\n        varying   float _aliased;\n        varying   vec4  _FC;\n        varying   vec2  _texCoord;\n        attribute vec3  _offset;\n\n        void main()\n        {\n            gl_Position = pTexMatrix * mvMatrix * ((gl_Vertex * axisScale) + vec4(_offset.xy + stackOffset, 0.0, 0.0));\n            //gl_Position = pTexMatrix * mvMatrix * (gl_Vertex + vec4(_offset.xy + stackOffset, 0.0, 0.0));\n\n            _texCoord = gl_MultiTexCoord0.st;\n            _FC = gl_Color;\n            _aliased = (aliasPosition - _offset.z);\n        }\n        '
class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLGlobal.GLGlobalData(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QWidget

Class to handle the common information between all the GL widgets

bindFonts()[source]

Bind the font textures to the GL textures MUST be called inside GL current context, i.e., after GL.makeCurrent or inside initializeGL, paintGL

initialiseShaders()[source]

Initialise the shaders

loadFonts()[source]

Load all the necessary GLFonts

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLGlobal.PixelShader[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLShader.ShaderProgramABC

Pixel shader for contour plotting

A very simple shader, uses the projection/viewport matrices to calculate the gl_Position, and passes through the gl_Color to set the pixel.

CCPNSHADER = True
attributes = {'mvMatrix': (16, <class 'numpy.float32'>), 'pMatrix': (16, <class 'numpy.float32'>)}
fragmentShader = '\n        #version 120\n\n        varying vec4  _FC;\n\n        void main()\n        {\n            // set the pixel colour\n            gl_FragColor = _FC;\n        }\n        '
name = 'pixelShader'
setMVMatrix(matrix)[source]

Set the contents of viewport mvMatrix :param matrix: consisting of 16 float32 elements

setPMatrix(matrix)[source]

Set the contents of projection pMatrix :param matrix: consisting of 16 float32 elements

vertexShader = '\n        #version 120\n\n        uniform mat4 pMatrix;\n        uniform mat4 mvMatrix;\n        varying vec4 _FC;\n\n        void main()\n        {\n            // calculate the position\n            gl_Position = pMatrix * mvMatrix * gl_Vertex;\n            _FC = gl_Color;\n        }\n        '
class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLGlobal.TextShader[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLShader.ShaderProgramABC

Main Text shader

Shader for plotting text, uses a billboard technique by using an _offset to determine pixel positions Colour of the pixel is set by glColorPointer array. Alpha value is grabbed from the texture to give anti-aliasing and modified by the ‘alpha’ attribute to affect overall transparency.

CCPNSHADER = True
attributes = {'alpha': (1, <class 'numpy.float32'>), 'axisScale': (4, <class 'numpy.float32'>), 'background': (4, <class 'numpy.float32'>), 'blendEnabled': (1, <class 'numpy.uint32'>), 'pTexMatrix': (16, <class 'numpy.float32'>), 'stackOffset': (2, <class 'numpy.float32'>), 'texture': (1, <class 'numpy.uint32'>)}
fragmentShader = '\n        #version 120\n\n        uniform sampler2D texture;\n        uniform vec4      background;\n        uniform int       blendEnabled;\n        uniform float     alpha;\n        varying vec4      _FC;\n        varying vec2      _texCoord;\n        vec4              _texFilter;\n        float             _opacity;\n\n        void main()\n        {\n            _texFilter = texture2D(texture, _texCoord);\n            // colour for blending enabled\n            _opacity = _texFilter.w * alpha;\n\n            if (blendEnabled != 0)\n                // multiply the character fade by the color fade to give the actual transparency\n                gl_FragColor = vec4(_FC.xyz, _FC.w * _opacity);\n\n            else   \n                // plot a background box around the character\n                gl_FragColor = vec4((_FC.xyz * _opacity) + (1.0 - _opacity) * background.xyz, 1.0);\n        }\n        '
name = 'textShader'
setAlpha(alpha)[source]

Set the alpha value, a multiplier to the transparency 0 - completely transparent; 1 - solid alpha to clipped to value [0.0, 1.0] :param alpha: single float32

setAxisScale(axisScale)[source]

Set the axisScale values :param axisScale: consisting of 4 float32 elements

setBackground(colour)[source]

Set the background colour, for use with the solid text :param colour: consisting of 4 float32 elements

setBlendEnabled(blendEnabled)[source]

Set the blend enabled flag, determines whether the characters are surrounded with a solid background block :param blendEnabled: single uint32

setPTexMatrix(matrix)[source]

Set the contents of projection pTexMatrix :param matrix: consisting of 16 float32 elements

setStackOffset(stackOffset)[source]

Set the stacking value for the 1d widget :param stackOffset: consisting of 2 float32 elements, the stacking offset in thje X, Y dimensions

setTextureID(textureID)[source]

Set the texture ID, determines which texture the text bitmaps are taken from :param textureID: uint32

vertexShader = '\n        #version 120\n\n        uniform   mat4  pTexMatrix;\n        uniform   vec4  axisScale;\n        uniform   vec2  stackOffset;\n        varying   vec4  _FC;\n        varying   vec2  _texCoord;\n        attribute vec3  _offset;\n        \n        void main()\n        {\n            gl_Position = pTexMatrix * ((gl_Vertex * axisScale) + vec4(_offset.xy + stackOffset, 0.0, 0.0));\n\n            _texCoord = gl_MultiTexCoord0.st;\n            _FC = gl_Color;\n        }\n        '
ccpn.ui.gui.lib.OpenGL.CcpnOpenGLGlobal.getAliasSetting(aliasX, aliasY)[source]

Return the alias setting for alias value (aliasX, aliasY) for insertion into shader

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLIntegral module

Module Documentation here

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLIntegral.GLintegral1dLabelling(parent=None, strip=None, name=None, enableResize=False)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLIntegral.GLintegralNdLabelling

Class to handle symbol and symbol labelling for 1d displays

objIsInVisiblePlanes(spectrumView, obj)[source]

Get the current object is in visible planes settings

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLIntegral.GLintegralListMethods[source]

Bases: object

Class of methods common to 1d and Nd integrals This is added to the Integral Classes below and doesn’t require an __init__

appendExtraIndices(*args)[source]

Add extra indices to the index list

appendExtraVertices(*args)[source]

Add extra vertices to the vertex list

extraIndicesCount(integral)[source]

Calculate how many indices to add

extraVerticesCount(integral)[source]

Calculate how many vertices to add

getLabelling(obj, labelType)[source]

get the object label based on the current labelling method

insertExtraIndices(*args)[source]

Insert extra indices into the vertex list

insertExtraVertices(*args)[source]

Insert extra vertices into the vertex list

listViews(integralList)[source]

Return the integralListViews attached to the integralList

objectList(obj)[source]

return the integralList attached to the integral

objects(obj)[source]

return the integrals attached to the object

rescaleIntegralLists()[source]
class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLIntegral.GLintegralNdLabelling(parent=None, strip=None, name=None, enableResize=False)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLLabelling.GL1dLabelling, ccpn.ui.gui.lib.OpenGL.CcpnOpenGLIntegral.GLintegralListMethods, ccpn.ui.gui.lib.OpenGL.CcpnOpenGLLabelling.GLLabelling

Class to handle symbol and symbol labelling for Nd displays

drawSymbolRegions(spectrumSettings)[source]
drawSymbols(spectrumSettings, shader=None, stackingMode=True)[source]

Draw the symbols to the screen

objIsInVisiblePlanes(spectrumView, obj)[source]

Get the current object is in visible planes settings

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLLabelling module

Classes to handle drawing of symbols and symbol labelling to the openGL window Currently this is peaks and multiplets

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLLabelling.GL1dLabelling[source]

Bases: object

Class to handle symbol and symbol labelling for generic 1d displays

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLLabelling.GLLabelling(parent=None, strip=None, name=None, enableResize=False)[source]

Bases: object

Base class to handle symbol and symbol labelling

LENSQ = 9
LENSQ2 = 18
LENSQ4 = 36
POINTCOLOURS = 9
buildLabels()[source]
buildSymbols()[source]
drawLabels(spectrumView)[source]

Draw the labelling to the screen

drawSymbols(spectrumView)[source]

Draw the symbols to the screen

enableResize(value)[source]

enable resizing for labelling

objIsInVisiblePlanesClear()[source]

clear the object visibility cache for each peak in the spectrumViews

objIsInVisiblePlanesRemove(spectrumView, obj)[source]

Remove a single object from the cache

objIsInVisiblePlanesReset()[source]

Reset the object visibility cache

rescale()[source]
setListViews(spectrumViews)[source]

Return a list of tuples containing the visible lists and the containing spectrumView

updateAllSymbols()[source]

Respond to update all notifier

updateHighlightSymbols()[source]

Respond to an update highlight notifier and update the highlighted symbols/labels

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLMultiplet module

Module Documentation here

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLMultiplet.GLmultiplet1dLabelling(parent=None, strip=None, name=None, enableResize=False)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLLabelling.GL1dLabelling, ccpn.ui.gui.lib.OpenGL.CcpnOpenGLMultiplet.GLmultipletNdLabelling

Class to handle symbol and symbol labelling for 1d displays

appendExtraVertices(drawList, pIndex, multiplet, p0, colour, fade)[source]

Add extra vertices to the vertex list

insertExtraVertices(drawList, vertexPtr, pIndex, multiplet, p0, colour, fade)[source]

insert extra vertices into the vertex list

objIsInVisiblePlanes(spectrumView, obj)[source]

Get the current object is in visible planes settings

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLMultiplet.GLmultipletListMethods[source]

Bases: object

Class of methods common to 1d and Nd multiplets This is added to the Multiplet Classes below and doesn’t require an __init__

LENSQ = 17
LENSQ2 = 34
LENSQ4 = 68
POINTCOLOURS = 17
appendExtraIndices(drawList, index, multiplet)[source]

Add extra indices to the index list Returns the number of unique indices NOT the length of the appended list

appendExtraVertices(drawList, pIndex, multiplet, p0, colour, fade)[source]

Add extra vertices to the vertex list

extraIndicesCount(multiplet)[source]

Calculate how many indices to add Returns the size of array needed to hold the indices, see insertExtraIndices

extraVerticesCount(multiplet)[source]

Calculate how many vertices to add

getLabelling(obj, labelType)[source]

get the object label based on the current labelling method

insertExtraIndices(drawList, indexPtr, index, multiplet)[source]

insert extra indices into the index list Returns (len, ind)

len: length of the inserted array ind: number of unique indices

insertExtraVertices(drawList, vertexPtr, pIndex, multiplet, p0, colour, fade)[source]

insert extra vertices into the vertex list

listViews(multipletList)[source]

Return the multipletListViews attached to the multipletList

objectList(obj)[source]

return the multipletList attached to the multiplet

objects(obj)[source]

return the multiplets attached to the object

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLMultiplet.GLmultipletNdLabelling(parent=None, strip=None, name=None, enableResize=False)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLMultiplet.GLmultipletListMethods, ccpn.ui.gui.lib.OpenGL.CcpnOpenGLLabelling.GLLabelling

Class to handle symbol and symbol labelling for Nd displays

objIsInVisiblePlanes(spectrumView, multiplet, viewOutOfPlaneMultiplets=True)[source]

Return whether in plane or flanking plane

Parameters
  • spectrumView – current spectrumView containing multiplets

  • multiplet – multiplet to test

  • viewOutOfPlaneMultiplets – whether to show outofplane multiplets, defaults to true

Returns

inPlane - true/false inFlankingPlane - true/false type of outofplane - currently 0/1/2 indicating whether normal, infront or behind fade for colouring

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLNotifier module

A Small class to control the communication of information across strips. E.g. Mouse co-ordinates

Signals to other connected strips to rescale on axis changes Signal other strips to update

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLNotifier.GLNotifier(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QWidget

Class to control the communication between different strips

GLADD1DPHASING = 'add1DPhasing'
GLALLCONTOURS = 'updateAllContours'
GLALLINTEGRALS = 'glAllIntegrals'
GLALLMULTIPLETS = 'glAllMultiplets'
GLALLPEAKS = 'glAllPeaks'
GLANY = 'glUpdateAny'
GLASPECTRATIOS = 'aspectRatios'
GLAXES = 'glUpdateAxes'
GLAXISVALUES = 'axisValues'
GLBOTTOMAXISVALUE = 'bottomAxis'
GLCLEARPHASING = 'clearPhasing'
GLCURSOR = 'glUpdateCursor'
GLDATA = 'glData'
GLGRID = 'glUpdateGrid'
GLHIGHLIGHTINTEGRALS = 'glHighlightIntegrals'
GLHIGHLIGHTMULTIPLETS = 'glHighlightMultiplets'
GLHIGHLIGHTPEAKS = 'glHighlightPeaks'
GLINTEGRALLISTLABELS = 'glUpdateIntegralListLabels'
GLINTEGRALLISTS = 'glUpdateIntegralLists'
GLKEY = 'key'
GLLEFTAXISVALUE = 'leftAxis'
GLMAINWINDOW = 'mainWindow'
GLMARKS = 'glUpdateMarks'
GLMODIFIER = 'modifier'
GLMOUSECOORDS = 'mouseCoords'
GLMOUSEMOVEDDICT = 'mouseMovedict'
GLMULTIPLETLISTLABELS = 'glUpdateMultipletListLabels'
GLMULTIPLETLISTS = 'glUpdateMultipletLists'
GLPEAKLISTLABELS = 'glUpdatePeakListLabels'
GLPEAKLISTS = 'glUpdatePeakLists'
GLPEAKNOTIFY = 'glPeakNotify'
GLPREFERENCES = 'glPreferences'
GLRESCALE = 'glRescale'
GLRIGHTAXISVALUE = 'rightAxis'
GLSOURCE = 'source'
GLSPECTRUMDISPLAY = 'spectrumDisplay'
GLSTRIP = 'strip'
GLSTRIPAXES = 'stripAxes'
GLSTRIPCOLUMN = 'stripColumn'
GLSTRIPROW = 'stripRow'
GLSTRIPZOOMALL = 'stripZoomAll'
GLTARGETS = 'glTargets'
GLTOPAXISVALUE = 'topAxis'
GLTRIGGERS = 'glTriggers'
GLUPDATEPIVOT = 'updatePivot'
GLVALUES = 'glValues'
emitEvent(source=None, strip=None, display=None, targets=[], triggers=[], values={})[source]
emitEventToSpectrumDisplay(source=None, strip=None, display=None, targets=[], triggers=[], values={})[source]
emitPaintEvent(source=None)[source]
glAllAxesChanged
glAxisLockChanged
glAxisUnitsChanged
glEvent
glKeyEvent
glMouseMoved
glSymbolsChanged
glXAxisChanged
glYAxisChanged

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLPeak module

Module Documentation here

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLPeak.GLpeak1dLabelling(parent=None, strip=None, name=None, enableResize=False)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLLabelling.GL1dLabelling, ccpn.ui.gui.lib.OpenGL.CcpnOpenGLPeak.GLpeakNdLabelling

Class to handle symbol and symbol labelling for 1d peak displays

objIsInVisiblePlanes(spectrumView, obj)[source]

Get the current object is in visible planes settings

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLPeak.GLpeakListMethods[source]

Bases: object

Class of methods common to 1d and Nd peaks This is added to the Peak Classes below and doesn’t require an __init__

appendExtraIndices(drawList, index, obj)[source]

Add extra indices to the index list

appendExtraVertices(*args)[source]

Add extra vertices to the vertex list

extraIndicesCount(obj)[source]

Calculate how many indices to add

extraVerticesCount(obj)[source]

Calculate how many vertices to add

getLabelling(obj, labelType)[source]

Get the object label based on the current labelling method For peaks, this is constructed from the pids of the attached nmrAtoms

insertExtraIndices(*args)[source]

Insert extra indices into the vertex list

insertExtraVertices(*args)[source]

Insert extra vertices into the vertex list

listViews(peakList)[source]

Return the peakListViews attached to the peakList

objectList(obj)[source]

return the peakList attached to the peak

objects(obj)[source]

return the peaks attached to the object

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLPeak.GLpeakNdLabelling(parent=None, strip=None, name=None, enableResize=False)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLPeak.GLpeakListMethods, ccpn.ui.gui.lib.OpenGL.CcpnOpenGLLabelling.GLLabelling

Class to handle symbol and symbol labelling for Nd displays

objIsInVisiblePlanes(spectrumView, peak, viewOutOfPlanePeaks=True)[source]

Return whether in plane or flanking plane

Parameters
  • spectrumView – current spectrumView containing peaks

  • peak – peak to test

  • viewOutOfPlanePeaks – whether to show outofplane peaks, defaults to true

Returns

inPlane - true/false inFlankingPlane - true/false type of outofplane - currently 0/1/2 indicating whether normal, infront or behind fade for colouring

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLSandbox module

Module Documentation here

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLShader module

Module containing functions for defining GLSL shaders.

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLShader.ShaderProgramABC[source]

Bases: object

Class defining a GL shader program A shader is defined by the following objects vertexShader, a string object containg the code to be compiled for the vertex shader. e.g.

vertexShader = ‘’’

#version 120

varying vec4 _FC;

void main() {

_FC = gl_Color;

fragmentShader is similarly defined

attributes is a list of the attributes that can be accessed from the shader e.g.

attributes = {‘pMatrix’(16, np.float32),

}

pMatrix is a block of 16 np.float32 objects

Version Tags for OpenGL and GLSL Versions OpenGL GLSL #version tag 1.2 none none 2.0 1.10.59 110 2.1 1.20.8 120 <- should be the lowest needed 3.0 1.30.10 130 3.1 1.40.08 140 3.2 1.50.11 150 3.3 3.30.6 330 4.0 4.00.9 400 4.1 4.10.6 410 4.2 4.20.6 420 4.3 4.30.6 430

(On MacOS, anything above 2.1 causes problems)

CCPNSHADER = False
attributeLocation(name)[source]

Function to get location of an OpenGL attribute variable

Parameters

name – String, name of the variable for which location is to be returned

Returns

int; integer describing location

attributes = {}
fragmentShader = None
makeCurrent()[source]

Make self the current shader

property name

- None, immutable - Return the name of the shaderProgramABC instance

setGLUniform1f(uniformLocation=None, value=None)[source]

Set a single float32 attribute in the shader

setGLUniform1i(uniformLocation=None, value=None)[source]

Set a single uint32 attribute in the shader

setGLUniform2fv(uniformLocation=None, count=1, value=None)[source]

Set a 2x1 uint32 vector in the shader

setGLUniform4fv(uniformLocation=None, count=1, value=None)[source]

Set a 4x1 float32 vector in the shader

setGLUniform4iv(uniformLocation=None, count=1, value=None)[source]

Set a 4x1 uint32 vector in the shader

setGLUniformMatrix4fv(uniformLocation=None, count=1, transpose=GL_FALSE, value=None)[source]

Set a 4x4 float32 matrix in the shader

setProjectionAxes(attMatrix, left, right, bottom, top, near, far)[source]

Set the contents of the projection matrix

setViewportMatrix(viewMatrix, left, right, bottom, top, near, far)[source]

Set the contents of the viewport matrix

uniformLocation(name)[source]

Function to get location of an OpenGL uniform variable

Parameters

name – String, name of the variable for which location is to be returned

Returns

int; integer describing location

vertexShader = None

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLSimpleLabels module

Module Documentation here

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLSimpleLabels.GLSimpleLegend(parent=None, strip=None, name=None, resizeGL=False, blendMode=False, drawMode=GL_LINES, dimension=2)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLSimpleLabels.GLSimpleStrings

Class to handle drawing the legend to the screen

addString(obj, position=(0, 0), axisCodes=None, colour='#FF0000', alpha=1.0, lock=0, serial=0)[source]

Add a new string to the list

buildStrings()[source]
drawStrings()[source]
objectInstance(obj)[source]

return the object instance to insert into the string To be subclassed as required

objectSettings(string, obj)[source]

Set up class specific settings for the new string To be subclassed as required

objectText(obj)[source]

return the string to be used for the label To be subclassed as required

rescale()[source]

rescale the objects

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLSimpleLabels.GLSimpleStrings(parent=None, strip=None, name=None, resizeGL=False, blendMode=False, drawMode=GL_LINES, dimension=2)[source]

Bases: object

Class to handle grouped labels with an optional infinite line if required Labels can be locked to screen co-ordinates or top/bottom, left/right justified

addString(obj, position=(0, 0), axisCodes=None, colour='#FF0000', alpha=1.0, lock=0, serial=0)[source]

Add a new string to the list

buildStrings()[source]
drawStrings()[source]
objectInstance(obj)[source]

return the object instance to insert into the string To be subclassed as required

objectSettings(string, obj)[source]

Set up class specific settings for the new string To be subclassed as required

objectText(obj)[source]

return the string to be used for the label To be subclassed as required

removeString(obj)[source]

Remove a string from the list, if it exists

renameString(obj)[source]

Rename a string in the list, if it exists

rescale()[source]

rescale the objects

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLViewports module

Module Documentation here

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLViewports.GLViewports(pixelRatio=1.0)[source]

Bases: object

addViewport(name, parent, left, bottom, rightOffset, topOffset)[source]
clearViewports()[source]

Clear all the current viewports

property devicePixelRatio

- None, mutable -

getViewport(name)[source]
getViewportFromWH(name, width, height)[source]
setViewport(name)[source]
class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLViewports.viewportDimensions(left, bottom, width, height)

Bases: tuple

bottom

Alias for field number 1

height

Alias for field number 3

left

Alias for field number 0

width

Alias for field number 2

ccpn.ui.gui.lib.OpenGL.CcpnOpenGLWidgets module

Module Documentation here

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLWidgets.GLExternalRegion(project=None, GLContext=None, spectrumView=None, integralListView=None)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLArrays.GLVertexArray

addIntegral(integral, integralListView, colour='blue', brush=None)[source]
defineIndexVBO()[source]

Define the buffers on the graphics card. Indexed mode with vertices and colour. If undefined, create new VBOs otherwise overwrite existing.

Includes:

vertices: (x, y) * vertices colors: (R, G, B, a) * vertices indices: array of indexes into vertex list _ attribs: array of float for defining aliasPosition

drawIndexArray()[source]

Draw the vertex buffers in indexed array mode. Arrays are copied from main memory each time. Indexed with vertices and colour.

drawIndexVBO()[source]

Draw the vertex buffers in indexed array mode. Arrays are drawn from buffers already bound to graphics card memory. Indexed mode with vertices and colour.

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLWidgets.GLInfiniteLine(parent, glList, values=(0, 0), axisCode=None, orientation='h', brush=None, colour='blue', movable=True, visible=True, bounds=None, obj=None, objectView=None, lineStyle='dashed', lineWidth=1.0, regionType='line')[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLWidgets.GLRegion

setValue(val, emitValuesChanged=True)[source]
property values

- None, mutable -

valuesChanged
class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLWidgets.GLIntegralRegion(project=None, GLContext=None, spectrumView=None, integralListView=None)[source]

Bases: ccpn.ui.gui.lib.OpenGL.CcpnOpenGLWidgets.GLExternalRegion

class ccpn.ui.gui.lib.OpenGL.CcpnOpenGLWidgets.GLRegion(parent, glList, values=(0, 0), axisCode=None, orientation='h', brush=None, colour='blue', movable=True, visible=True, bounds=None, obj=None, objectView=None, lineStyle='dashed', lineWidth=1.0, regionType='region')[source]

Bases: PyQt5.QtWidgets.QWidget

property axisCode

- None, mutable -

property bounds

- None, mutable -

property brush

- None, mutable -

property colour

- None, mutable -

property lineStyle

- None, mutable -

property lineWidth

- None, mutable -

property orientation

- None, mutable -

setValue(val, emitValuesChanged=True)[source]
property values

- None, mutable -

valuesChanged
property visible

- None, mutable -

ccpn.ui.gui.lib.OpenGL.setup module

Module Documentation here