flowchart, canvas
This commit is contained in:
parent
7777240d89
commit
eaf29b5f07
|
@ -3,29 +3,21 @@ if __name__ == '__main__':
|
||||||
import sys, os
|
import sys, os
|
||||||
md = os.path.dirname(os.path.abspath(__file__))
|
md = os.path.dirname(os.path.abspath(__file__))
|
||||||
sys.path = [os.path.dirname(md), os.path.join(md, '..', '..', '..')] + sys.path
|
sys.path = [os.path.dirname(md), os.path.join(md, '..', '..', '..')] + sys.path
|
||||||
#print md
|
|
||||||
|
|
||||||
|
from ..Qt import QtGui, QtCore, USE_PYSIDE
|
||||||
#from pyqtgraph.GraphicsView import GraphicsView
|
from ..graphicsItems.ROI import ROI
|
||||||
#import pyqtgraph.graphicsItems as graphicsItems
|
from ..graphicsItems.ViewBox import ViewBox
|
||||||
#from pyqtgraph.PlotWidget import PlotWidget
|
from ..graphicsItems.GridItem import GridItem
|
||||||
from pyqtgraph.Qt import QtGui, QtCore, USE_PYSIDE
|
|
||||||
from pyqtgraph.graphicsItems.ROI import ROI
|
|
||||||
from pyqtgraph.graphicsItems.ViewBox import ViewBox
|
|
||||||
from pyqtgraph.graphicsItems.GridItem import GridItem
|
|
||||||
|
|
||||||
if USE_PYSIDE:
|
if USE_PYSIDE:
|
||||||
from .CanvasTemplate_pyside import *
|
from .CanvasTemplate_pyside import *
|
||||||
else:
|
else:
|
||||||
from .CanvasTemplate_pyqt import *
|
from .CanvasTemplate_pyqt import *
|
||||||
|
|
||||||
#import DataManager
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from pyqtgraph import debug
|
from .. import debug
|
||||||
#import pyqtgraph as pg
|
|
||||||
import weakref
|
import weakref
|
||||||
from .CanvasManager import CanvasManager
|
from .CanvasManager import CanvasManager
|
||||||
#import items
|
|
||||||
from .CanvasItem import CanvasItem, GroupCanvasItem
|
from .CanvasItem import CanvasItem, GroupCanvasItem
|
||||||
|
|
||||||
class Canvas(QtGui.QWidget):
|
class Canvas(QtGui.QWidget):
|
||||||
|
@ -605,4 +597,4 @@ class SelectBox(ROI):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from pyqtgraph.Qt import QtGui, QtCore, QtSvg, USE_PYSIDE
|
from ..Qt import QtGui, QtCore, QtSvg, USE_PYSIDE
|
||||||
from pyqtgraph.graphicsItems.ROI import ROI
|
from ..graphicsItems.ROI import ROI
|
||||||
import pyqtgraph as pg
|
from .. import SRTTransform, ItemGroup
|
||||||
if USE_PYSIDE:
|
if USE_PYSIDE:
|
||||||
from . import TransformGuiTemplate_pyside as TransformGuiTemplate
|
from . import TransformGuiTemplate_pyside as TransformGuiTemplate
|
||||||
else:
|
else:
|
||||||
from . import TransformGuiTemplate_pyqt as TransformGuiTemplate
|
from . import TransformGuiTemplate_pyqt as TransformGuiTemplate
|
||||||
|
|
||||||
from pyqtgraph import debug
|
from .. import debug
|
||||||
|
|
||||||
class SelectBox(ROI):
|
class SelectBox(ROI):
|
||||||
def __init__(self, scalable=False, rotatable=True):
|
def __init__(self, scalable=False, rotatable=True):
|
||||||
|
@ -96,7 +96,7 @@ class CanvasItem(QtCore.QObject):
|
||||||
if 'transform' in self.opts:
|
if 'transform' in self.opts:
|
||||||
self.baseTransform = self.opts['transform']
|
self.baseTransform = self.opts['transform']
|
||||||
else:
|
else:
|
||||||
self.baseTransform = pg.SRTTransform()
|
self.baseTransform = SRTTransform()
|
||||||
if 'pos' in self.opts and self.opts['pos'] is not None:
|
if 'pos' in self.opts and self.opts['pos'] is not None:
|
||||||
self.baseTransform.translate(self.opts['pos'])
|
self.baseTransform.translate(self.opts['pos'])
|
||||||
if 'angle' in self.opts and self.opts['angle'] is not None:
|
if 'angle' in self.opts and self.opts['angle'] is not None:
|
||||||
|
@ -124,8 +124,8 @@ class CanvasItem(QtCore.QObject):
|
||||||
self.itemScale = QtGui.QGraphicsScale()
|
self.itemScale = QtGui.QGraphicsScale()
|
||||||
self._graphicsItem.setTransformations([self.itemRotation, self.itemScale])
|
self._graphicsItem.setTransformations([self.itemRotation, self.itemScale])
|
||||||
|
|
||||||
self.tempTransform = pg.SRTTransform() ## holds the additional transform that happens during a move - gets added to the userTransform when move is done.
|
self.tempTransform = SRTTransform() ## holds the additional transform that happens during a move - gets added to the userTransform when move is done.
|
||||||
self.userTransform = pg.SRTTransform() ## stores the total transform of the object
|
self.userTransform = SRTTransform() ## stores the total transform of the object
|
||||||
self.resetUserTransform()
|
self.resetUserTransform()
|
||||||
|
|
||||||
## now happens inside resetUserTransform -> selectBoxToItem
|
## now happens inside resetUserTransform -> selectBoxToItem
|
||||||
|
@ -200,7 +200,7 @@ class CanvasItem(QtCore.QObject):
|
||||||
#flip = self.transformGui.mirrorImageCheck.isChecked()
|
#flip = self.transformGui.mirrorImageCheck.isChecked()
|
||||||
#tr = self.userTransform.saveState()
|
#tr = self.userTransform.saveState()
|
||||||
|
|
||||||
inv = pg.SRTTransform()
|
inv = SRTTransform()
|
||||||
inv.scale(-1, 1)
|
inv.scale(-1, 1)
|
||||||
self.userTransform = self.userTransform * inv
|
self.userTransform = self.userTransform * inv
|
||||||
self.updateTransform()
|
self.updateTransform()
|
||||||
|
@ -231,7 +231,7 @@ class CanvasItem(QtCore.QObject):
|
||||||
if not self.isMovable():
|
if not self.isMovable():
|
||||||
return
|
return
|
||||||
self.rotate(180.)
|
self.rotate(180.)
|
||||||
# inv = pg.SRTTransform()
|
# inv = SRTTransform()
|
||||||
# inv.scale(-1, -1)
|
# inv.scale(-1, -1)
|
||||||
# self.userTransform = self.userTransform * inv #flip lr/ud
|
# self.userTransform = self.userTransform * inv #flip lr/ud
|
||||||
# s=self.updateTransform()
|
# s=self.updateTransform()
|
||||||
|
@ -316,7 +316,7 @@ class CanvasItem(QtCore.QObject):
|
||||||
|
|
||||||
|
|
||||||
def resetTemporaryTransform(self):
|
def resetTemporaryTransform(self):
|
||||||
self.tempTransform = pg.SRTTransform() ## don't use Transform.reset()--this transform might be used elsewhere.
|
self.tempTransform = SRTTransform() ## don't use Transform.reset()--this transform might be used elsewhere.
|
||||||
self.updateTransform()
|
self.updateTransform()
|
||||||
|
|
||||||
def transform(self):
|
def transform(self):
|
||||||
|
@ -368,7 +368,7 @@ class CanvasItem(QtCore.QObject):
|
||||||
try:
|
try:
|
||||||
#self.userTranslate = pg.Point(tr['trans'])
|
#self.userTranslate = pg.Point(tr['trans'])
|
||||||
#self.userRotate = tr['rot']
|
#self.userRotate = tr['rot']
|
||||||
self.userTransform = pg.SRTTransform(tr)
|
self.userTransform = SRTTransform(tr)
|
||||||
self.updateTransform()
|
self.updateTransform()
|
||||||
|
|
||||||
self.selectBoxFromUser() ## move select box to match
|
self.selectBoxFromUser() ## move select box to match
|
||||||
|
@ -377,7 +377,7 @@ class CanvasItem(QtCore.QObject):
|
||||||
except:
|
except:
|
||||||
#self.userTranslate = pg.Point([0,0])
|
#self.userTranslate = pg.Point([0,0])
|
||||||
#self.userRotate = 0
|
#self.userRotate = 0
|
||||||
self.userTransform = pg.SRTTransform()
|
self.userTransform = SRTTransform()
|
||||||
debug.printExc("Failed to load transform:")
|
debug.printExc("Failed to load transform:")
|
||||||
#print "set transform", self, self.userTranslate
|
#print "set transform", self, self.userTranslate
|
||||||
|
|
||||||
|
@ -504,6 +504,6 @@ class GroupCanvasItem(CanvasItem):
|
||||||
def __init__(self, **opts):
|
def __init__(self, **opts):
|
||||||
defOpts = {'movable': False, 'scalable': False}
|
defOpts = {'movable': False, 'scalable': False}
|
||||||
defOpts.update(opts)
|
defOpts.update(opts)
|
||||||
item = pg.ItemGroup()
|
item = ItemGroup()
|
||||||
CanvasItem.__init__(self, item, **defOpts)
|
CanvasItem.__init__(self, item, **defOpts)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from pyqtgraph.Qt import QtCore, QtGui
|
from ..Qt import QtCore, QtGui
|
||||||
if not hasattr(QtCore, 'Signal'):
|
if not hasattr(QtCore, 'Signal'):
|
||||||
QtCore.Signal = QtCore.pyqtSignal
|
QtCore.Signal = QtCore.pyqtSignal
|
||||||
import weakref
|
import weakref
|
||||||
|
|
|
@ -95,6 +95,6 @@ class Ui_Form(object):
|
||||||
self.mirrorSelectionBtn.setText(QtGui.QApplication.translate("Form", "Mirror Selection", None, QtGui.QApplication.UnicodeUTF8))
|
self.mirrorSelectionBtn.setText(QtGui.QApplication.translate("Form", "Mirror Selection", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.reflectSelectionBtn.setText(QtGui.QApplication.translate("Form", "MirrorXY", None, QtGui.QApplication.UnicodeUTF8))
|
self.reflectSelectionBtn.setText(QtGui.QApplication.translate("Form", "MirrorXY", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
from pyqtgraph.widgets.GraphicsView import GraphicsView
|
from ..widgets.GraphicsView import GraphicsView
|
||||||
from CanvasManager import CanvasCombo
|
from CanvasManager import CanvasCombo
|
||||||
from pyqtgraph.widgets.TreeWidget import TreeWidget
|
from ..widgets.TreeWidget import TreeWidget
|
||||||
|
|
|
@ -90,6 +90,6 @@ class Ui_Form(object):
|
||||||
self.mirrorSelectionBtn.setText(QtGui.QApplication.translate("Form", "Mirror Selection", None, QtGui.QApplication.UnicodeUTF8))
|
self.mirrorSelectionBtn.setText(QtGui.QApplication.translate("Form", "Mirror Selection", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.reflectSelectionBtn.setText(QtGui.QApplication.translate("Form", "MirrorXY", None, QtGui.QApplication.UnicodeUTF8))
|
self.reflectSelectionBtn.setText(QtGui.QApplication.translate("Form", "MirrorXY", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
from pyqtgraph.widgets.GraphicsView import GraphicsView
|
from ..widgets.GraphicsView import GraphicsView
|
||||||
from CanvasManager import CanvasCombo
|
from CanvasManager import CanvasCombo
|
||||||
from pyqtgraph.widgets.TreeWidget import TreeWidget
|
from ..widgets.TreeWidget import TreeWidget
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE
|
from ..Qt import QtCore, QtGui, USE_PYSIDE
|
||||||
from .Node import *
|
from .Node import *
|
||||||
from pyqtgraph.pgcollections import OrderedDict
|
from ..pgcollections import OrderedDict
|
||||||
from pyqtgraph.widgets.TreeWidget import *
|
from ..widgets.TreeWidget import *
|
||||||
|
from .. import FileDialog, DataTreeWidget
|
||||||
|
|
||||||
## pyside and pyqt use incompatible ui files.
|
## pyside and pyqt use incompatible ui files.
|
||||||
if USE_PYSIDE:
|
if USE_PYSIDE:
|
||||||
|
@ -15,10 +16,9 @@ else:
|
||||||
from .Terminal import Terminal
|
from .Terminal import Terminal
|
||||||
from numpy import ndarray
|
from numpy import ndarray
|
||||||
from .library import LIBRARY
|
from .library import LIBRARY
|
||||||
from pyqtgraph.debug import printExc
|
from ..debug import printExc
|
||||||
import pyqtgraph.configfile as configfile
|
from .. import configfile as configfile
|
||||||
import pyqtgraph.dockarea as dockarea
|
from .. import dockarea as dockarea
|
||||||
import pyqtgraph as pg
|
|
||||||
from . import FlowchartGraphicsView
|
from . import FlowchartGraphicsView
|
||||||
|
|
||||||
def strDict(d):
|
def strDict(d):
|
||||||
|
@ -537,7 +537,7 @@ class Flowchart(Node):
|
||||||
startDir = self.filePath
|
startDir = self.filePath
|
||||||
if startDir is None:
|
if startDir is None:
|
||||||
startDir = '.'
|
startDir = '.'
|
||||||
self.fileDialog = pg.FileDialog(None, "Load Flowchart..", startDir, "Flowchart (*.fc)")
|
self.fileDialog = FileDialog(None, "Load Flowchart..", startDir, "Flowchart (*.fc)")
|
||||||
#self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
|
#self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
|
||||||
#self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
|
#self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
|
||||||
self.fileDialog.show()
|
self.fileDialog.show()
|
||||||
|
@ -558,7 +558,7 @@ class Flowchart(Node):
|
||||||
startDir = self.filePath
|
startDir = self.filePath
|
||||||
if startDir is None:
|
if startDir is None:
|
||||||
startDir = '.'
|
startDir = '.'
|
||||||
self.fileDialog = pg.FileDialog(None, "Save Flowchart..", startDir, "Flowchart (*.fc)")
|
self.fileDialog = FileDialog(None, "Save Flowchart..", startDir, "Flowchart (*.fc)")
|
||||||
#self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
|
#self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
|
||||||
self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
|
self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
|
||||||
#self.fileDialog.setDirectory(startDir)
|
#self.fileDialog.setDirectory(startDir)
|
||||||
|
@ -821,7 +821,7 @@ class FlowchartWidget(dockarea.DockArea):
|
||||||
self.selDescLabel = QtGui.QLabel()
|
self.selDescLabel = QtGui.QLabel()
|
||||||
self.selNameLabel = QtGui.QLabel()
|
self.selNameLabel = QtGui.QLabel()
|
||||||
self.selDescLabel.setWordWrap(True)
|
self.selDescLabel.setWordWrap(True)
|
||||||
self.selectedTree = pg.DataTreeWidget()
|
self.selectedTree = DataTreeWidget()
|
||||||
#self.selectedTree.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
|
#self.selectedTree.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
|
||||||
#self.selInfoLayout.addWidget(self.selNameLabel)
|
#self.selInfoLayout.addWidget(self.selNameLabel)
|
||||||
self.selInfoLayout.addWidget(self.selDescLabel)
|
self.selInfoLayout.addWidget(self.selDescLabel)
|
||||||
|
|
|
@ -67,5 +67,5 @@ class Ui_Form(object):
|
||||||
self.reloadBtn.setText(QtGui.QApplication.translate("Form", "Reload Libs", None, QtGui.QApplication.UnicodeUTF8))
|
self.reloadBtn.setText(QtGui.QApplication.translate("Form", "Reload Libs", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.showChartBtn.setText(QtGui.QApplication.translate("Form", "Flowchart", None, QtGui.QApplication.UnicodeUTF8))
|
self.showChartBtn.setText(QtGui.QApplication.translate("Form", "Flowchart", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
from pyqtgraph.widgets.FeedbackButton import FeedbackButton
|
from ..widgets.FeedbackButton import FeedbackButton
|
||||||
from pyqtgraph.widgets.TreeWidget import TreeWidget
|
from ..widgets.TreeWidget import TreeWidget
|
||||||
|
|
|
@ -62,5 +62,5 @@ class Ui_Form(object):
|
||||||
self.reloadBtn.setText(QtGui.QApplication.translate("Form", "Reload Libs", None, QtGui.QApplication.UnicodeUTF8))
|
self.reloadBtn.setText(QtGui.QApplication.translate("Form", "Reload Libs", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.showChartBtn.setText(QtGui.QApplication.translate("Form", "Flowchart", None, QtGui.QApplication.UnicodeUTF8))
|
self.showChartBtn.setText(QtGui.QApplication.translate("Form", "Flowchart", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
from pyqtgraph.widgets.FeedbackButton import FeedbackButton
|
from ..widgets.FeedbackButton import FeedbackButton
|
||||||
from pyqtgraph.widgets.TreeWidget import TreeWidget
|
from ..widgets.TreeWidget import TreeWidget
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from pyqtgraph.Qt import QtGui, QtCore
|
from ..Qt import QtGui, QtCore
|
||||||
from pyqtgraph.widgets.GraphicsView import GraphicsView
|
from ..widgets.GraphicsView import GraphicsView
|
||||||
from pyqtgraph.GraphicsScene import GraphicsScene
|
from ..GraphicsScene import GraphicsScene
|
||||||
from pyqtgraph.graphicsItems.ViewBox import ViewBox
|
from ..graphicsItems.ViewBox import ViewBox
|
||||||
|
|
||||||
#class FlowchartGraphicsView(QtGui.QGraphicsView):
|
#class FlowchartGraphicsView(QtGui.QGraphicsView):
|
||||||
class FlowchartGraphicsView(GraphicsView):
|
class FlowchartGraphicsView(GraphicsView):
|
||||||
|
|
|
@ -55,5 +55,5 @@ class Ui_Form(object):
|
||||||
def retranslateUi(self, Form):
|
def retranslateUi(self, Form):
|
||||||
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
|
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
from pyqtgraph.widgets.DataTreeWidget import DataTreeWidget
|
from ..widgets.DataTreeWidget import DataTreeWidget
|
||||||
from pyqtgraph.flowchart.FlowchartGraphicsView import FlowchartGraphicsView
|
from ..flowchart.FlowchartGraphicsView import FlowchartGraphicsView
|
||||||
|
|
|
@ -50,5 +50,5 @@ class Ui_Form(object):
|
||||||
def retranslateUi(self, Form):
|
def retranslateUi(self, Form):
|
||||||
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
|
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
from pyqtgraph.widgets.DataTreeWidget import DataTreeWidget
|
from ..widgets.DataTreeWidget import DataTreeWidget
|
||||||
from pyqtgraph.flowchart.FlowchartGraphicsView import FlowchartGraphicsView
|
from ..flowchart.FlowchartGraphicsView import FlowchartGraphicsView
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from pyqtgraph.Qt import QtCore, QtGui
|
from ..Qt import QtCore, QtGui
|
||||||
from pyqtgraph.graphicsItems.GraphicsObject import GraphicsObject
|
from ..graphicsItems.GraphicsObject import GraphicsObject
|
||||||
import pyqtgraph.functions as fn
|
from .. import functions as fn
|
||||||
from .Terminal import *
|
from .Terminal import *
|
||||||
from pyqtgraph.pgcollections import OrderedDict
|
from ..pgcollections import OrderedDict
|
||||||
from pyqtgraph.debug import *
|
from ..debug import *
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from .eq import *
|
from .eq import *
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from pyqtgraph.pgcollections import OrderedDict
|
from ..pgcollections import OrderedDict
|
||||||
from .Node import Node
|
from .Node import Node
|
||||||
|
|
||||||
def isNodeClass(cls):
|
def isNodeClass(cls):
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from pyqtgraph.Qt import QtCore, QtGui
|
from ..Qt import QtCore, QtGui
|
||||||
import weakref
|
import weakref
|
||||||
from pyqtgraph.graphicsItems.GraphicsObject import GraphicsObject
|
from ..graphicsItems.GraphicsObject import GraphicsObject
|
||||||
import pyqtgraph.functions as fn
|
from .. import functions as fn
|
||||||
from pyqtgraph.Point import Point
|
from ..Point import Point
|
||||||
#from PySide import QtCore, QtGui
|
#from PySide import QtCore, QtGui
|
||||||
from .eq import *
|
from .eq import *
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from numpy import ndarray, bool_
|
from numpy import ndarray, bool_
|
||||||
from pyqtgraph.metaarray import MetaArray
|
from ..metaarray import MetaArray
|
||||||
|
|
||||||
def eq(a, b):
|
def eq(a, b):
|
||||||
"""The great missing equivalence function: Guaranteed evaluation to a single bool value."""
|
"""The great missing equivalence function: Guaranteed evaluation to a single bool value."""
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from ..Node import Node
|
from ..Node import Node
|
||||||
from pyqtgraph.Qt import QtGui, QtCore
|
from ...Qt import QtGui, QtCore
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from .common import *
|
from .common import *
|
||||||
from pyqtgraph.SRTTransform import SRTTransform
|
from ...SRTTransform import SRTTransform
|
||||||
from pyqtgraph.Point import Point
|
from ...Point import Point
|
||||||
from pyqtgraph.widgets.TreeWidget import TreeWidget
|
from ...widgets.TreeWidget import TreeWidget
|
||||||
from pyqtgraph.graphicsItems.LinearRegionItem import LinearRegionItem
|
from ...graphicsItems.LinearRegionItem import LinearRegionItem
|
||||||
|
|
||||||
from . import functions
|
from . import functions
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from ..Node import Node
|
from ..Node import Node
|
||||||
import weakref
|
import weakref
|
||||||
#from pyqtgraph import graphicsItems
|
from ...Qt import QtCore, QtGui
|
||||||
from pyqtgraph.Qt import QtCore, QtGui
|
from ...graphicsItems.ScatterPlotItem import ScatterPlotItem
|
||||||
from pyqtgraph.graphicsItems.ScatterPlotItem import ScatterPlotItem
|
from ...graphicsItems.PlotCurveItem import PlotCurveItem
|
||||||
from pyqtgraph.graphicsItems.PlotCurveItem import PlotCurveItem
|
from ... import PlotDataItem
|
||||||
from pyqtgraph import PlotDataItem
|
|
||||||
|
|
||||||
from .common import *
|
from .common import *
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -272,4 +271,4 @@ class ScatterPlot(CtrlNode):
|
||||||
#pos = file.
|
#pos = file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from pyqtgraph.Qt import QtCore, QtGui
|
from ...Qt import QtCore, QtGui
|
||||||
from ..Node import Node
|
from ..Node import Node
|
||||||
from scipy.signal import detrend
|
from scipy.signal import detrend
|
||||||
from scipy.ndimage import median_filter, gaussian_filter
|
from scipy.ndimage import median_filter, gaussian_filter
|
||||||
#from pyqtgraph.SignalProxy import SignalProxy
|
#from ...SignalProxy import SignalProxy
|
||||||
from . import functions
|
from . import functions
|
||||||
from .common import *
|
from .common import *
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import pyqtgraph.metaarray as metaarray
|
from ... import metaarray as metaarray
|
||||||
|
|
||||||
|
|
||||||
class Downsample(CtrlNode):
|
class Downsample(CtrlNode):
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from pyqtgraph.pgcollections import OrderedDict
|
from ...pgcollections import OrderedDict
|
||||||
#from pyqtgraph import importModules
|
|
||||||
import os, types
|
import os, types
|
||||||
from pyqtgraph.debug import printExc
|
from ...debug import printExc
|
||||||
#from ..Node import Node
|
|
||||||
from ..NodeLibrary import NodeLibrary, isNodeClass
|
from ..NodeLibrary import NodeLibrary, isNodeClass
|
||||||
import pyqtgraph.reload as reload
|
from ... import reload as reload
|
||||||
|
|
||||||
|
|
||||||
# Build default library
|
# Build default library
|
||||||
|
@ -21,82 +19,10 @@ getNodeType = LIBRARY.getNodeType
|
||||||
# Add all nodes to the default library
|
# Add all nodes to the default library
|
||||||
from . import Data, Display, Filters, Operators
|
from . import Data, Display, Filters, Operators
|
||||||
for mod in [Data, Display, Filters, Operators]:
|
for mod in [Data, Display, Filters, Operators]:
|
||||||
#mod = getattr(__import__('', fromlist=[modName], level=1), modName)
|
|
||||||
#mod = __import__(modName, level=1)
|
|
||||||
nodes = [getattr(mod, name) for name in dir(mod) if isNodeClass(getattr(mod, name))]
|
nodes = [getattr(mod, name) for name in dir(mod) if isNodeClass(getattr(mod, name))]
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
LIBRARY.addNodeType(node, [(mod.__name__.split('.')[-1],)])
|
LIBRARY.addNodeType(node, [(mod.__name__.split('.')[-1],)])
|
||||||
|
|
||||||
#NODE_LIST = OrderedDict() ## maps name:class for all registered Node subclasses
|
|
||||||
#NODE_TREE = OrderedDict() ## categorized tree of Node subclasses
|
|
||||||
|
|
||||||
#def getNodeType(name):
|
|
||||||
#try:
|
|
||||||
#return NODE_LIST[name]
|
|
||||||
#except KeyError:
|
|
||||||
#raise Exception("No node type called '%s'" % name)
|
|
||||||
|
|
||||||
#def getNodeTree():
|
|
||||||
#return NODE_TREE
|
|
||||||
|
|
||||||
#def registerNodeType(cls, paths, override=False):
|
|
||||||
#"""
|
|
||||||
#Register a new node type. If the type's name is already in use,
|
|
||||||
#an exception will be raised (unless override=True).
|
|
||||||
|
|
||||||
#Arguments:
|
|
||||||
#cls - a subclass of Node (must have typ.nodeName)
|
|
||||||
#paths - list of tuples specifying the location(s) this
|
|
||||||
#type will appear in the library tree.
|
|
||||||
#override - if True, overwrite any class having the same name
|
|
||||||
#"""
|
|
||||||
#if not isNodeClass(cls):
|
|
||||||
#raise Exception("Object %s is not a Node subclass" % str(cls))
|
|
||||||
|
|
||||||
#name = cls.nodeName
|
|
||||||
#if not override and name in NODE_LIST:
|
|
||||||
#raise Exception("Node type name '%s' is already registered." % name)
|
|
||||||
|
|
||||||
#NODE_LIST[name] = cls
|
|
||||||
#for path in paths:
|
|
||||||
#root = NODE_TREE
|
|
||||||
#for n in path:
|
|
||||||
#if n not in root:
|
|
||||||
#root[n] = OrderedDict()
|
|
||||||
#root = root[n]
|
|
||||||
#root[name] = cls
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#def isNodeClass(cls):
|
|
||||||
#try:
|
|
||||||
#if not issubclass(cls, Node):
|
|
||||||
#return False
|
|
||||||
#except:
|
|
||||||
#return False
|
|
||||||
#return hasattr(cls, 'nodeName')
|
|
||||||
|
|
||||||
#def loadLibrary(reloadLibs=False, libPath=None):
|
|
||||||
#"""Import all Node subclasses found within files in the library module."""
|
|
||||||
|
|
||||||
#global NODE_LIST, NODE_TREE
|
|
||||||
|
|
||||||
#if reloadLibs:
|
|
||||||
#reload.reloadAll(libPath)
|
|
||||||
|
|
||||||
#mods = importModules('', globals(), locals())
|
|
||||||
|
|
||||||
#for name, mod in mods.items():
|
|
||||||
#nodes = []
|
|
||||||
#for n in dir(mod):
|
|
||||||
#o = getattr(mod, n)
|
|
||||||
#if isNodeClass(o):
|
|
||||||
#registerNodeType(o, [(name,)], override=reloadLibs)
|
|
||||||
|
|
||||||
#def reloadLibrary():
|
|
||||||
#loadLibrary(reloadLibs=True)
|
|
||||||
|
|
||||||
#loadLibrary()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from pyqtgraph.Qt import QtCore, QtGui
|
from ...Qt import QtCore, QtGui
|
||||||
from pyqtgraph.widgets.SpinBox import SpinBox
|
from ...widgets.SpinBox import SpinBox
|
||||||
#from pyqtgraph.SignalProxy import SignalProxy
|
#from ...SignalProxy import SignalProxy
|
||||||
from pyqtgraph.WidgetGroup import WidgetGroup
|
from ...WidgetGroup import WidgetGroup
|
||||||
#from ColorMapper import ColorMapper
|
#from ColorMapper import ColorMapper
|
||||||
from ..Node import Node
|
from ..Node import Node
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from pyqtgraph.widgets.ColorButton import ColorButton
|
from ...widgets.ColorButton import ColorButton
|
||||||
try:
|
try:
|
||||||
import metaarray
|
import metaarray
|
||||||
HAVE_METAARRAY = True
|
HAVE_METAARRAY = True
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import scipy
|
import scipy
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from pyqtgraph.metaarray import MetaArray
|
from ...metaarray import MetaArray
|
||||||
|
|
||||||
def downsample(data, n, axis=0, xvals='subsample'):
|
def downsample(data, n, axis=0, xvals='subsample'):
|
||||||
"""Downsample by averaging points together across axis.
|
"""Downsample by averaging points together across axis.
|
||||||
|
|
Loading…
Reference in New Issue