/usr/lib/python2.7/dist-packages/pyqtgraph/graphicsWindows.py is in python-pyqtgraph 0.10.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | # -*- 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.
"""
from .Qt import QtCore, QtGui
from .widgets.PlotWidget import *
from .imageview import *
from .widgets.GraphicsLayoutWidget import GraphicsLayoutWidget
from .widgets.GraphicsView import GraphicsView
QAPP = None
def mkQApp():
if QtGui.QApplication.instance() is None:
global QAPP
QAPP = QtGui.QApplication([])
class GraphicsWindow(GraphicsLayoutWidget):
"""
Convenience subclass of :class:`GraphicsLayoutWidget
<pyqtgraph.GraphicsLayoutWidget>`. This class is intended for use from
the interactive python prompt.
"""
def __init__(self, title=None, size=(800,600), **kargs):
mkQApp()
GraphicsLayoutWidget.__init__(self, **kargs)
self.resize(*size)
if title is not None:
self.setWindowTitle(title)
self.show()
class TabWindow(QtGui.QMainWindow):
def __init__(self, title=None, size=(800,600)):
mkQApp()
QtGui.QMainWindow.__init__(self)
self.resize(*size)
self.cw = QtGui.QTabWidget()
self.setCentralWidget(self.cw)
if title is not None:
self.setWindowTitle(title)
self.show()
def __getattr__(self, attr):
if hasattr(self.cw, attr):
return getattr(self.cw, attr)
else:
raise NameError(attr)
class PlotWindow(PlotWidget):
def __init__(self, title=None, **kargs):
mkQApp()
self.win = QtGui.QMainWindow()
PlotWidget.__init__(self, **kargs)
self.win.setCentralWidget(self)
for m in ['resize']:
setattr(self, m, getattr(self.win, m))
if title is not None:
self.win.setWindowTitle(title)
self.win.show()
class ImageWindow(ImageView):
def __init__(self, *args, **kargs):
mkQApp()
self.win = QtGui.QMainWindow()
self.win.resize(800,600)
if 'title' in kargs:
self.win.setWindowTitle(kargs['title'])
del kargs['title']
ImageView.__init__(self, self.win)
if len(args) > 0 or len(kargs) > 0:
self.setImage(*args, **kargs)
self.win.setCentralWidget(self)
for m in ['resize']:
setattr(self, m, getattr(self.win, m))
#for m in ['setImage', 'autoRange', 'addItem', 'removeItem', 'blackLevel', 'whiteLevel', 'imageItem']:
#setattr(self, m, getattr(self.cw, m))
self.win.show()
|