From 005160423eed35f2440afc1adebf0b3ba288a27f Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Wed, 28 Nov 2012 22:47:52 -0500 Subject: [PATCH] Converted all old-style classes to new-style for PySide compatibility. (thanks Chris) --- GraphicsScene/mouseEvents.py | 6 +++--- debug.py | 6 +++--- exceptionHandling.py | 2 +- flowchart/Terminal.py | 2 +- graphicsItems/GraphicsWidgetAnchor.py | 2 +- graphicsItems/ScatterPlotItem.py | 2 +- metaarray/MetaArray.py | 2 +- multiprocess/parallelizer.py | 4 ++-- multiprocess/remoteproxy.py | 2 +- opengl/shaders.py | 4 ++-- parametertree/Parameter.py | 2 +- pgcollections.py | 2 +- widgets/BusyCursor.py | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/GraphicsScene/mouseEvents.py b/GraphicsScene/mouseEvents.py index bb24b758..0b71ac6f 100644 --- a/GraphicsScene/mouseEvents.py +++ b/GraphicsScene/mouseEvents.py @@ -3,7 +3,7 @@ from pyqtgraph.Qt import QtCore, QtGui import weakref import pyqtgraph.ptime as ptime -class MouseDragEvent: +class MouseDragEvent(object): """ Instances of this class are delivered to items in a :class:`GraphicsScene ` via their mouseDragEvent() method when the item is being mouse-dragged. @@ -144,7 +144,7 @@ class MouseDragEvent: -class MouseClickEvent: +class MouseClickEvent(object): """ Instances of this class are delivered to items in a :class:`GraphicsScene ` via their mouseClickEvent() method when the item is clicked. @@ -229,7 +229,7 @@ class MouseClickEvent: -class HoverEvent: +class HoverEvent(object): """ Instances of this class are delivered to items in a :class:`GraphicsScene ` via their hoverEvent() method when the mouse is hovering over the item. This event class both informs items that the mouse cursor is nearby and allows items to diff --git a/debug.py b/debug.py index ba1eb4ed..ea9157aa 100644 --- a/debug.py +++ b/debug.py @@ -317,7 +317,7 @@ def objectSize(obj, ignore=None, verbose=False, depth=0, recursive=False): #print indent + ' -', k, len(refs) return size -class GarbageWatcher: +class GarbageWatcher(object): """ Convenient dictionary for holding weak references to objects. Mainly used to check whether the objects have been collect yet or not. @@ -356,7 +356,7 @@ class GarbageWatcher: return self.objs[item] -class Profiler: +class Profiler(object): """Simple profiler allowing measurement of multiple time intervals. Example: @@ -451,7 +451,7 @@ def lookup(oid, objects=None): -class ObjTracker: +class ObjTracker(object): """ Tracks all objects under the sun, reporting the changes between snapshots: what objects are created, deleted, and persistent. This class is very useful for tracking memory leaks. The class goes to great (but not heroic) lengths to avoid tracking diff --git a/exceptionHandling.py b/exceptionHandling.py index 71d538c6..daa821b7 100644 --- a/exceptionHandling.py +++ b/exceptionHandling.py @@ -47,7 +47,7 @@ def setTracebackClearing(clear=True): global clear_tracebacks clear_tracebacks = clear -class ExceptionHandler: +class ExceptionHandler(object): def __call__(self, *args): ## call original exception handler first (prints exception) global original_excepthook, callbacks, clear_tracebacks diff --git a/flowchart/Terminal.py b/flowchart/Terminal.py index 44487d04..18ff12c1 100644 --- a/flowchart/Terminal.py +++ b/flowchart/Terminal.py @@ -7,7 +7,7 @@ from pyqtgraph.Point import Point #from PySide import QtCore, QtGui from .eq import * -class Terminal: +class Terminal(object): def __init__(self, node, name, io, optional=False, multi=False, pos=None, renamable=False, removable=False, multiable=False, bypass=None): """ Construct a new terminal. diff --git a/graphicsItems/GraphicsWidgetAnchor.py b/graphicsItems/GraphicsWidgetAnchor.py index b71e781a..9770b661 100644 --- a/graphicsItems/GraphicsWidgetAnchor.py +++ b/graphicsItems/GraphicsWidgetAnchor.py @@ -2,7 +2,7 @@ from ..Qt import QtGui, QtCore from ..Point import Point -class GraphicsWidgetAnchor: +class GraphicsWidgetAnchor(object): """ Class used to allow GraphicsWidgets to anchor to a specific position on their parent. diff --git a/graphicsItems/ScatterPlotItem.py b/graphicsItems/ScatterPlotItem.py index 6e442a1d..f0dcfb60 100644 --- a/graphicsItems/ScatterPlotItem.py +++ b/graphicsItems/ScatterPlotItem.py @@ -77,7 +77,7 @@ def makeSymbolPixmap(size, pen, brush, symbol): img = renderSymbol(symbol, size, pen, brush) return QtGui.QPixmap(img) -class SymbolAtlas: +class SymbolAtlas(object): """ Used to efficiently construct a single QPixmap containing all rendered symbols for a ScatterPlotItem. This is required for fragment rendering. diff --git a/metaarray/MetaArray.py b/metaarray/MetaArray.py index 5076dd53..ec1abd3c 100644 --- a/metaarray/MetaArray.py +++ b/metaarray/MetaArray.py @@ -48,7 +48,7 @@ def axis(name=None, cols=None, values=None, units=None): ax['cols'].append(col) return ax -class sliceGenerator: +class sliceGenerator(object): """Just a compact way to generate tuples of slice objects.""" def __getitem__(self, arg): return arg diff --git a/multiprocess/parallelizer.py b/multiprocess/parallelizer.py index 96a766c1..0d5d6f5c 100644 --- a/multiprocess/parallelizer.py +++ b/multiprocess/parallelizer.py @@ -6,7 +6,7 @@ class CanceledError(Exception): """Raised when the progress dialog is canceled during a processing operation.""" pass -class Parallelize: +class Parallelize(object): """ Class for ultra-simple inline parallelization on multi-core CPUs @@ -233,7 +233,7 @@ class Parallelize: self.progress[pid].append(i) -class Tasker: +class Tasker(object): def __init__(self, parallelizer, process, tasks, kwds): self.proc = process self.par = parallelizer diff --git a/multiprocess/remoteproxy.py b/multiprocess/remoteproxy.py index 4f13b5c6..f8da1bd7 100644 --- a/multiprocess/remoteproxy.py +++ b/multiprocess/remoteproxy.py @@ -431,7 +431,7 @@ class RemoteEventHandler(object): return LocalObjectProxy(obj) -class Request: +class Request(object): """ Request objects are returned when calling an ObjectProxy in asynchronous mode or if a synchronous call has timed out. Use hasResult() to ask whether diff --git a/opengl/shaders.py b/opengl/shaders.py index e9a4af9d..1799b648 100644 --- a/opengl/shaders.py +++ b/opengl/shaders.py @@ -209,7 +209,7 @@ CompiledShaderPrograms = {} def getShaderProgram(name): return ShaderProgram.names[name] -class Shader: +class Shader(object): def __init__(self, shaderType, code): self.shaderType = shaderType self.code = code @@ -260,7 +260,7 @@ class FragmentShader(Shader): -class ShaderProgram: +class ShaderProgram(object): names = {} def __init__(self, name, shaders, uniforms=None): diff --git a/parametertree/Parameter.py b/parametertree/Parameter.py index e84bcebe..c8ed4902 100644 --- a/parametertree/Parameter.py +++ b/parametertree/Parameter.py @@ -665,7 +665,7 @@ class Parameter(QtCore.QObject): self.sigTreeStateChanged.emit(self, changes) -class SignalBlocker: +class SignalBlocker(object): def __init__(self, enterFn, exitFn): self.enterFn = enterFn self.exitFn = exitFn diff --git a/pgcollections.py b/pgcollections.py index be5281f2..b0198526 100644 --- a/pgcollections.py +++ b/pgcollections.py @@ -260,7 +260,7 @@ def makeThreadsafe(obj): raise Exception("Not sure how to make object of type %s thread-safe" % str(type(obj))) -class Locker: +class Locker(object): def __init__(self, lock): self.lock = lock self.lock.acquire() diff --git a/widgets/BusyCursor.py b/widgets/BusyCursor.py index 4212d6a6..b013dda0 100644 --- a/widgets/BusyCursor.py +++ b/widgets/BusyCursor.py @@ -2,7 +2,7 @@ from pyqtgraph.Qt import QtGui, QtCore __all__ = ['BusyCursor'] -class BusyCursor: +class BusyCursor(object): """Class for displaying a busy mouse cursor during long operations. Usage::