push bullet lists over 2 spaces to get them to show up as such in the… (#1912)

* push bullet lists over 2 spaces to get them to show up as such in the docs

* separate the literal block from the bullet list
This commit is contained in:
Martin Chase 2021-07-21 07:12:35 -07:00 committed by GitHub
parent 66ec0996f4
commit 1d40d50b89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 269 additions and 254 deletions

View File

@ -30,15 +30,15 @@ class GraphicsScene(QtGui.QGraphicsScene):
events, but this turned out to be impossible because the constructor for QGraphicsMouseEvent events, but this turned out to be impossible because the constructor for QGraphicsMouseEvent
is private) is private)
* Generates MouseClicked events in addition to the usual press/move/release events. * Generates MouseClicked events in addition to the usual press/move/release events.
(This works around a problem where it is impossible to have one item respond to a (This works around a problem where it is impossible to have one item respond to a
drag if another is watching for a click.) drag if another is watching for a click.)
* Adjustable radius around click that will catch objects so you don't have to click *exactly* over small/thin objects * Adjustable radius around click that will catch objects so you don't have to click *exactly* over small/thin objects
* Global context menu--if an item implements a context menu, then its parent(s) may also add items to the menu. * Global context menu--if an item implements a context menu, then its parent(s) may also add items to the menu.
* Allows items to decide _before_ a mouse click which item will be the recipient of mouse events. * Allows items to decide _before_ a mouse click which item will be the recipient of mouse events.
This lets us indicate unambiguously to the user which item they are about to click/drag on This lets us indicate unambiguously to the user which item they are about to click/drag on
* Eats mouseMove events that occur too soon after a mouse press. * Eats mouseMove events that occur too soon after a mouse press.
* Reimplements items() and itemAt() to circumvent PyQt bug * Reimplements items() and itemAt() to circumvent PyQt bug
====================== ==================================================================== ====================== ====================================================================
**Signals** **Signals**

View File

@ -360,9 +360,9 @@ def exit():
This function does the following in an attempt to 'safely' terminate This function does the following in an attempt to 'safely' terminate
the process: the process:
* Invoke atexit callbacks * Invoke atexit callbacks
* Close all open file handles * Close all open file handles
* os._exit() * os._exit()
Note: there is some potential for causing damage with this function if you Note: there is some potential for causing damage with this function if you
are using objects that _require_ their destructors to be called (for example, are using objects that _require_ their destructors to be called (for example,

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import numpy as np import numpy as np
from .Qt import QtGui, QtCore from .Qt import QtGui, QtCore
from .functions import mkColor, eq, colorDistance from .functions import mkColor, eq, colorDistance
@ -18,10 +19,10 @@ def listMaps(source=None):
Parameters Parameters
---------- ----------
source: str, optional source: str, optional
Color map source. If omitted, locally stored maps are listed. Otherwise Color map source. If omitted, locally stored maps are listed. Otherwise:
- 'matplotlib' lists maps that can be imported from Matplotlib - 'matplotlib' lists maps that can be imported from Matplotlib
- 'colorcet' lists maps that can be imported from ColorCET - 'colorcet' lists maps that can be imported from ColorCET
Returns Returns
------- -------
@ -68,10 +69,10 @@ def get(name, source=None, skipCache=False):
be a path to a file in the local folder. See the files in the be a path to a file in the local folder. See the files in the
``pyqtgraph/colors/maps/`` folder for examples of the format. ``pyqtgraph/colors/maps/`` folder for examples of the format.
source: str, optional source: str, optional
If omitted, a locally stored map is returned. Otherwise If omitted, a locally stored map is returned. Otherwise:
- 'matplotlib' imports a map defined by Matplotlib. - 'matplotlib' imports a map defined by Matplotlib.
- 'colorcet' imports a map defined by ColorCET. - 'colorcet' imports a map defined by ColorCET.
skipCache: bool, optional skipCache: bool, optional
If `skipCache=True`, the internal cache is skipped and a new If `skipCache=True`, the internal cache is skipped and a new
@ -443,9 +444,9 @@ class ColorMap(object):
mode: str or int, optional mode: str or int, optional
Determines return format: Determines return format:
- `ColorMap.BYTE` or 'byte': Colors are returned as 0-255 unsigned bytes. (default) - `ColorMap.BYTE` or 'byte': Colors are returned as 0-255 unsigned bytes. (default)
- `ColorMap.FLOAT` or 'float': Colors are returned as 0.0-1.0 floats. - `ColorMap.FLOAT` or 'float': Colors are returned as 0.0-1.0 floats.
- `ColorMap.QCOLOR` or 'qcolor': Colors are returned as QColor objects. - `ColorMap.QCOLOR` or 'qcolor': Colors are returned as QColor objects.
Returns Returns
------- -------
@ -556,14 +557,14 @@ class ColorMap(object):
span : tuple (min, max), default (0.0, 1.0) span : tuple (min, max), default (0.0, 1.0)
Span of data values covered by the gradient: Span of data values covered by the gradient:
- Color map value 0.0 will appear at `min`, - Color map value 0.0 will appear at `min`,
- Color map value 1.0 will appear at `max`. - Color map value 1.0 will appear at `max`.
orientation : str, default 'vertical' orientation : str, default 'vertical'
Orientiation of the gradient: Orientiation of the gradient:
- 'vertical': `span` corresponds to the `y` coordinate. - 'vertical': `span` corresponds to the `y` coordinate.
- 'horizontal': `span` corresponds to the `x` coordinate. - 'horizontal': `span` corresponds to the `x` coordinate.
""" """
if orientation == 'vertical': if orientation == 'vertical':
grad = self.getGradient( p1=QtCore.QPointF(0.,span[0]), p2=QtCore.QPointF(0.,span[1]) ) grad = self.getGradient( p1=QtCore.QPointF(0.,span[0]), p2=QtCore.QPointF(0.,span[1]) )
@ -582,14 +583,14 @@ class ColorMap(object):
span : tuple (min, max), default (0.0, 1.0) span : tuple (min, max), default (0.0, 1.0)
Span of the data values covered by the gradient: Span of the data values covered by the gradient:
- Color map value 0.0 will appear at `min`. - Color map value 0.0 will appear at `min`.
- Color map value 1.0 will appear at `max`. - Color map value 1.0 will appear at `max`.
orientation : str, default 'vertical' orientation : str, default 'vertical'
Orientiation of the gradient: Orientiation of the gradient:
- 'vertical' creates a vertical gradient, where `span` corresponds to the `y` coordinate. - 'vertical' creates a vertical gradient, where `span` corresponds to the `y` coordinate.
- 'horizontal' creates a horizontal gradient, where `span` correspnds to the `x` coordinate. - 'horizontal' creates a horizontal gradient, where `span` correspnds to the `x` coordinate.
width : int or float width : int or float
Width of the pen in pixels on screen. Width of the pen in pixels on screen.

View File

@ -17,18 +17,18 @@ class ConsoleWidget(QtGui.QWidget):
Widget displaying console output and accepting command input. Widget displaying console output and accepting command input.
Implements: Implements:
- eval python expressions / exec python statements - eval python expressions / exec python statements
- storable history of commands - storable history of commands
- exception handling allowing commands to be interpreted in the context of any level in the exception stack frame - exception handling allowing commands to be interpreted in the context of any level in the exception stack frame
Why not just use python in an interactive shell (or ipython) ? There are a few reasons: Why not just use python in an interactive shell (or ipython) ? There are a few reasons:
- pyside does not yet allow Qt event processing and interactive shell at the same time - pyside does not yet allow Qt event processing and interactive shell at the same time
- on some systems, typing in the console _blocks_ the qt event loop until the user presses enter. This can - on some systems, typing in the console _blocks_ the qt event loop until the user presses enter. This can
be baffling and frustrating to users since it would appear the program has frozen. be baffling and frustrating to users since it would appear the program has frozen.
- some terminals (eg windows cmd.exe) have notoriously unfriendly interfaces - some terminals (eg windows cmd.exe) have notoriously unfriendly interfaces
- ability to add extra features like exception stack introspection - ability to add extra features like exception stack introspection
- ability to have multiple interactive prompts, including for spawned sub-processes - ability to have multiple interactive prompts, including for spawned sub-processes
""" """
_threadException = QtCore.Signal(object) _threadException = QtCore.Signal(object)

View File

@ -3089,9 +3089,9 @@ def disconnect(signal, slot):
This method augments Qt's Signal.disconnect(): This method augments Qt's Signal.disconnect():
* Return bool indicating whether disconnection was successful, rather than * Return bool indicating whether disconnection was successful, rather than
raising an exception raising an exception
* Attempt to disconnect prior versions of the slot when using pg.reload * Attempt to disconnect prior versions of the slot when using pg.reload
""" """
while True: while True:
try: try:

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from ..Qt import QtGui, QtCore from ..Qt import QtGui, QtCore
from .GraphicsObject import GraphicsObject from .GraphicsObject import GraphicsObject
from .. import getConfigOption from .. import getConfigOption
@ -34,15 +35,15 @@ class ErrorBarItem(GraphicsObject):
Valid keyword options are: Valid keyword options are:
x, y, height, width, top, bottom, left, right, beam, pen x, y, height, width, top, bottom, left, right, beam, pen
* x and y must be numpy arrays specifying the coordinates of data points. * x and y must be numpy arrays specifying the coordinates of data points.
* height, width, top, bottom, left, right, and beam may be numpy arrays, * height, width, top, bottom, left, right, and beam may be numpy arrays,
single values, or None to disable. All values should be positive. single values, or None to disable. All values should be positive.
* top, bottom, left, and right specify the lengths of bars extending * top, bottom, left, and right specify the lengths of bars extending
in each direction. in each direction.
* If height is specified, it overrides top and bottom. * If height is specified, it overrides top and bottom.
* If width is specified, it overrides left and right. * If width is specified, it overrides left and right.
* beam specifies the width of the beam at the end of each bar. * beam specifies the width of the beam at the end of each bar.
* pen may be any single argument accepted by pg.mkPen(). * pen may be any single argument accepted by pg.mkPen().
This method was added in version 0.9.9. For prior versions, use setOpts. This method was added in version 0.9.9. For prior versions, use setOpts.
""" """

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from .. import functions as fn from .. import functions as fn
from .GraphicsObject import GraphicsObject from .GraphicsObject import GraphicsObject
from .ScatterPlotItem import ScatterPlotItem from .ScatterPlotItem import ScatterPlotItem
@ -36,14 +37,14 @@ class GraphItem(GraphicsObject):
pen The pen to use when drawing lines between connected pen The pen to use when drawing lines between connected
nodes. May be one of: nodes. May be one of:
* QPen * QPen
* a single argument to pass to pg.mkPen * a single argument to pass to pg.mkPen
* a record array of length M * a record array of length M
with fields (red, green, blue, alpha, width). Note with fields (red, green, blue, alpha, width). Note
that using this option may have a significant performance that using this option may have a significant performance
cost. cost.
* None (to disable connection drawing) * None (to disable connection drawing)
* 'default' to use the default foreground color. * 'default' to use the default foreground color.
symbolPen The pen(s) used for drawing nodes. symbolPen The pen(s) used for drawing nodes.
symbolBrush The brush(es) used for drawing nodes. symbolBrush The brush(es) used for drawing nodes.
@ -84,11 +85,11 @@ class GraphItem(GraphicsObject):
Set the pen used to draw graph lines. Set the pen used to draw graph lines.
May be: May be:
* None to disable line drawing * None to disable line drawing
* Record array with fields (red, green, blue, alpha, width) * Record array with fields (red, green, blue, alpha, width)
* Any set of arguments and keyword arguments accepted by * Any set of arguments and keyword arguments accepted by
:func:`mkPen <pyqtgraph.mkPen>`. :func:`mkPen <pyqtgraph.mkPen>`.
* 'default' to use the default foreground color. * 'default' to use the default foreground color.
""" """
if len(args) == 1 and len(kwargs) == 0: if len(args) == 1 and len(kwargs) == 0:
self.pen = args[0] self.pen = args[0]

View File

@ -32,9 +32,9 @@ class HistogramLUTItem(GraphicsWidget):
Includes: Includes:
- Image histogram - Image histogram
- Movable region over the histogram to select black/white levels - Movable region over the histogram to select black/white levels
- Gradient editor to define color lookup table for single-channel images - Gradient editor to define color lookup table for single-channel images
Parameters Parameters
---------- ----------

View File

@ -869,9 +869,9 @@ class ImageItem(GraphicsObject):
``self.xp.histogram()``. If `bins` is `auto`, a bin number is automatically ``self.xp.histogram()``. If `bins` is `auto`, a bin number is automatically
chosen based on the image characteristics: chosen based on the image characteristics:
* Integer images will have approximately `targetHistogramSize` bins, * Integer images will have approximately `targetHistogramSize` bins,
with each bin having an integer width. with each bin having an integer width.
* All other types will have `targetHistogramSize` bins. * All other types will have `targetHistogramSize` bins.
If `perChannel` is `True`, then a histogram is computed for each channel, If `perChannel` is `True`, then a histogram is computed for each channel,
and the output is a list of the results. and the output is a list of the results.

View File

@ -449,11 +449,11 @@ class InfLineLabel(TextItem):
This class extends TextItem with the following features: This class extends TextItem with the following features:
* Automatically positions adjacent to the line at a fixed position along * Automatically positions adjacent to the line at a fixed position along
the line and within the view box. the line and within the view box.
* Automatically reformats text when the line value has changed. * Automatically reformats text when the line value has changed.
* Can optionally be dragged to change its location along the line. * Can optionally be dragged to change its location along the line.
* Optionally aligns to its parent line. * Optionally aligns to its parent line.
=============== ================================================================== =============== ==================================================================
**Arguments:** **Arguments:**

View File

@ -62,12 +62,12 @@ class LinearRegionItem(GraphicsObject):
swapMode Sets the behavior of the region when the lines are moved such that swapMode Sets the behavior of the region when the lines are moved such that
their order reverses: their order reverses:
* "block" means the user cannot drag one line past the other * "block" means the user cannot drag one line past the other
* "push" causes both lines to be moved if one would cross the other * "push" causes both lines to be moved if one would cross the other
* "sort" means that lines may trade places, but the output of * "sort" means that lines may trade places, but the output of
getRegion always gives the line positions in ascending order. getRegion always gives the line positions in ascending order.
* None means that no attempt is made to handle swapped line * None means that no attempt is made to handle swapped line
positions. positions.
The default is "sort". The default is "sort".
clipItem An item whose bounds will be used to limit the region bounds. clipItem An item whose bounds will be used to limit the region bounds.

View File

@ -20,9 +20,9 @@ class PlotCurveItem(GraphicsObject):
Features: Features:
- Fast data update - Fast data update
- Fill under curve - Fill under curve
- Mouse interaction - Mouse interaction
===================== =============================================== ===================== ===============================================
**Signals:** **Signals:**

View File

@ -43,35 +43,35 @@ class PlotItem(GraphicsWidget):
It's main functionality is: It's main functionality is:
- Manage placement of ViewBox, AxisItems, and LabelItems - Manage placement of ViewBox, AxisItems, and LabelItems
- Create and manage a list of PlotDataItems displayed inside the ViewBox - Create and manage a list of PlotDataItems displayed inside the ViewBox
- Implement a context menu with commonly used display and analysis options - Implement a context menu with commonly used display and analysis options
Use :func:`plot() <pyqtgraph.PlotItem.plot>` to create a new PlotDataItem and Use :func:`plot() <pyqtgraph.PlotItem.plot>` to create a new PlotDataItem and
add it to the view. Use :func:`addItem() <pyqtgraph.PlotItem.addItem>` to add it to the view. Use :func:`addItem() <pyqtgraph.PlotItem.addItem>` to
add any QGraphicsItem to the view. add any QGraphicsItem to the view.
This class wraps several methods from its internal ViewBox: This class wraps several methods from its internal ViewBox:
:func:`setXRange <pyqtgraph.ViewBox.setXRange>`, - :func:`setXRange <pyqtgraph.ViewBox.setXRange>`
:func:`setYRange <pyqtgraph.ViewBox.setYRange>`, - :func:`setYRange <pyqtgraph.ViewBox.setYRange>`
:func:`setRange <pyqtgraph.ViewBox.setRange>`, - :func:`setRange <pyqtgraph.ViewBox.setRange>`
:func:`autoRange <pyqtgraph.ViewBox.autoRange>`, - :func:`autoRange <pyqtgraph.ViewBox.autoRange>`
:func:`setDefaultPadding <pyqtgraph.ViewBox.setDefaultPadding>`, - :func:`setDefaultPadding <pyqtgraph.ViewBox.setDefaultPadding>`
:func:`setXLink <pyqtgraph.ViewBox.setXLink>`, - :func:`setXLink <pyqtgraph.ViewBox.setXLink>`
:func:`setYLink <pyqtgraph.ViewBox.setYLink>`, - :func:`setYLink <pyqtgraph.ViewBox.setYLink>`
:func:`setAutoPan <pyqtgraph.ViewBox.setAutoPan>`, - :func:`setAutoPan <pyqtgraph.ViewBox.setAutoPan>`
:func:`setAutoVisible <pyqtgraph.ViewBox.setAutoVisible>`, - :func:`setAutoVisible <pyqtgraph.ViewBox.setAutoVisible>`
:func:`setLimits <pyqtgraph.ViewBox.setLimits>`, - :func:`setLimits <pyqtgraph.ViewBox.setLimits>`
:func:`viewRect <pyqtgraph.ViewBox.viewRect>`, - :func:`viewRect <pyqtgraph.ViewBox.viewRect>`
:func:`viewRange <pyqtgraph.ViewBox.viewRange>`, - :func:`viewRange <pyqtgraph.ViewBox.viewRange>`
:func:`setMouseEnabled <pyqtgraph.ViewBox.setMouseEnabled>`, - :func:`setMouseEnabled <pyqtgraph.ViewBox.setMouseEnabled>`
:func:`enableAutoRange <pyqtgraph.ViewBox.enableAutoRange>`, - :func:`enableAutoRange <pyqtgraph.ViewBox.enableAutoRange>`
:func:`disableAutoRange <pyqtgraph.ViewBox.disableAutoRange>`, - :func:`disableAutoRange <pyqtgraph.ViewBox.disableAutoRange>`
:func:`setAspectLocked <pyqtgraph.ViewBox.setAspectLocked>`, - :func:`setAspectLocked <pyqtgraph.ViewBox.setAspectLocked>`
:func:`invertY <pyqtgraph.ViewBox.invertY>`, - :func:`invertY <pyqtgraph.ViewBox.invertY>`
:func:`invertX <pyqtgraph.ViewBox.invertX>`, - :func:`invertX <pyqtgraph.ViewBox.invertX>`
:func:`register <pyqtgraph.ViewBox.register>`, - :func:`register <pyqtgraph.ViewBox.register>`
:func:`unregister <pyqtgraph.ViewBox.unregister>` - :func:`unregister <pyqtgraph.ViewBox.unregister>`
The ViewBox itself can be accessed by calling :func:`getViewBox() <pyqtgraph.PlotItem.getViewBox>` The ViewBox itself can be accessed by calling :func:`getViewBox() <pyqtgraph.PlotItem.getViewBox>`

View File

@ -50,12 +50,12 @@ class ROI(GraphicsObject):
Default mouse interaction: Default mouse interaction:
* Left drag moves the ROI * Left drag moves the ROI
* Left drag + Ctrl moves the ROI with position snapping * Left drag + Ctrl moves the ROI with position snapping
* Left drag + Alt rotates the ROI * Left drag + Alt rotates the ROI
* Left drag + Alt + Ctrl rotates the ROI with angle snapping * Left drag + Alt + Ctrl rotates the ROI with angle snapping
* Left drag + Shift scales the ROI * Left drag + Shift scales the ROI
* Left drag + Shift + Ctrl scales the ROI with size snapping * Left drag + Shift + Ctrl scales the ROI with size snapping
In addition to the above interaction modes, it is possible to attach any In addition to the above interaction modes, it is possible to attach any
number of handles to the ROI that can be dragged to change the ROI in number of handles to the ROI that can be dragged to change the ROI in

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from math import atan2 from math import atan2
from ..Qt import QtGui, QtCore from ..Qt import QtGui, QtCore
from ..Point import Point from ..Point import Point
@ -363,8 +364,8 @@ class TargetLabel(TextItem):
"""A TextItem that attaches itself to a TargetItem. """A TextItem that attaches itself to a TargetItem.
This class extends TextItem with the following features : This class extends TextItem with the following features :
* Automatically positions adjacent to the symbol at a fixed position. * Automatically positions adjacent to the symbol at a fixed position.
* Automatically reformats text when the symbol location has changed. * Automatically reformats text when the symbol location has changed.
Parameters Parameters
---------- ----------

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from math import atan2, degrees from math import atan2, degrees
from ..Qt import QtCore, QtGui from ..Qt import QtCore, QtGui
from ..Point import Point from ..Point import Point
@ -35,11 +36,11 @@ class TextItem(GraphicsObject):
The effects of the `rotateAxis` and `angle` arguments are added independently. So for example: The effects of the `rotateAxis` and `angle` arguments are added independently. So for example:
* rotateAxis=None, angle=0 -> normal horizontal text * rotateAxis=None, angle=0 -> normal horizontal text
* rotateAxis=None, angle=90 -> normal vertical text * rotateAxis=None, angle=90 -> normal vertical text
* rotateAxis=(1, 0), angle=0 -> text aligned with x axis of its parent * rotateAxis=(1, 0), angle=0 -> text aligned with x axis of its parent
* rotateAxis=(0, 1), angle=0 -> text aligned with y axis of its parent * rotateAxis=(0, 1), angle=0 -> text aligned with y axis of its parent
* rotateAxis=(1, 0), angle=90 -> text orthogonal to x axis of its parent * rotateAxis=(1, 0), angle=90 -> text orthogonal to x axis of its parent
""" """
self.anchor = Point(anchor) self.anchor = Point(anchor)

View File

@ -81,10 +81,10 @@ class ViewBox(GraphicsWidget):
Features: Features:
* Scaling contents by mouse or auto-scale when contents change * Scaling contents by mouse or auto-scale when contents change
* View linking--multiple views display the same data ranges * View linking--multiple views display the same data ranges
* Configurable by context menu * Configurable by context menu
* Item coordinate mapping methods * Item coordinate mapping methods
""" """

View File

@ -53,15 +53,15 @@ class ImageView(QtGui.QWidget):
Widget used for display and analysis of image data. Widget used for display and analysis of image data.
Implements many features: Implements many features:
* Displays 2D and 3D image data. For 3D data, a z-axis * Displays 2D and 3D image data. For 3D data, a z-axis
slider is displayed allowing the user to select which frame is displayed. slider is displayed allowing the user to select which frame is displayed.
* Displays histogram of image data with movable region defining the dark/light levels * Displays histogram of image data with movable region defining the dark/light levels
* Editable gradient provides a color lookup table * Editable gradient provides a color lookup table
* Frame slider may also be moved using left/right arrow keys as well as pgup, pgdn, home, and end. * Frame slider may also be moved using left/right arrow keys as well as pgup, pgdn, home, and end.
* Basic analysis features including: * Basic analysis features including:
* ROI and embedded plot for measuring image values across frames * ROI and embedded plot for measuring image values across frames
* Image normalization / background subtraction * Image normalization / background subtraction
Basic Usage:: Basic Usage::
@ -71,13 +71,13 @@ class ImageView(QtGui.QWidget):
**Keyboard interaction** **Keyboard interaction**
* left/right arrows step forward/backward 1 frame when pressed, * left/right arrows step forward/backward 1 frame when pressed,
seek at 20fps when held. seek at 20fps when held.
* up/down arrows seek at 100fps * up/down arrows seek at 100fps
* pgup/pgdn seek at 1000fps * pgup/pgdn seek at 1000fps
* home/end seek immediately to the first/last frame * home/end seek immediately to the first/last frame
* space begins playing frames. If time values (in seconds) are given * space begins playing frames. If time values (in seconds) are given
for each frame, then playback is in realtime. for each frame, then playback is in realtime.
""" """
sigTimeChanged = QtCore.Signal(object, object) sigTimeChanged = QtCore.Signal(object, object)
sigProcessingChanged = QtCore.Signal(object) sigProcessingChanged = QtCore.Signal(object)

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import subprocess, atexit, os, sys, time, random, socket, signal, inspect import subprocess, atexit, os, sys, time, random, socket, signal, inspect
import multiprocessing.connection import multiprocessing.connection
try: try:
@ -234,21 +235,21 @@ class ForkedProcess(RemoteEventHandler):
However, fork() comes with some caveats and limitations: However, fork() comes with some caveats and limitations:
- fork() is not available on Windows. - fork() is not available on Windows.
- It is not possible to have a QApplication in both parent and child process - It is not possible to have a QApplication in both parent and child process
(unless both QApplications are created _after_ the call to fork()) (unless both QApplications are created _after_ the call to fork())
Attempts by the forked process to access Qt GUI elements created by the parent Attempts by the forked process to access Qt GUI elements created by the parent
will most likely cause the child to crash. will most likely cause the child to crash.
- Likewise, database connections are unlikely to function correctly in a forked child. - Likewise, database connections are unlikely to function correctly in a forked child.
- Threads are not copied by fork(); the new process - Threads are not copied by fork(); the new process
will have only one thread that starts wherever fork() was called in the parent process. will have only one thread that starts wherever fork() was called in the parent process.
- Forked processes are unceremoniously terminated when join() is called; they are not - Forked processes are unceremoniously terminated when join() is called; they are not
given any opportunity to clean up. (This prevents them calling any cleanup code that given any opportunity to clean up. (This prevents them calling any cleanup code that
was only intended to be used by the parent process) was only intended to be used by the parent process)
- Normally when fork()ing, open file handles are shared with the parent process, - Normally when fork()ing, open file handles are shared with the parent process,
which is potentially dangerous. ForkedProcess is careful to close all file handles which is potentially dangerous. ForkedProcess is careful to close all file handles
that are not explicitly needed--stdout, stderr, and a single pipe to the parent that are not explicitly needed--stdout, stderr, and a single pipe to the parent
process. process.
""" """
@ -405,14 +406,14 @@ class QtProcess(Process):
""" """
QtProcess is essentially the same as Process, with two major differences: QtProcess is essentially the same as Process, with two major differences:
- The remote process starts by running startQtEventLoop() which creates a - The remote process starts by running startQtEventLoop() which creates a
QApplication in the remote process and uses a QTimer to trigger QApplication in the remote process and uses a QTimer to trigger
remote event processing. This allows the remote process to have its own remote event processing. This allows the remote process to have its own
GUI. GUI.
- A QTimer is also started on the parent process which polls for requests - A QTimer is also started on the parent process which polls for requests
from the child process. This allows Qt signals emitted within the child from the child process. This allows Qt signals emitted within the child
process to invoke slots on the parent process and vice-versa. This can process to invoke slots on the parent process and vice-versa. This can
be disabled using processRequests=False in the constructor. be disabled using processRequests=False in the constructor.
Example:: Example::

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from ..Qt import QtCore, QtGui, QtWidgets from ..Qt import QtCore, QtGui, QtWidgets
from OpenGL.GL import * from OpenGL.GL import *
import OpenGL.GL.framebufferobjects as glfbo import OpenGL.GL.framebufferobjects as glfbo
@ -15,9 +16,9 @@ class GLViewWidget(QtWidgets.QOpenGLWidget):
def __init__(self, parent=None, devicePixelRatio=None, rotationMethod='euler'): def __init__(self, parent=None, devicePixelRatio=None, rotationMethod='euler'):
""" """
Basic widget for displaying 3D data Basic widget for displaying 3D data
- Rotation/scale controls - Rotation/scale controls
- Axis/grid display - Axis/grid display
- Export options - Export options
================ ============================================================== ================ ==============================================================
**Arguments:** **Arguments:**

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import numpy as np import numpy as np
from ..Qt import QtGui from ..Qt import QtGui
from .. import functions as fn from .. import functions as fn
@ -8,11 +9,11 @@ class MeshData(object):
""" """
Class for storing and operating on 3D mesh data. May contain: Class for storing and operating on 3D mesh data. May contain:
- list of vertex locations - list of vertex locations
- list of edges - list of edges
- list of triangles - list of triangles
- colors per vertex, edge, or tri - colors per vertex, edge, or tri
- normals per vertex or tri - normals per vertex or tri
This class handles conversion between the standard [list of vertexes, list of faces] This class handles conversion between the standard [list of vertexes, list of faces]
format (suitable for use with glDrawElements) and 'indexed' [list of vertexes] format format (suitable for use with glDrawElements) and 'indexed' [list of vertexes] format

View File

@ -258,8 +258,8 @@ class Parameter(QtCore.QObject):
Return True if this parameter type matches the name *typ*. Return True if this parameter type matches the name *typ*.
This can occur either of two ways: This can occur either of two ways:
- If self.type() == *typ* - If self.type() == *typ*
- If this parameter's class is registered with the name *typ* - If this parameter's class is registered with the name *typ*
""" """
if self.type() == typ: if self.type() == typ:
return True return True

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from ..Qt import QtGui, QtCore from ..Qt import QtGui, QtCore
from ..python2_3 import asUnicode from ..python2_3 import asUnicode
import os, weakref, re import os, weakref, re
@ -9,10 +10,10 @@ class ParameterItem(QtGui.QTreeWidgetItem):
Abstract ParameterTree item. Abstract ParameterTree item.
Used to represent the state of a Parameter from within a ParameterTree. Used to represent the state of a Parameter from within a ParameterTree.
- Sets first column of item to name - Sets first column of item to name
- generates context menu if item is renamable or removable - generates context menu if item is renamable or removable
- handles child added / removed events - handles child added / removed events
- provides virtual functions for handling changes from parameter - provides virtual functions for handling changes from parameter
For more ParameterItem types, see ParameterTree.parameterTypes module. For more ParameterItem types, see ParameterTree.parameterTypes module.
""" """

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from collections import OrderedDict from collections import OrderedDict
import numpy as np import numpy as np
import copy import copy
@ -52,16 +53,17 @@ class SystemSolver(object):
1) The *defaultState* class attribute: This is a dict containing a 1) The *defaultState* class attribute: This is a dict containing a
description of the variables in the system--their default values, description of the variables in the system--their default values,
data types, and the ways they can be constrained. The format is:: data types, and the ways they can be constrained. The format is::
{ name: [value, type, constraint, allowed_constraints], ...} { name: [value, type, constraint, allowed_constraints], ...}
* *value* is the default value. May be None if it has not been specified Where:
yet. * *value* is the default value. May be None if it has not been specified
* *type* may be float, int, bool, np.ndarray, ... yet.
* *constraint* may be None, single value, or (min, max) * *type* may be float, int, bool, np.ndarray, ...
* None indicates that the value is not constrained--it may be * *constraint* may be None, single value, or (min, max)
automatically generated if the value is requested. * None indicates that the value is not constrained--it may be
* *allowed_constraints* is a string composed of (n)one, (f)ixed, and (r)ange. automatically generated if the value is requested.
* *allowed_constraints* is a string composed of (n)one, (f)ixed, and (r)ange.
Note: do not put mutable objects inside defaultState! Note: do not put mutable objects inside defaultState!

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import os import os
from ..Qt import QtCore, QtGui from ..Qt import QtCore, QtGui
from ..python2_3 import asUnicode from ..python2_3 import asUnicode
@ -15,9 +16,9 @@ class WidgetParameterItem(ParameterItem):
""" """
ParameterTree item with: ParameterTree item with:
* label in second column for displaying value * label in second column for displaying value
* simple widget for editing value (displayed instead of label when item is selected) * simple widget for editing value (displayed instead of label when item is selected)
* button that resets value to default * button that resets value to default
========================== ============================================================= ========================== =============================================================
**Registered Types:** **Registered Types:**
@ -344,12 +345,12 @@ class SimpleParameter(Parameter):
This parameter is backed by :class:`WidgetParameterItem` to represent the This parameter is backed by :class:`WidgetParameterItem` to represent the
following parameter names: following parameter names:
- 'int' - 'int'
- 'float' - 'float'
- 'bool' - 'bool'
- 'str' - 'str'
- 'color' - 'color'
- 'colormap' - 'colormap'
""" """
itemClass = WidgetParameterItem itemClass = WidgetParameterItem

View File

@ -4,21 +4,21 @@ Magic Reload Library
Luke Campagnola 2010 Luke Campagnola 2010
Python reload function that actually works (the way you expect it to) Python reload function that actually works (the way you expect it to)
- No re-importing necessary - No re-importing necessary
- Modules can be reloaded in any order - Modules can be reloaded in any order
- Replaces functions and methods with their updated code - Replaces functions and methods with their updated code
- Changes instances to use updated classes - Changes instances to use updated classes
- Automatically decides which modules to update by comparing file modification times - Automatically decides which modules to update by comparing file modification times
Does NOT: Does NOT:
- re-initialize exting instances, even if __init__ changes - re-initialize exting instances, even if __init__ changes
- update references to any module-level objects - update references to any module-level objects
ie, this does not reload correctly: ie, this does not reload correctly:
from module import someObject from module import someObject
print someObject print someObject
..but you can use this instead: (this works even for the builtin reload) ..but you can use this instead: (this works even for the builtin reload)
import module import module
print module.someObject print module.someObject
""" """
from __future__ import print_function from __future__ import print_function

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import sys import sys
from ..Qt import QtGui, QtCore from ..Qt import QtGui, QtCore
from ..SignalProxy import SignalProxy from ..SignalProxy import SignalProxy
@ -9,12 +10,12 @@ __all__ = ['ComboBox']
class ComboBox(QtGui.QComboBox): class ComboBox(QtGui.QComboBox):
"""Extends QComboBox to add extra functionality. """Extends QComboBox to add extra functionality.
* Handles dict mappings -- user selects a text key, and the ComboBox indicates * Handles dict mappings -- user selects a text key, and the ComboBox indicates
the selected value. the selected value.
* Requires item strings to be unique * Requires item strings to be unique
* Remembers selected value if list is cleared and subsequently repopulated * Remembers selected value if list is cleared and subsequently repopulated
* setItems() replaces the items in the ComboBox and blocks signals if the * setItems() replaces the items in the ComboBox and blocks signals if the
value ultimately does not change. value ultimately does not change.
""" """

View File

@ -74,10 +74,10 @@ class DataTreeWidget(QtGui.QTreeWidget):
def parse(self, data): def parse(self, data):
""" """
Given any python object, return: Given any python object, return:
* type * type
* a short string representation * a short string representation
* a dict of sub-objects to be parsed * a dict of sub-objects to be parsed
* optional widget to display as sub-node * optional widget to display as sub-node
""" """
# defaults for all objects # defaults for all objects
typeStr = type(data).__name__ typeStr = type(data).__name__

View File

@ -9,8 +9,8 @@ class ProgressDialog(QtGui.QProgressDialog):
""" """
Extends QProgressDialog: Extends QProgressDialog:
* Adds context management so the dialog may be used in `with` statements * Adds context management so the dialog may be used in `with` statements
* Allows nesting multiple progress dialogs * Allows nesting multiple progress dialogs
Example:: Example::

View File

@ -21,11 +21,11 @@ class SpinBox(QtGui.QAbstractSpinBox):
Extension of QSpinBox widget for selection of a numerical value. Extension of QSpinBox widget for selection of a numerical value.
Adds many extra features: Adds many extra features:
* SI prefix notation (eg, automatically display "300 mV" instead of "0.003 V") * SI prefix notation (eg, automatically display "300 mV" instead of "0.003 V")
* Float values with linear and decimal stepping (1-9, 10-90, 100-900, etc.) * Float values with linear and decimal stepping (1-9, 10-90, 100-900, etc.)
* Option for unbounded values * Option for unbounded values
* Delayed signals (allows multiple rapid changes with only one change signal) * Delayed signals (allows multiple rapid changes with only one change signal)
* Customizable text formatting * Customizable text formatting
============================= ============================================== ============================= ==============================================
**Signals:** **Signals:**
@ -150,13 +150,13 @@ class SpinBox(QtGui.QAbstractSpinBox):
format (str) Formatting string used to generate the text shown. Formatting is format (str) Formatting string used to generate the text shown. Formatting is
done with ``str.format()`` and makes use of several arguments: done with ``str.format()`` and makes use of several arguments:
* *value* - the unscaled value of the spin box * *value* - the unscaled value of the spin box
* *suffix* - the suffix string * *suffix* - the suffix string
* *scaledValue* - the scaled value to use when an SI prefix is present * *scaledValue* - the scaled value to use when an SI prefix is present
* *siPrefix* - the SI prefix string (if any), or an empty string if * *siPrefix* - the SI prefix string (if any), or an empty string if
this feature has been disabled this feature has been disabled
* *suffixGap* - a single space if a suffix is present, or an empty * *suffixGap* - a single space if a suffix is present, or an empty
string otherwise. string otherwise.
regex (str or RegexObject) Regular expression used to parse the spinbox text. regex (str or RegexObject) Regular expression used to parse the spinbox text.
May contain the following group names: May contain the following group names:

View File

@ -94,12 +94,12 @@ class TableWidget(QtGui.QTableWidget):
"""Set the data displayed in the table. """Set the data displayed in the table.
Allowed formats are: Allowed formats are:
* numpy arrays * numpy arrays
* numpy record arrays * numpy record arrays
* metaarrays * metaarrays
* list-of-lists [[1,2,3], [4,5,6]] * list-of-lists [[1,2,3], [4,5,6]]
* dict-of-lists {'x': [1,2,3], 'y': [4,5,6]} * dict-of-lists {'x': [1,2,3], 'y': [4,5,6]}
* list-of-dicts [{'x': 1, 'y': 4}, {'x': 2, 'y': 5}, ...] * list-of-dicts [{'x': 1, 'y': 4}, {'x': 2, 'y': 5}, ...]
""" """
self.clear() self.clear()
self.appendData(data) self.appendData(data)

View File

@ -242,10 +242,10 @@ class TreeWidgetItem(QtGui.QTreeWidgetItem):
""" """
TreeWidgetItem that keeps track of its own widgets and expansion state. TreeWidgetItem that keeps track of its own widgets and expansion state.
* Widgets may be added to columns before the item is added to a tree. * Widgets may be added to columns before the item is added to a tree.
* Expanded state may be set before item is added to a tree. * Expanded state may be set before item is added to a tree.
* Adds setCheked and isChecked methods. * Adds setCheked and isChecked methods.
* Adds addChildren, insertChildren, and takeChildren methods. * Adds addChildren, insertChildren, and takeChildren methods.
""" """
def __init__(self, *args): def __init__(self, *args):
QtGui.QTreeWidgetItem.__init__(self, *args) QtGui.QTreeWidgetItem.__init__(self, *args)

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from ..Qt import QtCore, QtGui from ..Qt import QtCore, QtGui
from ..ptime import time from ..ptime import time
from .. import functions as fn from .. import functions as fn
@ -9,8 +10,8 @@ class ValueLabel(QtGui.QLabel):
QLabel specifically for displaying numerical values. QLabel specifically for displaying numerical values.
Extends QLabel adding some extra functionality: Extends QLabel adding some extra functionality:
- displaying units with si prefix - displaying units with si prefix
- built-in exponential averaging - built-in exponential averaging
""" """
def __init__(self, parent=None, suffix='', siPrefix=False, averageTime=0, formatStr=None): def __init__(self, parent=None, suffix='', siPrefix=False, averageTime=0, formatStr=None):

View File

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys, argparse, random import os, sys, argparse, random
from shell import shell, ssh from shell import shell, ssh
@ -167,16 +168,16 @@ def build(args):
======== Build complete. ========= ======== Build complete. =========
* Source package: built * Source package: built
* Pip install test: {pip_test} * Pip install test: {pip_test}
* Debian packages: {deb_status} * Debian packages: {deb_status}
* Windows installers: {exe_status} * Windows installers: {exe_status}
* Package files in {pkg_dir} * Package files in {pkg_dir}
Next steps to publish: Next steps to publish:
* Test all packages * Test all packages
* Run script again with --publish * Run script again with --publish
""").format(**args.__dict__)) """).format(**args.__dict__))

View File

@ -425,10 +425,10 @@ def getVersionStrings(pkg):
""" """
Returns 4 version strings: Returns 4 version strings:
* the version string to use for this build, * the version string to use for this build,
* version string requested with --force-version (or None) * version string requested with --force-version (or None)
* version string that describes the current git checkout (or None). * version string that describes the current git checkout (or None).
* version string in the pkg/__init__.py, * version string in the pkg/__init__.py,
The first return value is (forceVersion or gitVersion or initVersion). The first return value is (forceVersion or gitVersion or initVersion).
""" """