Converted all old-style classes to new-style for PySide compatibility. (thanks Chris)

This commit is contained in:
Luke Campagnola 2012-11-28 22:47:52 -05:00
parent aca9c8310f
commit 005160423e
13 changed files with 19 additions and 19 deletions

View File

@ -3,7 +3,7 @@ from pyqtgraph.Qt import QtCore, QtGui
import weakref import weakref
import pyqtgraph.ptime as ptime import pyqtgraph.ptime as ptime
class MouseDragEvent: class MouseDragEvent(object):
""" """
Instances of this class are delivered to items in a :class:`GraphicsScene <pyqtgraph.GraphicsScene>` via their mouseDragEvent() method when the item is being mouse-dragged. Instances of this class are delivered to items in a :class:`GraphicsScene <pyqtgraph.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 <pyqtgraph.GraphicsScene>` via their mouseClickEvent() method when the item is clicked. Instances of this class are delivered to items in a :class:`GraphicsScene <pyqtgraph.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 <pyqtgraph.GraphicsScene>` via their hoverEvent() method when the mouse is hovering over the item. Instances of this class are delivered to items in a :class:`GraphicsScene <pyqtgraph.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 This event class both informs items that the mouse cursor is nearby and allows items to

View File

@ -317,7 +317,7 @@ def objectSize(obj, ignore=None, verbose=False, depth=0, recursive=False):
#print indent + ' -', k, len(refs) #print indent + ' -', k, len(refs)
return size return size
class GarbageWatcher: class GarbageWatcher(object):
""" """
Convenient dictionary for holding weak references to objects. Convenient dictionary for holding weak references to objects.
Mainly used to check whether the objects have been collect yet or not. Mainly used to check whether the objects have been collect yet or not.
@ -356,7 +356,7 @@ class GarbageWatcher:
return self.objs[item] return self.objs[item]
class Profiler: class Profiler(object):
"""Simple profiler allowing measurement of multiple time intervals. """Simple profiler allowing measurement of multiple time intervals.
Example: 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. 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 This class is very useful for tracking memory leaks. The class goes to great (but not heroic) lengths to avoid tracking

View File

@ -47,7 +47,7 @@ def setTracebackClearing(clear=True):
global clear_tracebacks global clear_tracebacks
clear_tracebacks = clear clear_tracebacks = clear
class ExceptionHandler: class ExceptionHandler(object):
def __call__(self, *args): def __call__(self, *args):
## call original exception handler first (prints exception) ## call original exception handler first (prints exception)
global original_excepthook, callbacks, clear_tracebacks global original_excepthook, callbacks, clear_tracebacks

View File

@ -7,7 +7,7 @@ from pyqtgraph.Point import Point
#from PySide import QtCore, QtGui #from PySide import QtCore, QtGui
from .eq import * 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): def __init__(self, node, name, io, optional=False, multi=False, pos=None, renamable=False, removable=False, multiable=False, bypass=None):
""" """
Construct a new terminal. Construct a new terminal.

View File

@ -2,7 +2,7 @@ from ..Qt import QtGui, QtCore
from ..Point import Point from ..Point import Point
class GraphicsWidgetAnchor: class GraphicsWidgetAnchor(object):
""" """
Class used to allow GraphicsWidgets to anchor to a specific position on their Class used to allow GraphicsWidgets to anchor to a specific position on their
parent. parent.

View File

@ -77,7 +77,7 @@ def makeSymbolPixmap(size, pen, brush, symbol):
img = renderSymbol(symbol, size, pen, brush) img = renderSymbol(symbol, size, pen, brush)
return QtGui.QPixmap(img) return QtGui.QPixmap(img)
class SymbolAtlas: class SymbolAtlas(object):
""" """
Used to efficiently construct a single QPixmap containing all rendered symbols Used to efficiently construct a single QPixmap containing all rendered symbols
for a ScatterPlotItem. This is required for fragment rendering. for a ScatterPlotItem. This is required for fragment rendering.

View File

@ -48,7 +48,7 @@ def axis(name=None, cols=None, values=None, units=None):
ax['cols'].append(col) ax['cols'].append(col)
return ax return ax
class sliceGenerator: class sliceGenerator(object):
"""Just a compact way to generate tuples of slice objects.""" """Just a compact way to generate tuples of slice objects."""
def __getitem__(self, arg): def __getitem__(self, arg):
return arg return arg

View File

@ -6,7 +6,7 @@ class CanceledError(Exception):
"""Raised when the progress dialog is canceled during a processing operation.""" """Raised when the progress dialog is canceled during a processing operation."""
pass pass
class Parallelize: class Parallelize(object):
""" """
Class for ultra-simple inline parallelization on multi-core CPUs Class for ultra-simple inline parallelization on multi-core CPUs
@ -233,7 +233,7 @@ class Parallelize:
self.progress[pid].append(i) self.progress[pid].append(i)
class Tasker: class Tasker(object):
def __init__(self, parallelizer, process, tasks, kwds): def __init__(self, parallelizer, process, tasks, kwds):
self.proc = process self.proc = process
self.par = parallelizer self.par = parallelizer

View File

@ -431,7 +431,7 @@ class RemoteEventHandler(object):
return LocalObjectProxy(obj) return LocalObjectProxy(obj)
class Request: class Request(object):
""" """
Request objects are returned when calling an ObjectProxy in asynchronous mode Request objects are returned when calling an ObjectProxy in asynchronous mode
or if a synchronous call has timed out. Use hasResult() to ask whether or if a synchronous call has timed out. Use hasResult() to ask whether

View File

@ -209,7 +209,7 @@ CompiledShaderPrograms = {}
def getShaderProgram(name): def getShaderProgram(name):
return ShaderProgram.names[name] return ShaderProgram.names[name]
class Shader: class Shader(object):
def __init__(self, shaderType, code): def __init__(self, shaderType, code):
self.shaderType = shaderType self.shaderType = shaderType
self.code = code self.code = code
@ -260,7 +260,7 @@ class FragmentShader(Shader):
class ShaderProgram: class ShaderProgram(object):
names = {} names = {}
def __init__(self, name, shaders, uniforms=None): def __init__(self, name, shaders, uniforms=None):

View File

@ -665,7 +665,7 @@ class Parameter(QtCore.QObject):
self.sigTreeStateChanged.emit(self, changes) self.sigTreeStateChanged.emit(self, changes)
class SignalBlocker: class SignalBlocker(object):
def __init__(self, enterFn, exitFn): def __init__(self, enterFn, exitFn):
self.enterFn = enterFn self.enterFn = enterFn
self.exitFn = exitFn self.exitFn = exitFn

View File

@ -260,7 +260,7 @@ def makeThreadsafe(obj):
raise Exception("Not sure how to make object of type %s thread-safe" % str(type(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): def __init__(self, lock):
self.lock = lock self.lock = lock
self.lock.acquire() self.lock.acquire()

View File

@ -2,7 +2,7 @@ from pyqtgraph.Qt import QtGui, QtCore
__all__ = ['BusyCursor'] __all__ = ['BusyCursor']
class BusyCursor: class BusyCursor(object):
"""Class for displaying a busy mouse cursor during long operations. """Class for displaying a busy mouse cursor during long operations.
Usage:: Usage::