console, graphicsscene, and 2nd-level graphicsitems

This commit is contained in:
Luke Campagnola 2013-12-23 07:51:33 -05:00
parent cf312e7bac
commit a2e8290d8e
15 changed files with 61 additions and 59 deletions

View File

@ -1,6 +1,6 @@
from pyqtgraph.Qt import QtCore, QtGui from ..Qt import QtCore, QtGui
from pyqtgraph.python2_3 import sortList from ..python2_3 import sortList
#try: #try:
#from PyQt4 import QtOpenGL #from PyQt4 import QtOpenGL
#HAVE_OPENGL = True #HAVE_OPENGL = True
@ -8,11 +8,11 @@ from pyqtgraph.python2_3 import sortList
#HAVE_OPENGL = False #HAVE_OPENGL = False
import weakref import weakref
from pyqtgraph.Point import Point from ..Point import Point
import pyqtgraph.functions as fn from .. import functions as fn
import pyqtgraph.ptime as ptime from .. import ptime as ptime
from .mouseEvents import * from .mouseEvents import *
import pyqtgraph.debug as debug from .. import debug as debug
from . import exportDialog from . import exportDialog
if hasattr(QtCore, 'PYQT_VERSION'): if hasattr(QtCore, 'PYQT_VERSION'):

View File

@ -1,6 +1,8 @@
from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE from ..Qt import QtCore, QtGui, USE_PYSIDE
import pyqtgraph as pg from .. import exporters as exporters
import pyqtgraph.exporters as exporters from .. import functions as fn
from ..graphicsItems.ViewBox import ViewBox
from ..graphicsItems.PlotItem import PlotItem
if USE_PYSIDE: if USE_PYSIDE:
from . import exportDialogTemplate_pyside as exportDialogTemplate from . import exportDialogTemplate_pyside as exportDialogTemplate
@ -18,7 +20,7 @@ class ExportDialog(QtGui.QWidget):
self.scene = scene self.scene = scene
self.selectBox = QtGui.QGraphicsRectItem() self.selectBox = QtGui.QGraphicsRectItem()
self.selectBox.setPen(pg.mkPen('y', width=3, style=QtCore.Qt.DashLine)) self.selectBox.setPen(fn.mkPen('y', width=3, style=QtCore.Qt.DashLine))
self.selectBox.hide() self.selectBox.hide()
self.scene.addItem(self.selectBox) self.scene.addItem(self.selectBox)
@ -35,10 +37,10 @@ class ExportDialog(QtGui.QWidget):
def show(self, item=None): def show(self, item=None):
if item is not None: if item is not None:
## Select next exportable parent of the item originally clicked on ## Select next exportable parent of the item originally clicked on
while not isinstance(item, pg.ViewBox) and not isinstance(item, pg.PlotItem) and item is not None: while not isinstance(item, ViewBox) and not isinstance(item, PlotItem) and item is not None:
item = item.parentItem() item = item.parentItem()
## if this is a ViewBox inside a PlotItem, select the parent instead. ## if this is a ViewBox inside a PlotItem, select the parent instead.
if isinstance(item, pg.ViewBox) and isinstance(item.parentItem(), pg.PlotItem): if isinstance(item, ViewBox) and isinstance(item.parentItem(), PlotItem):
item = item.parentItem() item = item.parentItem()
self.updateItemList(select=item) self.updateItemList(select=item)
self.setVisible(True) self.setVisible(True)
@ -64,9 +66,9 @@ class ExportDialog(QtGui.QWidget):
def updateItemTree(self, item, treeItem, select=None): def updateItemTree(self, item, treeItem, select=None):
si = None si = None
if isinstance(item, pg.ViewBox): if isinstance(item, ViewBox):
si = QtGui.QTreeWidgetItem(['ViewBox']) si = QtGui.QTreeWidgetItem(['ViewBox'])
elif isinstance(item, pg.PlotItem): elif isinstance(item, PlotItem):
si = QtGui.QTreeWidgetItem(['Plot']) si = QtGui.QTreeWidgetItem(['Plot'])
if si is not None: if si is not None:

View File

@ -92,7 +92,7 @@
<customwidget> <customwidget>
<class>ParameterTree</class> <class>ParameterTree</class>
<extends>QTreeWidget</extends> <extends>QTreeWidget</extends>
<header>pyqtgraph.parametertree</header> <header>..parametertree</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@ -65,4 +65,4 @@ class Ui_Form(object):
self.label_3.setText(QtGui.QApplication.translate("Form", "Export options", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText(QtGui.QApplication.translate("Form", "Export options", None, QtGui.QApplication.UnicodeUTF8))
self.copyBtn.setText(QtGui.QApplication.translate("Form", "Copy", None, QtGui.QApplication.UnicodeUTF8)) self.copyBtn.setText(QtGui.QApplication.translate("Form", "Copy", None, QtGui.QApplication.UnicodeUTF8))
from pyqtgraph.parametertree import ParameterTree from ..parametertree import ParameterTree

View File

@ -60,4 +60,4 @@ class Ui_Form(object):
self.label_3.setText(QtGui.QApplication.translate("Form", "Export options", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText(QtGui.QApplication.translate("Form", "Export options", None, QtGui.QApplication.UnicodeUTF8))
self.copyBtn.setText(QtGui.QApplication.translate("Form", "Copy", None, QtGui.QApplication.UnicodeUTF8)) self.copyBtn.setText(QtGui.QApplication.translate("Form", "Copy", None, QtGui.QApplication.UnicodeUTF8))
from pyqtgraph.parametertree import ParameterTree from ..parametertree import ParameterTree

View File

@ -1,7 +1,7 @@
from pyqtgraph.Point import Point from ..Point import Point
from pyqtgraph.Qt import QtCore, QtGui from ..Qt import QtCore, QtGui
import weakref import weakref
import pyqtgraph.ptime as ptime from .. import ptime as ptime
class MouseDragEvent(object): class MouseDragEvent(object):
""" """

View File

@ -1,5 +1,5 @@
from pyqtgraph.Qt import QtCore, QtGui from ..Qt import QtCore, QtGui
from pyqtgraph.python2_3 import asUnicode from ..python2_3 import asUnicode
class CmdInput(QtGui.QLineEdit): class CmdInput(QtGui.QLineEdit):

View File

@ -1,14 +1,14 @@
from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE from ..Qt import QtCore, QtGui, USE_PYSIDE
import sys, re, os, time, traceback, subprocess import sys, re, os, time, traceback, subprocess
import pyqtgraph as pg
if USE_PYSIDE: if USE_PYSIDE:
from . import template_pyside as template from . import template_pyside as template
else: else:
from . import template_pyqt as template from . import template_pyqt as template
import pyqtgraph.exceptionHandling as exceptionHandling from .. import exceptionHandling as exceptionHandling
import pickle import pickle
from .. import getConfigOption
class ConsoleWidget(QtGui.QWidget): class ConsoleWidget(QtGui.QWidget):
""" """
@ -281,7 +281,7 @@ class ConsoleWidget(QtGui.QWidget):
def stackItemDblClicked(self, item): def stackItemDblClicked(self, item):
editor = self.editor editor = self.editor
if editor is None: if editor is None:
editor = pg.getConfigOption('editorCommand') editor = getConfigOption('editorCommand')
if editor is None: if editor is None:
return return
tb = self.currentFrame() tb = self.currentFrame()

View File

@ -16,16 +16,16 @@ This class is very heavily featured:
- Control panel with a huge feature set including averaging, decimation, - Control panel with a huge feature set including averaging, decimation,
display, power spectrum, svg/png export, plot linking, and more. display, power spectrum, svg/png export, plot linking, and more.
""" """
from pyqtgraph.Qt import QtGui, QtCore, QtSvg, USE_PYSIDE from ...Qt import QtGui, QtCore, QtSvg, USE_PYSIDE
import pyqtgraph.pixmaps from ... import pixmaps
if USE_PYSIDE: if USE_PYSIDE:
from .plotConfigTemplate_pyside import * from .plotConfigTemplate_pyside import *
else: else:
from .plotConfigTemplate_pyqt import * from .plotConfigTemplate_pyqt import *
import pyqtgraph.functions as fn from ... import functions as fn
from pyqtgraph.widgets.FileDialog import FileDialog from ...widgets.FileDialog import FileDialog
import weakref import weakref
import numpy as np import numpy as np
import os import os
@ -37,7 +37,7 @@ from .. LegendItem import LegendItem
from .. GraphicsWidget import GraphicsWidget from .. GraphicsWidget import GraphicsWidget
from .. ButtonItem import ButtonItem from .. ButtonItem import ButtonItem
from .. InfiniteLine import InfiniteLine from .. InfiniteLine import InfiniteLine
from pyqtgraph.WidgetGroup import WidgetGroup from ...WidgetGroup import WidgetGroup
__all__ = ['PlotItem'] __all__ = ['PlotItem']
@ -129,7 +129,7 @@ class PlotItem(GraphicsWidget):
path = os.path.dirname(__file__) path = os.path.dirname(__file__)
#self.autoImageFile = os.path.join(path, 'auto.png') #self.autoImageFile = os.path.join(path, 'auto.png')
#self.lockImageFile = os.path.join(path, 'lock.png') #self.lockImageFile = os.path.join(path, 'lock.png')
self.autoBtn = ButtonItem(pyqtgraph.pixmaps.getPixmap('auto'), 14, self) self.autoBtn = ButtonItem(pixmaps.getPixmap('auto'), 14, self)
self.autoBtn.mode = 'auto' self.autoBtn.mode = 'auto'
self.autoBtn.clicked.connect(self.autoBtnClicked) self.autoBtn.clicked.connect(self.autoBtnClicked)
#self.autoBtn.hide() #self.autoBtn.hide()

View File

@ -1,15 +1,15 @@
from pyqtgraph.Qt import QtGui, QtCore from ...Qt import QtGui, QtCore
from pyqtgraph.python2_3 import sortList from ...python2_3 import sortList
import numpy as np import numpy as np
from pyqtgraph.Point import Point from ...Point import Point
import pyqtgraph.functions as fn from ... import functions as fn
from .. ItemGroup import ItemGroup from .. ItemGroup import ItemGroup
from .. GraphicsWidget import GraphicsWidget from .. GraphicsWidget import GraphicsWidget
from pyqtgraph.GraphicsScene import GraphicsScene from ...GraphicsScene import GraphicsScene
import pyqtgraph
import weakref import weakref
from copy import deepcopy from copy import deepcopy
import pyqtgraph.debug as debug from ... import debug as debug
from ... import getConfigOption
__all__ = ['ViewBox'] __all__ = ['ViewBox']
@ -113,7 +113,7 @@ class ViewBox(GraphicsWidget):
## a name string indicates that the view *should* link to another, but no view with that name exists yet. ## a name string indicates that the view *should* link to another, but no view with that name exists yet.
'mouseEnabled': [enableMouse, enableMouse], 'mouseEnabled': [enableMouse, enableMouse],
'mouseMode': ViewBox.PanMode if pyqtgraph.getConfigOption('leftButtonPan') else ViewBox.RectMode, 'mouseMode': ViewBox.PanMode if getConfigOption('leftButtonPan') else ViewBox.RectMode,
'enableMenu': enableMenu, 'enableMenu': enableMenu,
'wheelScaleFactor': -1.0 / 8.0, 'wheelScaleFactor': -1.0 / 8.0,

View File

@ -1,6 +1,6 @@
from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE from ...Qt import QtCore, QtGui, USE_PYSIDE
from pyqtgraph.python2_3 import asUnicode from ...python2_3 import asUnicode
from pyqtgraph.WidgetGroup import WidgetGroup from ...WidgetGroup import WidgetGroup
if USE_PYSIDE: if USE_PYSIDE:
from .axisCtrlTemplate_pyside import Ui_Form as AxisCtrlTemplate from .axisCtrlTemplate_pyside import Ui_Form as AxisCtrlTemplate

View File

@ -1,6 +1,6 @@
from pyqtgraph.Qt import QtGui, QtCore from ..Qt import QtGui, QtCore
import os, weakref, re import os, weakref, re
from pyqtgraph.pgcollections import OrderedDict from ..pgcollections import OrderedDict
from .ParameterItem import ParameterItem from .ParameterItem import ParameterItem
PARAM_TYPES = {} PARAM_TYPES = {}

View File

@ -1,4 +1,4 @@
from pyqtgraph.Qt import QtGui, QtCore from ..Qt import QtGui, QtCore
import os, weakref, re import os, weakref, re
class ParameterItem(QtGui.QTreeWidgetItem): class ParameterItem(QtGui.QTreeWidgetItem):

View File

@ -1,5 +1,5 @@
from pyqtgraph.Qt import QtCore, QtGui from ..Qt import QtCore, QtGui
from pyqtgraph.widgets.TreeWidget import TreeWidget from ..widgets.TreeWidget import TreeWidget
import os, weakref, re import os, weakref, re
from .ParameterItem import ParameterItem from .ParameterItem import ParameterItem
#import functions as fn #import functions as fn

View File

@ -1,14 +1,14 @@
from pyqtgraph.Qt import QtCore, QtGui from ..Qt import QtCore, QtGui
from pyqtgraph.python2_3 import asUnicode from ..python2_3 import asUnicode
from .Parameter import Parameter, registerParameterType from .Parameter import Parameter, registerParameterType
from .ParameterItem import ParameterItem from .ParameterItem import ParameterItem
from pyqtgraph.widgets.SpinBox import SpinBox from ..widgets.SpinBox import SpinBox
from pyqtgraph.widgets.ColorButton import ColorButton from ..widgets.ColorButton import ColorButton
#from pyqtgraph.widgets.GradientWidget import GradientWidget ## creates import loop #from ..widgets.GradientWidget import GradientWidget ## creates import loop
import pyqtgraph as pg from .. import pixmaps as pixmaps
import pyqtgraph.pixmaps as pixmaps from .. import functions as fn
import os import os
from pyqtgraph.pgcollections import OrderedDict from ..pgcollections import OrderedDict
class WidgetParameterItem(ParameterItem): class WidgetParameterItem(ParameterItem):
""" """
@ -141,7 +141,7 @@ class WidgetParameterItem(ParameterItem):
self.hideWidget = False self.hideWidget = False
w.setFlat(True) w.setFlat(True)
elif t == 'colormap': elif t == 'colormap':
from pyqtgraph.widgets.GradientWidget import GradientWidget ## need this here to avoid import loop from ..widgets.GradientWidget import GradientWidget ## need this here to avoid import loop
w = GradientWidget(orientation='bottom') w = GradientWidget(orientation='bottom')
w.sigChanged = w.sigGradientChangeFinished w.sigChanged = w.sigGradientChangeFinished
w.sigChanging = w.sigGradientChanged w.sigChanging = w.sigGradientChanged
@ -304,11 +304,11 @@ class SimpleParameter(Parameter):
self.saveState = self.saveColorState self.saveState = self.saveColorState
def colorValue(self): def colorValue(self):
return pg.mkColor(Parameter.value(self)) return fn.mkColor(Parameter.value(self))
def saveColorState(self): def saveColorState(self):
state = Parameter.saveState(self) state = Parameter.saveState(self)
state['value'] = pg.colorTuple(self.value()) state['value'] = fn.colorTuple(self.value())
return state return state