add __all__ to various files

This commit is contained in:
KIU Shueng Chuan 2021-06-20 10:51:44 +08:00
parent 3fbb4f6b02
commit 81baa182c5
25 changed files with 66 additions and 7 deletions

View File

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
from .Qt import QtCore, QtGui
__all__ = ['ThreadsafeTimer']
class ThreadsafeTimer(QtCore.QObject):
"""
Thread-safe replacement for QTimer.

View File

@ -10,7 +10,7 @@ __version__ = '0.12.1'
## 'Qt' is a local module; it is intended mainly to cover up the differences
## between PyQt4 and PySide.
from .Qt import QtGui, mkQApp
from .Qt import QtCore, QtGui, mkQApp
from .Qt import exec_ as exec
## not really safe--If we accidentally create another QApplication, the process hangs (and it is very difficult to trace the cause)
@ -280,6 +280,11 @@ from .ptime import time
from .Qt import isQObjectAlive
from .ThreadsafeTimer import *
# indirect imports used within library
from .GraphicsScene import GraphicsScene
from .python2_3 import asUnicode
from .util.cupy_helper import getCupy
##############################################################
## PyQt and PySide both are prone to crashing on exit.

View File

@ -26,6 +26,31 @@ from .metaarray import MetaArray
from collections import OrderedDict
from .python2_3 import asUnicode, basestring
# in order of appearance in this file.
# add new functions to this list only if they are to reside in pg namespace.
__all__ = [
'siScale', 'siFormat', 'siParse', 'siEval', 'siApply',
'Color', 'mkColor', 'mkBrush', 'mkPen', 'hsvColor',
'CIELabColor', 'colorCIELab', 'colorDistance',
'colorTuple', 'colorStr', 'intColor', 'glColor',
'makeArrowPath', 'eq',
'affineSliceCoords', 'affineSlice',
'interweaveArrays', 'interpolateArray', 'subArray',
'transformToArray', 'transformCoordinates',
'solve3DTransform', 'solveBilinearTransform',
'clip_scalar', 'clip_array', 'rescaleData', 'applyLookupTable',
'makeRGBA', 'makeARGB',
# 'try_fastpath_argb', 'ndarray_to_qimage',
'makeQImage',
# 'qimage_to_ndarray',
'imageToArray', 'colorToAlpha',
'gaussianFilter', 'downsample', 'arrayToQPath',
# 'ndarray_from_qpolygonf', 'create_qpolygonf', 'arrayToQPolygonF',
'isocurve', 'traceImage', 'isosurface',
'invertQTransform',
'pseudoScatter', 'toposort', 'disconnect', 'SignalBlock']
Colors = {
'b': QtGui.QColor(0,0,255,255),
'g': QtGui.QColor(0,255,0,255),

View File

@ -3,6 +3,8 @@ from .. import functions as fn
from .PlotDataItem import PlotDataItem
from .PlotCurveItem import PlotCurveItem
__all__ = ['FillBetweenItem']
class FillBetweenItem(QtGui.QGraphicsPathItem):
"""
GraphicsItem filling the space between two PlotDataItems.

View File

@ -9,6 +9,7 @@ from .. import functions as fn
import weakref
import operator
__all__ = ['GraphicsItem']
# Recipe from https://docs.python.org/3.8/library/collections.html#collections.OrderedDict
# slightly adapted for Python 3.7 compatibility

View File

@ -1,6 +1,7 @@
from ..Qt import QtGui, QtCore
from ..Point import Point
__all__ = ['GraphicsWidgetAnchor']
class GraphicsWidgetAnchor(object):
"""

View File

@ -12,6 +12,7 @@ from .ViewBox import *
from .GradientEditorItem import *
from .LinearRegionItem import *
from .PlotDataItem import *
from .PlotCurveItem import *
from .AxisItem import *
from .GridItem import *
from ..Point import Point

View File

@ -3,6 +3,7 @@ from .GraphicsObject import *
from .. import functions as fn
from ..Qt import QtGui, QtCore
__all__ = ['IsocurveItem']
class IsocurveItem(GraphicsObject):
"""

View File

@ -6,6 +6,7 @@ from .GraphicsObject import GraphicsObject
from .. import mkBrush, mkPen
from .. import functions as fn
__all__ = ['NonUniformImage']
class NonUniformImage(GraphicsObject):
"""

View File

@ -11,6 +11,7 @@ from .. import functions as fn
from .. import debug as debug
from .. import getConfigOption
__all__ = ['PlotDataItem']
class PlotDataItem(GraphicsObject):
"""

View File

@ -14,9 +14,11 @@ from ..InfiniteLine import InfiniteLine
from ..LabelItem import LabelItem
from ..LegendItem import LegendItem
from ..PlotDataItem import PlotDataItem
from ..PlotCurveItem import PlotCurveItem
from ..ScatterPlotItem import ScatterPlotItem
from ..ViewBox import ViewBox
from ... import functions as fn
from ... import icons, PlotCurveItem, ScatterPlotItem
from ... import icons
from ...Qt import QtGui, QtCore, QT_LIB
from ...WidgetGroup import WidgetGroup
from ...python2_3 import basestring

View File

@ -1 +1,3 @@
from .PlotItem import PlotItem
__all__ = ['PlotItem']

View File

@ -10,6 +10,7 @@ from .ViewBox import ViewBox
import string
import warnings
__all__ = ['TargetItem', 'TargetLabel']
class TargetItem(UIGraphicsItem):
"""Draws a draggable target symbol (circle plus crosshair).

View File

@ -4,6 +4,7 @@ from ..Point import Point
from .. import functions as fn
from .GraphicsObject import GraphicsObject
__all__ = ['TextItem']
class TextItem(GraphicsObject):
"""

View File

@ -1 +1,3 @@
from .ViewBox import ViewBox
__all__ = ['ViewBox']

View File

@ -6,6 +6,8 @@ it is possible to place any widget into its own window by simply calling its
show() method.
"""
__all__ = ['GraphicsWindow', 'TabWindow', 'PlotWindow', 'ImageWindow']
from .Qt import QtCore, QtGui, mkQApp
from .widgets.PlotWidget import *
from .imageview import *

View File

@ -4,3 +4,5 @@ Includes ROI plotting over time and image normalization.
"""
from .ImageView import ImageView
__all__ = ['ImageView']

View File

@ -4,6 +4,7 @@ from ..SignalProxy import SignalProxy
from collections import OrderedDict
from ..python2_3 import asUnicode, basestring
__all__ = ['ComboBox']
class ComboBox(QtGui.QComboBox):
"""Extends QComboBox to add extra functionality.

View File

@ -2,6 +2,7 @@ from ..Qt import QtGui, QtCore
from .PathButton import PathButton
from ..python2_3 import basestring
__all__ = ['GroupBox']
class GroupBox(QtGui.QGroupBox):
"""Subclass of QGroupBox that implements collapse handle.

View File

@ -6,6 +6,8 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navigatio
from matplotlib.figure import Figure
__all__ = ['MatplotlibWidget']
class MatplotlibWidget(QtGui.QWidget):
"""
Implements a Matplotlib figure inside a QWidget.

View File

@ -18,6 +18,7 @@ except (ImportError, AttributeError):
# AttributeError upon import
HAVE_OPENGL = False
__all__ = ['RawImageWidget']
class RawImageWidget(QtGui.QWidget):
"""
@ -78,6 +79,7 @@ class RawImageWidget(QtGui.QWidget):
if HAVE_OPENGL:
__all__.append('RawImageGLWidget')
class RawImageGLWidget(QOpenGLWidget):
"""
Similar to RawImageWidget, but uses a GL widget to do all drawing.

View File

@ -2,6 +2,7 @@
CSV export test
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import pyqtgraph as pg
import csv
import tempfile
@ -19,11 +20,11 @@ def test_CSVExporter():
plt.plot(y=y1, name='myPlot')
y2 = [3,4,6,1,2,4,2,3,5,3,5,1,3]
x2 = pg.np.linspace(0, 1.0, len(y2))
x2 = np.linspace(0, 1.0, len(y2))
plt.plot(x=x2, y=y2)
y3 = [1,5,2,3,4,6,1,2,4,2,3,5,3]
x3 = pg.np.linspace(0, 1.0, len(y3)+1)
x3 = np.linspace(0, 1.0, len(y3)+1)
plt.plot(x=x3, y=y3, stepMode="center")
ex = pg.exporters.CSVExporter(plt.plotItem)

View File

@ -7,7 +7,7 @@ pytest.importorskip("matplotlib")
app = pg.mkQApp()
skip_qt6 = pytest.mark.skipif(
pg.QT_LIB in ["PySide6", "PyQt6"],
pg.Qt.QT_LIB in ["PySide6", "PyQt6"],
reason= (
"Matplotlib has no Qt6 support yet, "
"see https://github.com/matplotlib/matplotlib/pull/19255"

View File

@ -229,7 +229,7 @@ def test_setRect():
def test_dividebyzero():
im = pg.image(pg.np.random.normal(size=(100,100)))
im = pg.image(np.random.normal(size=(100,100)))
im.imageItem.setAutoDownsample(True)
im.view.setRange(xRange=[-5+25, 5e+25],yRange=[-5e+25, 5e+25])
app.processEvents()

View File

@ -37,7 +37,7 @@ def test_PlotWidget():
with warnings.catch_warnings():
warnings.simplefilter("ignore")
w = pg.PlotWidget(*args, **kwds)
data = pg.np.array([1,5,2,4,3])
data = np.array([1,5,2,4,3])
c = w.plot(data, name='stuff')
w.addLegend()