diff --git a/pyqtgraph/GraphicsScene/GraphicsScene.py b/pyqtgraph/GraphicsScene/GraphicsScene.py index aaf9fe39..0da9cbdf 100644 --- a/pyqtgraph/GraphicsScene/GraphicsScene.py +++ b/pyqtgraph/GraphicsScene/GraphicsScene.py @@ -30,15 +30,15 @@ class GraphicsScene(QtGui.QGraphicsScene): events, but this turned out to be impossible because the constructor for QGraphicsMouseEvent is private) - * 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 - 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 - * 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. - 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. - * Reimplements items() and itemAt() to circumvent PyQt bug + * 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 + 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 + * 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. + 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. + * Reimplements items() and itemAt() to circumvent PyQt bug ====================== ==================================================================== **Signals** diff --git a/pyqtgraph/__init__.py b/pyqtgraph/__init__.py index 22ba7ceb..9c326bed 100644 --- a/pyqtgraph/__init__.py +++ b/pyqtgraph/__init__.py @@ -360,9 +360,9 @@ def exit(): This function does the following in an attempt to 'safely' terminate the process: - * Invoke atexit callbacks - * Close all open file handles - * os._exit() + * Invoke atexit callbacks + * Close all open file handles + * os._exit() 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, diff --git a/pyqtgraph/colormap.py b/pyqtgraph/colormap.py index c1bb6ddf..e8ba439d 100644 --- a/pyqtgraph/colormap.py +++ b/pyqtgraph/colormap.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import numpy as np from .Qt import QtGui, QtCore from .functions import mkColor, eq, colorDistance @@ -18,10 +19,10 @@ def listMaps(source=None): Parameters ---------- 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 - - 'colorcet' lists maps that can be imported from ColorCET + - 'matplotlib' lists maps that can be imported from Matplotlib + - 'colorcet' lists maps that can be imported from ColorCET 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 ``pyqtgraph/colors/maps/`` folder for examples of the format. 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. - - 'colorcet' imports a map defined by ColorCET. + - 'matplotlib' imports a map defined by Matplotlib. + - 'colorcet' imports a map defined by ColorCET. skipCache: bool, optional If `skipCache=True`, the internal cache is skipped and a new @@ -443,9 +444,9 @@ class ColorMap(object): mode: str or int, optional Determines return format: - - `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.QCOLOR` or 'qcolor': Colors are returned as QColor objects. + - `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.QCOLOR` or 'qcolor': Colors are returned as QColor objects. Returns ------- @@ -556,14 +557,14 @@ class ColorMap(object): span : tuple (min, max), default (0.0, 1.0) Span of data values covered by the gradient: - - Color map value 0.0 will appear at `min`, - - Color map value 1.0 will appear at `max`. + - Color map value 0.0 will appear at `min`, + - Color map value 1.0 will appear at `max`. orientation : str, default 'vertical' Orientiation of the gradient: - - 'vertical': `span` corresponds to the `y` coordinate. - - 'horizontal': `span` corresponds to the `x` coordinate. + - 'vertical': `span` corresponds to the `y` coordinate. + - 'horizontal': `span` corresponds to the `x` coordinate. """ if orientation == 'vertical': 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 of the data values covered by the gradient: - - Color map value 0.0 will appear at `min`. - - Color map value 1.0 will appear at `max`. + - Color map value 0.0 will appear at `min`. + - Color map value 1.0 will appear at `max`. orientation : str, default 'vertical' Orientiation of the gradient: - - 'vertical' creates a vertical gradient, where `span` corresponds to the `y` coordinate. - - 'horizontal' creates a horizontal gradient, where `span` correspnds to the `x` 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. width : int or float Width of the pen in pixels on screen. diff --git a/pyqtgraph/console/Console.py b/pyqtgraph/console/Console.py index 947127d4..8e66282d 100644 --- a/pyqtgraph/console/Console.py +++ b/pyqtgraph/console/Console.py @@ -17,18 +17,18 @@ class ConsoleWidget(QtGui.QWidget): Widget displaying console output and accepting command input. Implements: - - eval python expressions / exec python statements - - storable history of commands - - exception handling allowing commands to be interpreted in the context of any level in the exception stack frame + - eval python expressions / exec python statements + - storable history of commands + - 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: - - 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 - be baffling and frustrating to users since it would appear the program has frozen. - - some terminals (eg windows cmd.exe) have notoriously unfriendly interfaces - - ability to add extra features like exception stack introspection - - ability to have multiple interactive prompts, including for spawned sub-processes + - 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 + be baffling and frustrating to users since it would appear the program has frozen. + - some terminals (eg windows cmd.exe) have notoriously unfriendly interfaces + - ability to add extra features like exception stack introspection + - ability to have multiple interactive prompts, including for spawned sub-processes """ _threadException = QtCore.Signal(object) diff --git a/pyqtgraph/functions.py b/pyqtgraph/functions.py index 5b8cf8f7..b6aae84c 100644 --- a/pyqtgraph/functions.py +++ b/pyqtgraph/functions.py @@ -3089,9 +3089,9 @@ def disconnect(signal, slot): This method augments Qt's Signal.disconnect(): - * Return bool indicating whether disconnection was successful, rather than - raising an exception - * Attempt to disconnect prior versions of the slot when using pg.reload + * Return bool indicating whether disconnection was successful, rather than + raising an exception + * Attempt to disconnect prior versions of the slot when using pg.reload """ while True: try: diff --git a/pyqtgraph/graphicsItems/ErrorBarItem.py b/pyqtgraph/graphicsItems/ErrorBarItem.py index 365f1d47..433a231b 100644 --- a/pyqtgraph/graphicsItems/ErrorBarItem.py +++ b/pyqtgraph/graphicsItems/ErrorBarItem.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from ..Qt import QtGui, QtCore from .GraphicsObject import GraphicsObject from .. import getConfigOption @@ -34,15 +35,15 @@ class ErrorBarItem(GraphicsObject): Valid keyword options are: x, y, height, width, top, bottom, left, right, beam, pen - * 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, - single values, or None to disable. All values should be positive. - * top, bottom, left, and right specify the lengths of bars extending - in each direction. - * If height is specified, it overrides top and bottom. - * If width is specified, it overrides left and right. - * beam specifies the width of the beam at the end of each bar. - * pen may be any single argument accepted by pg.mkPen(). + * 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, + single values, or None to disable. All values should be positive. + * top, bottom, left, and right specify the lengths of bars extending + in each direction. + * If height is specified, it overrides top and bottom. + * If width is specified, it overrides left and right. + * beam specifies the width of the beam at the end of each bar. + * pen may be any single argument accepted by pg.mkPen(). This method was added in version 0.9.9. For prior versions, use setOpts. """ diff --git a/pyqtgraph/graphicsItems/GraphItem.py b/pyqtgraph/graphicsItems/GraphItem.py index 12a55a67..23b38b79 100644 --- a/pyqtgraph/graphicsItems/GraphItem.py +++ b/pyqtgraph/graphicsItems/GraphItem.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from .. import functions as fn from .GraphicsObject import GraphicsObject from .ScatterPlotItem import ScatterPlotItem @@ -36,14 +37,14 @@ class GraphItem(GraphicsObject): pen The pen to use when drawing lines between connected nodes. May be one of: - * QPen - * a single argument to pass to pg.mkPen - * a record array of length M - with fields (red, green, blue, alpha, width). Note - that using this option may have a significant performance - cost. - * None (to disable connection drawing) - * 'default' to use the default foreground color. + * QPen + * a single argument to pass to pg.mkPen + * a record array of length M + with fields (red, green, blue, alpha, width). Note + that using this option may have a significant performance + cost. + * None (to disable connection drawing) + * 'default' to use the default foreground color. symbolPen The pen(s) 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. May be: - * None to disable line drawing - * Record array with fields (red, green, blue, alpha, width) - * Any set of arguments and keyword arguments accepted by - :func:`mkPen `. - * 'default' to use the default foreground color. + * None to disable line drawing + * Record array with fields (red, green, blue, alpha, width) + * Any set of arguments and keyword arguments accepted by + :func:`mkPen `. + * 'default' to use the default foreground color. """ if len(args) == 1 and len(kwargs) == 0: self.pen = args[0] diff --git a/pyqtgraph/graphicsItems/HistogramLUTItem.py b/pyqtgraph/graphicsItems/HistogramLUTItem.py index dbe4f27a..fe3ab049 100644 --- a/pyqtgraph/graphicsItems/HistogramLUTItem.py +++ b/pyqtgraph/graphicsItems/HistogramLUTItem.py @@ -32,9 +32,9 @@ class HistogramLUTItem(GraphicsWidget): Includes: - - Image histogram - - Movable region over the histogram to select black/white levels - - Gradient editor to define color lookup table for single-channel images + - Image histogram + - Movable region over the histogram to select black/white levels + - Gradient editor to define color lookup table for single-channel images Parameters ---------- diff --git a/pyqtgraph/graphicsItems/ImageItem.py b/pyqtgraph/graphicsItems/ImageItem.py index abcf320a..43df7bd7 100644 --- a/pyqtgraph/graphicsItems/ImageItem.py +++ b/pyqtgraph/graphicsItems/ImageItem.py @@ -869,9 +869,9 @@ class ImageItem(GraphicsObject): ``self.xp.histogram()``. If `bins` is `auto`, a bin number is automatically chosen based on the image characteristics: - * Integer images will have approximately `targetHistogramSize` bins, - with each bin having an integer width. - * All other types will have `targetHistogramSize` bins. + * Integer images will have approximately `targetHistogramSize` bins, + with each bin having an integer width. + * All other types will have `targetHistogramSize` bins. If `perChannel` is `True`, then a histogram is computed for each channel, and the output is a list of the results. diff --git a/pyqtgraph/graphicsItems/InfiniteLine.py b/pyqtgraph/graphicsItems/InfiniteLine.py index cb06bc3a..a50d91f7 100644 --- a/pyqtgraph/graphicsItems/InfiniteLine.py +++ b/pyqtgraph/graphicsItems/InfiniteLine.py @@ -449,11 +449,11 @@ class InfLineLabel(TextItem): This class extends TextItem with the following features: - * Automatically positions adjacent to the line at a fixed position along - the line and within the view box. - * Automatically reformats text when the line value has changed. - * Can optionally be dragged to change its location along the line. - * Optionally aligns to its parent line. + * Automatically positions adjacent to the line at a fixed position along + the line and within the view box. + * Automatically reformats text when the line value has changed. + * Can optionally be dragged to change its location along the line. + * Optionally aligns to its parent line. =============== ================================================================== **Arguments:** diff --git a/pyqtgraph/graphicsItems/LinearRegionItem.py b/pyqtgraph/graphicsItems/LinearRegionItem.py index b5ae6f49..f4767ee9 100644 --- a/pyqtgraph/graphicsItems/LinearRegionItem.py +++ b/pyqtgraph/graphicsItems/LinearRegionItem.py @@ -62,12 +62,12 @@ class LinearRegionItem(GraphicsObject): swapMode Sets the behavior of the region when the lines are moved such that their order reverses: - * "block" means the user cannot drag one line past 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 - getRegion always gives the line positions in ascending order. - * None means that no attempt is made to handle swapped line - positions. + * "block" means the user cannot drag one line past 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 + getRegion always gives the line positions in ascending order. + * None means that no attempt is made to handle swapped line + positions. The default is "sort". clipItem An item whose bounds will be used to limit the region bounds. diff --git a/pyqtgraph/graphicsItems/PlotCurveItem.py b/pyqtgraph/graphicsItems/PlotCurveItem.py index f31fd458..6f27950e 100644 --- a/pyqtgraph/graphicsItems/PlotCurveItem.py +++ b/pyqtgraph/graphicsItems/PlotCurveItem.py @@ -20,9 +20,9 @@ class PlotCurveItem(GraphicsObject): Features: - - Fast data update - - Fill under curve - - Mouse interaction + - Fast data update + - Fill under curve + - Mouse interaction ===================== =============================================== **Signals:** diff --git a/pyqtgraph/graphicsItems/PlotItem/PlotItem.py b/pyqtgraph/graphicsItems/PlotItem/PlotItem.py index 0db2abd6..d3e163b1 100644 --- a/pyqtgraph/graphicsItems/PlotItem/PlotItem.py +++ b/pyqtgraph/graphicsItems/PlotItem/PlotItem.py @@ -43,35 +43,35 @@ class PlotItem(GraphicsWidget): It's main functionality is: - - Manage placement of ViewBox, AxisItems, and LabelItems - - Create and manage a list of PlotDataItems displayed inside the ViewBox - - Implement a context menu with commonly used display and analysis options + - Manage placement of ViewBox, AxisItems, and LabelItems + - Create and manage a list of PlotDataItems displayed inside the ViewBox + - Implement a context menu with commonly used display and analysis options Use :func:`plot() ` to create a new PlotDataItem and add it to the view. Use :func:`addItem() ` to add any QGraphicsItem to the view. This class wraps several methods from its internal ViewBox: - :func:`setXRange `, - :func:`setYRange `, - :func:`setRange `, - :func:`autoRange `, - :func:`setDefaultPadding `, - :func:`setXLink `, - :func:`setYLink `, - :func:`setAutoPan `, - :func:`setAutoVisible `, - :func:`setLimits `, - :func:`viewRect `, - :func:`viewRange `, - :func:`setMouseEnabled `, - :func:`enableAutoRange `, - :func:`disableAutoRange `, - :func:`setAspectLocked `, - :func:`invertY `, - :func:`invertX `, - :func:`register `, - :func:`unregister ` + - :func:`setXRange ` + - :func:`setYRange ` + - :func:`setRange ` + - :func:`autoRange ` + - :func:`setDefaultPadding ` + - :func:`setXLink ` + - :func:`setYLink ` + - :func:`setAutoPan ` + - :func:`setAutoVisible ` + - :func:`setLimits ` + - :func:`viewRect ` + - :func:`viewRange ` + - :func:`setMouseEnabled ` + - :func:`enableAutoRange ` + - :func:`disableAutoRange ` + - :func:`setAspectLocked ` + - :func:`invertY ` + - :func:`invertX ` + - :func:`register ` + - :func:`unregister ` The ViewBox itself can be accessed by calling :func:`getViewBox() ` diff --git a/pyqtgraph/graphicsItems/ROI.py b/pyqtgraph/graphicsItems/ROI.py index 66b09d39..a4526804 100644 --- a/pyqtgraph/graphicsItems/ROI.py +++ b/pyqtgraph/graphicsItems/ROI.py @@ -50,12 +50,12 @@ class ROI(GraphicsObject): Default mouse interaction: - * Left drag moves the ROI - * Left drag + Ctrl moves the ROI with position snapping - * Left drag + Alt rotates the ROI - * Left drag + Alt + Ctrl rotates the ROI with angle snapping - * Left drag + Shift scales the ROI - * Left drag + Shift + Ctrl scales the ROI with size snapping + * Left drag moves the ROI + * Left drag + Ctrl moves the ROI with position snapping + * Left drag + Alt rotates the ROI + * Left drag + Alt + Ctrl rotates the ROI with angle snapping + * Left drag + Shift scales the ROI + * Left drag + Shift + Ctrl scales the ROI with size snapping 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 diff --git a/pyqtgraph/graphicsItems/TargetItem.py b/pyqtgraph/graphicsItems/TargetItem.py index 9724e0c0..53c1ca3f 100644 --- a/pyqtgraph/graphicsItems/TargetItem.py +++ b/pyqtgraph/graphicsItems/TargetItem.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from math import atan2 from ..Qt import QtGui, QtCore from ..Point import Point @@ -363,8 +364,8 @@ class TargetLabel(TextItem): """A TextItem that attaches itself to a TargetItem. This class extends TextItem with the following features : - * Automatically positions adjacent to the symbol at a fixed position. - * Automatically reformats text when the symbol location has changed. + * Automatically positions adjacent to the symbol at a fixed position. + * Automatically reformats text when the symbol location has changed. Parameters ---------- diff --git a/pyqtgraph/graphicsItems/TextItem.py b/pyqtgraph/graphicsItems/TextItem.py index d71f9f34..9c6e46b8 100644 --- a/pyqtgraph/graphicsItems/TextItem.py +++ b/pyqtgraph/graphicsItems/TextItem.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from math import atan2, degrees from ..Qt import QtCore, QtGui 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: - * rotateAxis=None, angle=0 -> normal horizontal text - * rotateAxis=None, angle=90 -> normal vertical text - * 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=(1, 0), angle=90 -> text orthogonal to x axis of its parent + * rotateAxis=None, angle=0 -> normal horizontal text + * rotateAxis=None, angle=90 -> normal vertical text + * 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=(1, 0), angle=90 -> text orthogonal to x axis of its parent """ self.anchor = Point(anchor) diff --git a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py index 5ef4d76a..915390bd 100644 --- a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py +++ b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py @@ -81,10 +81,10 @@ class ViewBox(GraphicsWidget): Features: - * Scaling contents by mouse or auto-scale when contents change - * View linking--multiple views display the same data ranges - * Configurable by context menu - * Item coordinate mapping methods + * Scaling contents by mouse or auto-scale when contents change + * View linking--multiple views display the same data ranges + * Configurable by context menu + * Item coordinate mapping methods """ diff --git a/pyqtgraph/imageview/ImageView.py b/pyqtgraph/imageview/ImageView.py index 93ff062d..0f0c7ffb 100644 --- a/pyqtgraph/imageview/ImageView.py +++ b/pyqtgraph/imageview/ImageView.py @@ -53,15 +53,15 @@ class ImageView(QtGui.QWidget): Widget used for display and analysis of image data. Implements many features: - * Displays 2D and 3D image data. For 3D data, a z-axis - 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 - * 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. - * Basic analysis features including: - - * ROI and embedded plot for measuring image values across frames - * Image normalization / background subtraction + * Displays 2D and 3D image data. For 3D data, a z-axis + 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 + * 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. + * Basic analysis features including: + + * ROI and embedded plot for measuring image values across frames + * Image normalization / background subtraction Basic Usage:: @@ -71,13 +71,13 @@ class ImageView(QtGui.QWidget): **Keyboard interaction** - * left/right arrows step forward/backward 1 frame when pressed, - seek at 20fps when held. - * up/down arrows seek at 100fps - * pgup/pgdn seek at 1000fps - * home/end seek immediately to the first/last frame - * space begins playing frames. If time values (in seconds) are given - for each frame, then playback is in realtime. + * left/right arrows step forward/backward 1 frame when pressed, + seek at 20fps when held. + * up/down arrows seek at 100fps + * pgup/pgdn seek at 1000fps + * home/end seek immediately to the first/last frame + * space begins playing frames. If time values (in seconds) are given + for each frame, then playback is in realtime. """ sigTimeChanged = QtCore.Signal(object, object) sigProcessingChanged = QtCore.Signal(object) diff --git a/pyqtgraph/multiprocess/processes.py b/pyqtgraph/multiprocess/processes.py index 1d213582..cc9dbb8c 100644 --- a/pyqtgraph/multiprocess/processes.py +++ b/pyqtgraph/multiprocess/processes.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import subprocess, atexit, os, sys, time, random, socket, signal, inspect import multiprocessing.connection try: @@ -234,21 +235,21 @@ class ForkedProcess(RemoteEventHandler): However, fork() comes with some caveats and limitations: - - fork() is not available on Windows. - - It is not possible to have a QApplication in both parent and child process - (unless both QApplications are created _after_ the call to fork()) - Attempts by the forked process to access Qt GUI elements created by the parent - will most likely cause the child to crash. - - Likewise, database connections are unlikely to function correctly in a forked child. - - Threads are not copied by fork(); the new 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 - given any opportunity to clean up. (This prevents them calling any cleanup code that - was only intended to be used by 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 - that are not explicitly needed--stdout, stderr, and a single pipe to the parent - process. + - fork() is not available on Windows. + - It is not possible to have a QApplication in both parent and child process + (unless both QApplications are created _after_ the call to fork()) + Attempts by the forked process to access Qt GUI elements created by the parent + will most likely cause the child to crash. + - Likewise, database connections are unlikely to function correctly in a forked child. + - Threads are not copied by fork(); the new 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 + given any opportunity to clean up. (This prevents them calling any cleanup code that + was only intended to be used by 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 + that are not explicitly needed--stdout, stderr, and a single pipe to the parent + process. """ @@ -405,14 +406,14 @@ class QtProcess(Process): """ QtProcess is essentially the same as Process, with two major differences: - - The remote process starts by running startQtEventLoop() which creates a - QApplication in the remote process and uses a QTimer to trigger - remote event processing. This allows the remote process to have its own - GUI. - - 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 - process to invoke slots on the parent process and vice-versa. This can - be disabled using processRequests=False in the constructor. + - The remote process starts by running startQtEventLoop() which creates a + QApplication in the remote process and uses a QTimer to trigger + remote event processing. This allows the remote process to have its own + GUI. + - 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 + process to invoke slots on the parent process and vice-versa. This can + be disabled using processRequests=False in the constructor. Example:: diff --git a/pyqtgraph/opengl/GLViewWidget.py b/pyqtgraph/opengl/GLViewWidget.py index 723b288b..275599fc 100644 --- a/pyqtgraph/opengl/GLViewWidget.py +++ b/pyqtgraph/opengl/GLViewWidget.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from ..Qt import QtCore, QtGui, QtWidgets from OpenGL.GL import * import OpenGL.GL.framebufferobjects as glfbo @@ -15,9 +16,9 @@ class GLViewWidget(QtWidgets.QOpenGLWidget): def __init__(self, parent=None, devicePixelRatio=None, rotationMethod='euler'): """ Basic widget for displaying 3D data - - Rotation/scale controls - - Axis/grid display - - Export options + - Rotation/scale controls + - Axis/grid display + - Export options ================ ============================================================== **Arguments:** diff --git a/pyqtgraph/opengl/MeshData.py b/pyqtgraph/opengl/MeshData.py index 95ba88af..3f7a77b4 100644 --- a/pyqtgraph/opengl/MeshData.py +++ b/pyqtgraph/opengl/MeshData.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import numpy as np from ..Qt import QtGui from .. import functions as fn @@ -8,11 +9,11 @@ class MeshData(object): """ Class for storing and operating on 3D mesh data. May contain: - - list of vertex locations - - list of edges - - list of triangles - - colors per vertex, edge, or tri - - normals per vertex or tri + - list of vertex locations + - list of edges + - list of triangles + - colors per vertex, edge, or tri + - normals per vertex or tri 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 diff --git a/pyqtgraph/parametertree/Parameter.py b/pyqtgraph/parametertree/Parameter.py index 81385a31..4605bf2a 100644 --- a/pyqtgraph/parametertree/Parameter.py +++ b/pyqtgraph/parametertree/Parameter.py @@ -258,8 +258,8 @@ class Parameter(QtCore.QObject): Return True if this parameter type matches the name *typ*. This can occur either of two ways: - - If self.type() == *typ* - - If this parameter's class is registered with the name *typ* + - If self.type() == *typ* + - If this parameter's class is registered with the name *typ* """ if self.type() == typ: return True diff --git a/pyqtgraph/parametertree/ParameterItem.py b/pyqtgraph/parametertree/ParameterItem.py index 8e7c3afd..4b6b3e0a 100644 --- a/pyqtgraph/parametertree/ParameterItem.py +++ b/pyqtgraph/parametertree/ParameterItem.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from ..Qt import QtGui, QtCore from ..python2_3 import asUnicode import os, weakref, re @@ -9,10 +10,10 @@ class ParameterItem(QtGui.QTreeWidgetItem): Abstract ParameterTree item. Used to represent the state of a Parameter from within a ParameterTree. - - Sets first column of item to name - - generates context menu if item is renamable or removable - - handles child added / removed events - - provides virtual functions for handling changes from parameter + - Sets first column of item to name + - generates context menu if item is renamable or removable + - handles child added / removed events + - provides virtual functions for handling changes from parameter For more ParameterItem types, see ParameterTree.parameterTypes module. """ diff --git a/pyqtgraph/parametertree/SystemSolver.py b/pyqtgraph/parametertree/SystemSolver.py index d7b6bef8..8845ee67 100644 --- a/pyqtgraph/parametertree/SystemSolver.py +++ b/pyqtgraph/parametertree/SystemSolver.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from collections import OrderedDict import numpy as np import copy @@ -52,16 +53,17 @@ class SystemSolver(object): 1) The *defaultState* class attribute: This is a dict containing a description of the variables in the system--their default values, data types, and the ways they can be constrained. The format is:: - + { name: [value, type, constraint, allowed_constraints], ...} - - * *value* is the default value. May be None if it has not been specified - yet. - * *type* may be float, int, bool, np.ndarray, ... - * *constraint* may be None, single value, or (min, max) - * None indicates that the value is not constrained--it may be - automatically generated if the value is requested. - * *allowed_constraints* is a string composed of (n)one, (f)ixed, and (r)ange. + + Where: + * *value* is the default value. May be None if it has not been specified + yet. + * *type* may be float, int, bool, np.ndarray, ... + * *constraint* may be None, single value, or (min, max) + * None indicates that the value is not constrained--it may be + 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! diff --git a/pyqtgraph/parametertree/parameterTypes.py b/pyqtgraph/parametertree/parameterTypes.py index b3d70e69..f7783e2a 100644 --- a/pyqtgraph/parametertree/parameterTypes.py +++ b/pyqtgraph/parametertree/parameterTypes.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import os from ..Qt import QtCore, QtGui from ..python2_3 import asUnicode @@ -15,9 +16,9 @@ class WidgetParameterItem(ParameterItem): """ ParameterTree item with: - * label in second column for displaying value - * simple widget for editing value (displayed instead of label when item is selected) - * button that resets value to default + * label in second column for displaying value + * simple widget for editing value (displayed instead of label when item is selected) + * button that resets value to default ========================== ============================================================= **Registered Types:** @@ -344,12 +345,12 @@ class SimpleParameter(Parameter): This parameter is backed by :class:`WidgetParameterItem` to represent the following parameter names: - - 'int' - - 'float' - - 'bool' - - 'str' - - 'color' - - 'colormap' + - 'int' + - 'float' + - 'bool' + - 'str' + - 'color' + - 'colormap' """ itemClass = WidgetParameterItem diff --git a/pyqtgraph/reload.py b/pyqtgraph/reload.py index 83d78046..655a83a6 100644 --- a/pyqtgraph/reload.py +++ b/pyqtgraph/reload.py @@ -4,21 +4,21 @@ Magic Reload Library Luke Campagnola 2010 Python reload function that actually works (the way you expect it to) - - No re-importing necessary - - Modules can be reloaded in any order - - Replaces functions and methods with their updated code - - Changes instances to use updated classes - - Automatically decides which modules to update by comparing file modification times + - No re-importing necessary + - Modules can be reloaded in any order + - Replaces functions and methods with their updated code + - Changes instances to use updated classes + - Automatically decides which modules to update by comparing file modification times Does NOT: - - re-initialize exting instances, even if __init__ changes - - update references to any module-level objects - ie, this does not reload correctly: - from module import someObject - print someObject - ..but you can use this instead: (this works even for the builtin reload) - import module - print module.someObject + - re-initialize exting instances, even if __init__ changes + - update references to any module-level objects + ie, this does not reload correctly: + from module import someObject + print someObject + ..but you can use this instead: (this works even for the builtin reload) + import module + print module.someObject """ from __future__ import print_function diff --git a/pyqtgraph/widgets/ComboBox.py b/pyqtgraph/widgets/ComboBox.py index eb04dafc..67c3c889 100644 --- a/pyqtgraph/widgets/ComboBox.py +++ b/pyqtgraph/widgets/ComboBox.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import sys from ..Qt import QtGui, QtCore from ..SignalProxy import SignalProxy @@ -9,12 +10,12 @@ __all__ = ['ComboBox'] class ComboBox(QtGui.QComboBox): """Extends QComboBox to add extra functionality. - * Handles dict mappings -- user selects a text key, and the ComboBox indicates - the selected value. - * Requires item strings to be unique - * Remembers selected value if list is cleared and subsequently repopulated - * setItems() replaces the items in the ComboBox and blocks signals if the - value ultimately does not change. + * Handles dict mappings -- user selects a text key, and the ComboBox indicates + the selected value. + * Requires item strings to be unique + * Remembers selected value if list is cleared and subsequently repopulated + * setItems() replaces the items in the ComboBox and blocks signals if the + value ultimately does not change. """ diff --git a/pyqtgraph/widgets/DataTreeWidget.py b/pyqtgraph/widgets/DataTreeWidget.py index 1b6398dc..b6987553 100644 --- a/pyqtgraph/widgets/DataTreeWidget.py +++ b/pyqtgraph/widgets/DataTreeWidget.py @@ -74,10 +74,10 @@ class DataTreeWidget(QtGui.QTreeWidget): def parse(self, data): """ Given any python object, return: - * type - * a short string representation - * a dict of sub-objects to be parsed - * optional widget to display as sub-node + * type + * a short string representation + * a dict of sub-objects to be parsed + * optional widget to display as sub-node """ # defaults for all objects typeStr = type(data).__name__ diff --git a/pyqtgraph/widgets/ProgressDialog.py b/pyqtgraph/widgets/ProgressDialog.py index 2af135d2..59ad4a90 100644 --- a/pyqtgraph/widgets/ProgressDialog.py +++ b/pyqtgraph/widgets/ProgressDialog.py @@ -9,8 +9,8 @@ class ProgressDialog(QtGui.QProgressDialog): """ Extends QProgressDialog: - * Adds context management so the dialog may be used in `with` statements - * Allows nesting multiple progress dialogs + * Adds context management so the dialog may be used in `with` statements + * Allows nesting multiple progress dialogs Example:: diff --git a/pyqtgraph/widgets/SpinBox.py b/pyqtgraph/widgets/SpinBox.py index dba0f3e4..7a9af656 100644 --- a/pyqtgraph/widgets/SpinBox.py +++ b/pyqtgraph/widgets/SpinBox.py @@ -21,11 +21,11 @@ class SpinBox(QtGui.QAbstractSpinBox): Extension of QSpinBox widget for selection of a numerical value. Adds many extra features: - * 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.) - * Option for unbounded values - * Delayed signals (allows multiple rapid changes with only one change signal) - * Customizable text formatting + * 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.) + * Option for unbounded values + * Delayed signals (allows multiple rapid changes with only one change signal) + * Customizable text formatting ============================= ============================================== **Signals:** @@ -150,13 +150,13 @@ class SpinBox(QtGui.QAbstractSpinBox): format (str) Formatting string used to generate the text shown. Formatting is done with ``str.format()`` and makes use of several arguments: - * *value* - the unscaled value of the spin box - * *suffix* - the suffix string - * *scaledValue* - the scaled value to use when an SI prefix is present - * *siPrefix* - the SI prefix string (if any), or an empty string if - this feature has been disabled - * *suffixGap* - a single space if a suffix is present, or an empty - string otherwise. + * *value* - the unscaled value of the spin box + * *suffix* - the suffix string + * *scaledValue* - the scaled value to use when an SI prefix is present + * *siPrefix* - the SI prefix string (if any), or an empty string if + this feature has been disabled + * *suffixGap* - a single space if a suffix is present, or an empty + string otherwise. regex (str or RegexObject) Regular expression used to parse the spinbox text. May contain the following group names: diff --git a/pyqtgraph/widgets/TableWidget.py b/pyqtgraph/widgets/TableWidget.py index f026bf44..06abd1e9 100644 --- a/pyqtgraph/widgets/TableWidget.py +++ b/pyqtgraph/widgets/TableWidget.py @@ -94,12 +94,12 @@ class TableWidget(QtGui.QTableWidget): """Set the data displayed in the table. Allowed formats are: - * numpy arrays - * numpy record arrays - * metaarrays - * list-of-lists [[1,2,3], [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}, ...] + * numpy arrays + * numpy record arrays + * metaarrays + * list-of-lists [[1,2,3], [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}, ...] """ self.clear() self.appendData(data) diff --git a/pyqtgraph/widgets/TreeWidget.py b/pyqtgraph/widgets/TreeWidget.py index 2b3bd896..a81c94d0 100644 --- a/pyqtgraph/widgets/TreeWidget.py +++ b/pyqtgraph/widgets/TreeWidget.py @@ -242,10 +242,10 @@ class TreeWidgetItem(QtGui.QTreeWidgetItem): """ 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. - * Expanded state may be set before item is added to a tree. - * Adds setCheked and isChecked methods. - * Adds addChildren, insertChildren, and takeChildren methods. + * 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. + * Adds setCheked and isChecked methods. + * Adds addChildren, insertChildren, and takeChildren methods. """ def __init__(self, *args): QtGui.QTreeWidgetItem.__init__(self, *args) diff --git a/pyqtgraph/widgets/ValueLabel.py b/pyqtgraph/widgets/ValueLabel.py index 0714689f..1b05516a 100644 --- a/pyqtgraph/widgets/ValueLabel.py +++ b/pyqtgraph/widgets/ValueLabel.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from ..Qt import QtCore, QtGui from ..ptime import time from .. import functions as fn @@ -9,8 +10,8 @@ class ValueLabel(QtGui.QLabel): QLabel specifically for displaying numerical values. Extends QLabel adding some extra functionality: - - displaying units with si prefix - - built-in exponential averaging + - displaying units with si prefix + - built-in exponential averaging """ def __init__(self, parent=None, suffix='', siPrefix=False, averageTime=0, formatStr=None): diff --git a/tools/pg-release.py b/tools/pg-release.py index bc05f638..8fd320a7 100644 --- a/tools/pg-release.py +++ b/tools/pg-release.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- import os, sys, argparse, random from shell import shell, ssh @@ -167,16 +168,16 @@ def build(args): ======== Build complete. ========= - * Source package: built - * Pip install test: {pip_test} - * Debian packages: {deb_status} - * Windows installers: {exe_status} - * Package files in {pkg_dir} + * Source package: built + * Pip install test: {pip_test} + * Debian packages: {deb_status} + * Windows installers: {exe_status} + * Package files in {pkg_dir} Next steps to publish: - * Test all packages - * Run script again with --publish + * Test all packages + * Run script again with --publish """).format(**args.__dict__)) diff --git a/tools/setupHelpers.py b/tools/setupHelpers.py index 097fec76..fbc483b5 100644 --- a/tools/setupHelpers.py +++ b/tools/setupHelpers.py @@ -425,10 +425,10 @@ def getVersionStrings(pkg): """ Returns 4 version strings: - * the version string to use for this build, - * version string requested with --force-version (or None) - * version string that describes the current git checkout (or None). - * version string in the pkg/__init__.py, + * the version string to use for this build, + * version string requested with --force-version (or None) + * version string that describes the current git checkout (or None). + * version string in the pkg/__init__.py, The first return value is (forceVersion or gitVersion or initVersion). """