deprecate graphicsWindow classes
This commit is contained in:
parent
6562dfc892
commit
ae2f0c155f
|
@ -5,7 +5,8 @@ pyqtgraph-0.11.0 (in development)
|
|||
The result is visually the same, but children of ArrowItem are no longer rotated
|
||||
(this allows screen-aligned text to be attached more easily).
|
||||
To mimic the old behavior, use ArrowItem.rotate() instead of the `angle` argument.
|
||||
|
||||
- Deprecated graphicsWindow classes; these have been unnecessary for many years because
|
||||
widgets can be placed into a new window just by calling show().
|
||||
|
||||
|
||||
pyqtgraph-0.10.0
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
graphicsWindows.py - Convenience classes which create a new window with PlotWidget or ImageView.
|
||||
Copyright 2010 Luke Campagnola
|
||||
Distributed under MIT/X11 license. See license.txt for more infomation.
|
||||
DEPRECATED: The classes below are convenience classes that create a new window
|
||||
containting a single, specific widget. These classes are now unnecessary because
|
||||
it is possible to place any widget into its own window by simply calling its
|
||||
show() method.
|
||||
"""
|
||||
|
||||
from .Qt import QtCore, QtGui
|
||||
|
@ -20,6 +21,8 @@ def mkQApp():
|
|||
|
||||
class GraphicsWindow(GraphicsLayoutWidget):
|
||||
"""
|
||||
(deprecated; use GraphicsLayoutWidget instead)
|
||||
|
||||
Convenience subclass of :class:`GraphicsLayoutWidget
|
||||
<pyqtgraph.GraphicsLayoutWidget>`. This class is intended for use from
|
||||
the interactive python prompt.
|
||||
|
@ -34,6 +37,9 @@ class GraphicsWindow(GraphicsLayoutWidget):
|
|||
|
||||
|
||||
class TabWindow(QtGui.QMainWindow):
|
||||
"""
|
||||
(deprecated)
|
||||
"""
|
||||
def __init__(self, title=None, size=(800,600)):
|
||||
mkQApp()
|
||||
QtGui.QMainWindow.__init__(self)
|
||||
|
@ -52,6 +58,9 @@ class TabWindow(QtGui.QMainWindow):
|
|||
|
||||
|
||||
class PlotWindow(PlotWidget):
|
||||
"""
|
||||
(deprecated; use PlotWidget instead)
|
||||
"""
|
||||
def __init__(self, title=None, **kargs):
|
||||
mkQApp()
|
||||
self.win = QtGui.QMainWindow()
|
||||
|
@ -65,6 +74,9 @@ class PlotWindow(PlotWidget):
|
|||
|
||||
|
||||
class ImageWindow(ImageView):
|
||||
"""
|
||||
(deprecated; use ImageView instead)
|
||||
"""
|
||||
def __init__(self, *args, **kargs):
|
||||
mkQApp()
|
||||
self.win = QtGui.QMainWindow()
|
||||
|
|
|
@ -9,6 +9,31 @@ class GraphicsLayoutWidget(GraphicsView):
|
|||
<pyqtgraph.GraphicsView>` with a single :class:`GraphicsLayout
|
||||
<pyqtgraph.GraphicsLayout>` as its central item.
|
||||
|
||||
This widget is an easy starting point for generating multi-panel figures.
|
||||
Example::
|
||||
|
||||
w = pg.GraphicsLayoutWidget()
|
||||
p1 = w.addPlot(row=0, col=0)
|
||||
p2 = w.addPlot(row=0, col=1)
|
||||
v = w.addViewBox(row=1, col=0, colspan=2)
|
||||
|
||||
Parameters
|
||||
----------
|
||||
parent : QWidget or None
|
||||
The parent widget (see QWidget.__init__)
|
||||
show : bool
|
||||
If True, then immediately show the widget after it is created.
|
||||
If the widget has no parent, then it will be shown inside a new window.
|
||||
size : (width, height) tuple
|
||||
Optionally resize the widget. Note: if this widget is placed inside a
|
||||
layout, then this argument has no effect.
|
||||
title : str or None
|
||||
If specified, then set the window title for this widget.
|
||||
kargs :
|
||||
All extra arguments are passed to
|
||||
:func:`GraphicsLayout.__init__() <pyqtgraph.GraphicsLayout.__init__>`
|
||||
|
||||
|
||||
This class wraps several methods from its internal GraphicsLayout:
|
||||
:func:`nextRow <pyqtgraph.GraphicsLayout.nextRow>`
|
||||
:func:`nextColumn <pyqtgraph.GraphicsLayout.nextColumn>`
|
||||
|
@ -22,9 +47,18 @@ class GraphicsLayoutWidget(GraphicsView):
|
|||
:func:`itemIndex <pyqtgraph.GraphicsLayout.itemIndex>`
|
||||
:func:`clear <pyqtgraph.GraphicsLayout.clear>`
|
||||
"""
|
||||
def __init__(self, parent=None, **kargs):
|
||||
def __init__(self, parent=None, show=False, size=None, title=None, **kargs):
|
||||
GraphicsView.__init__(self, parent)
|
||||
self.ci = GraphicsLayout(**kargs)
|
||||
for n in ['nextRow', 'nextCol', 'nextColumn', 'addPlot', 'addViewBox', 'addItem', 'getItem', 'addLayout', 'addLabel', 'removeItem', 'itemIndex', 'clear']:
|
||||
setattr(self, n, getattr(self.ci, n))
|
||||
self.setCentralItem(self.ci)
|
||||
|
||||
if size is not None:
|
||||
self.resize(*size)
|
||||
|
||||
if title is not None:
|
||||
self.setWindowTitle(title)
|
||||
|
||||
if show is True:
|
||||
self.show()
|
||||
|
|
Loading…
Reference in New Issue