2ca08c69ce
- added vertical lines / regions for plots - added gradient editor widget - many bugfixes - cleaned up imageview a bit
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
# -*- 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 PyQt4 import QtCore, QtGui
|
|
from PlotWidget import *
|
|
from ImageView import *
|
|
QAPP = None
|
|
class PlotWindow(QtGui.QMainWindow):
|
|
def __init__(self, title=None):
|
|
if QtGui.QApplication.instance() is None:
|
|
global QAPP
|
|
QAPP = QtGui.QApplication([])
|
|
QtGui.QMainWindow.__init__(self)
|
|
self.cw = PlotWidget()
|
|
self.setCentralWidget(self.cw)
|
|
for m in ['plot', 'autoRange', 'addItem', 'removeItem', 'setLabel', 'clear']:
|
|
setattr(self, m, getattr(self.cw, m))
|
|
if title is not None:
|
|
self.setWindowTitle(title)
|
|
self.show()
|
|
|
|
class ImageWindow(QtGui.QMainWindow):
|
|
def __init__(self, title=None):
|
|
if QtGui.QApplication.instance() is None:
|
|
global QAPP
|
|
QAPP = QtGui.QApplication([])
|
|
QtGui.QMainWindow.__init__(self)
|
|
self.cw = ImageView()
|
|
self.setCentralWidget(self.cw)
|
|
for m in ['setImage', 'autoRange', 'addItem', 'removeItem', 'blackLevel', 'whiteLevel', 'imageItem']:
|
|
setattr(self, m, getattr(self.cw, m))
|
|
if title is not None:
|
|
self.setWindowTitle(title)
|
|
self.show()
|