How to use the plottr.Signal function in plottr

To help you get started, we’ve selected a few plottr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github data-plottr / plottr / plottr / apps / ui / monitr.py View on Github external
if os.path.isdir(abspath):
            ret_ = findFilesByExtension(abspath, extensions)
            if len(ret_) > 0:
                ret += ret_
        else:
            if os.path.splitext(c)[-1] in extensions:
                ret += [abspath]
    return ret


class DataFileContent(QtWidgets.QTreeWidget):

    #: Signal(str) -- Emitted when the user requests a plot for datadict
    #: Arguments:
    #:   - name of the group within the currently selected file
    plotRequested = Signal(str)

    def __init__(self, parent=None):
        super().__init__(parent)

        self.data = {}
        self.groupItems = []
        self.selectedGroup = None

        self.dataPopup = QtWidgets.QMenu('Data actions', self)
        self.plotAction = self.dataPopup.addAction("Plot")
        self.plotAction.triggered.connect(self.onPlotActionTriggered)


    @Slot(object)
    def setData(self, data: Dict[str, DataDict]):
        """Set the data to display."""
github data-plottr / plottr / plottr / node / node.py View on Github external
#: arguments is a dictionary of options and new values.
    optionChangeNotification = QtCore.pyqtSignal(dict)

    #: signal emitted when available data axes change
    #: emits a the list of names of new axes
    dataAxesChanged = Signal(list)

    #: signal emitted when any available data fields change (dep. and indep.)
    #: emits a the list of names of new axes
    dataFieldsChanged = Signal(list)

    #: signal emitted when data type changes
    dataTypeChanged = Signal(object)

    #: signal emitted when data structure changes (fields, or dtype)
    dataStructureChanged = Signal(object)

    #: signal emitted when data shapes change
    dataShapesChanged = Signal(dict)

    #: when data structure changes, emits (structure, shapes, type)
    newDataStructure = QtCore.pyqtSignal(object, object, object)

    #: developer flag for whether we actually want to raise of use the logging
    #: system
    _raiseExceptions = False

    def __init__(self, name: str):
        """Create a new instance of the Node.

        :param name: name of the instance.
        """
github data-plottr / plottr / plottr / node / filter / correct_offset.py View on Github external
from typing import List

from plottr import QtGui, Signal, Slot
from plottr.node import Node, NodeWidget, updateOption
from plottr.node.node import updateGuiQuietly, emitGuiUpdate
from plottr.gui.widgets import FormLayoutWrapper
from plottr.data.datadict import DataDictBase, MeshgridDataDict


class DimensionCombo(QtGui.QComboBox):
    dimensionSelected = Signal(str)

    def __init__(self, parent=None, dimensionType='axes'):
        super().__init__(parent)

        self.node = None
        self.dimensionType = dimensionType

        self.clear()
        self.entries = ['None']
        for e in self.entries:
            self.addItem(e)

        self.currentTextChanged.connect(self.signalDimensionSelection)

    def connectNode(self, node: Node = None):
        self.node = node
github data-plottr / plottr / plottr / plot / base.py View on Github external
__license__ = 'MIT'


class PlotNode(Node):
    """
    Basic Plot Node, derived from :class:`plottr.node.node.Node`.

    At the moment this doesn't do much besides passing data to the plotting widget.
    Data is just passed through.
    On receipt of new data, :attr:`newPlotData` is emitted.
    """
    nodeName = 'Plot'

    #: Signal emitted when :meth:`process` is called, with the data passed to
    #: it as argument.
    newPlotData = Signal(object)

    def __init__(self, name: str):
        """Constructor for :class:`PlotNode`. """
        super().__init__(name=name)
        self.plotWidgetContainer = None

    def setPlotWidgetContainer(self, w: 'PlotWidgetContainer'):
        """Set the plot widget container.

        Makes sure that newly arriving data is sent to plot GUI elements.

        :param w: container to connect the node to.
        """
        self.plotWidgetContainer = w
        self.newPlotData.connect(self.plotWidgetContainer.setData)
github data-plottr / plottr / plottr / node / node.py View on Github external
#: signal emitted when available data axes change
    #: emits a the list of names of new axes
    dataAxesChanged = Signal(list)

    #: signal emitted when any available data fields change (dep. and indep.)
    #: emits a the list of names of new axes
    dataFieldsChanged = Signal(list)

    #: signal emitted when data type changes
    dataTypeChanged = Signal(object)

    #: signal emitted when data structure changes (fields, or dtype)
    dataStructureChanged = Signal(object)

    #: signal emitted when data shapes change
    dataShapesChanged = Signal(dict)

    #: when data structure changes, emits (structure, shapes, type)
    newDataStructure = QtCore.pyqtSignal(object, object, object)

    #: developer flag for whether we actually want to raise of use the logging
    #: system
    _raiseExceptions = False

    def __init__(self, name: str):
        """Create a new instance of the Node.

        :param name: name of the instance.
        """
        super().__init__(name, terminals=self.__class__.terminals)

        self.signalUpdate = True
github data-plottr / plottr / plottr / node / node.py View on Github external
uiVisibleByDefault = False

    #: A signal to notify the UI of option changes
    #: arguments is a dictionary of options and new values.
    optionChangeNotification = QtCore.pyqtSignal(dict)

    #: signal emitted when available data axes change
    #: emits a the list of names of new axes
    dataAxesChanged = Signal(list)

    #: signal emitted when any available data fields change (dep. and indep.)
    #: emits a the list of names of new axes
    dataFieldsChanged = Signal(list)

    #: signal emitted when data type changes
    dataTypeChanged = Signal(object)

    #: signal emitted when data structure changes (fields, or dtype)
    dataStructureChanged = Signal(object)

    #: signal emitted when data shapes change
    dataShapesChanged = Signal(dict)

    #: when data structure changes, emits (structure, shapes, type)
    newDataStructure = QtCore.pyqtSignal(object, object, object)

    #: developer flag for whether we actually want to raise of use the logging
    #: system
    _raiseExceptions = False

    def __init__(self, name: str):
        """Create a new instance of the Node.
github data-plottr / plottr / plottr / node / node.py View on Github external
#: instance of the widget is created, and signal/slots are connected.
    uiClass = None

    #: Whether or not to automatically set up a UI widget.
    useUi = True

    #: Whether the ui should be visible by default
    uiVisibleByDefault = False

    #: A signal to notify the UI of option changes
    #: arguments is a dictionary of options and new values.
    optionChangeNotification = QtCore.pyqtSignal(dict)

    #: signal emitted when available data axes change
    #: emits a the list of names of new axes
    dataAxesChanged = Signal(list)

    #: signal emitted when any available data fields change (dep. and indep.)
    #: emits a the list of names of new axes
    dataFieldsChanged = Signal(list)

    #: signal emitted when data type changes
    dataTypeChanged = Signal(object)

    #: signal emitted when data structure changes (fields, or dtype)
    dataStructureChanged = Signal(object)

    #: signal emitted when data shapes change
    dataShapesChanged = Signal(dict)

    #: when data structure changes, emits (structure, shapes, type)
    newDataStructure = QtCore.pyqtSignal(object, object, object)
github data-plottr / plottr / plottr / node / node.py View on Github external
useUi = True

    #: Whether the ui should be visible by default
    uiVisibleByDefault = False

    #: A signal to notify the UI of option changes
    #: arguments is a dictionary of options and new values.
    optionChangeNotification = QtCore.pyqtSignal(dict)

    #: signal emitted when available data axes change
    #: emits a the list of names of new axes
    dataAxesChanged = Signal(list)

    #: signal emitted when any available data fields change (dep. and indep.)
    #: emits a the list of names of new axes
    dataFieldsChanged = Signal(list)

    #: signal emitted when data type changes
    dataTypeChanged = Signal(object)

    #: signal emitted when data structure changes (fields, or dtype)
    dataStructureChanged = Signal(object)

    #: signal emitted when data shapes change
    dataShapesChanged = Signal(dict)

    #: when data structure changes, emits (structure, shapes, type)
    newDataStructure = QtCore.pyqtSignal(object, object, object)

    #: developer flag for whether we actually want to raise of use the logging
    #: system
    _raiseExceptions = False
github data-plottr / plottr / plottr / apps / monitr.py View on Github external
import h5py

from .. import QtCore, QtWidgets, Signal, Slot
from ..data.datadict import DataDict
from ..data.datadict_storage import datadict_from_hdf5, all_datadicts_from_hdf5
from ..apps.autoplot import autoplotDDH5

from .ui.Monitr_UI import Ui_MainWindow


class Monitr(QtWidgets.QMainWindow):

    #: Signal(object) -- emitted when a valid data file is selected.
    #: Arguments:
    #:  - a dictionary containing the datadicts found in the file (as top-level groups)
    dataFileSelected = Signal(object)

    def __init__(self, monitorPath: str = '.', refreshInterval: int = 1,
                 parent=None):

        super().__init__(parent=parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.plotDialogs = {}
        self.selectedFile = None
        self.newFiles = []

        self.monitorPath = os.path.abspath(monitorPath)
        self.refreshInterval = refreshInterval
        self.refreshFiles = partial(self.ui.fileList.loadFromPath, self.monitorPath,
                                    emitNew=True)
github data-plottr / plottr / plottr / apps / autoplot.py View on Github external
if inputData is not None:
        win.setInput(data=inputData)

    return fc, win


class UpdateToolBar(QtGui.QToolBar):
    """
    A very simple toolbar to enable monitoring or triggering based on a timer.
    Contains a timer whose interval can be set.
    The toolbar will then emit a signal each interval.
    """

    #: Signal emitted after each trigger interval
    trigger = Signal()

    def __init__(self, name, parent=None):
        super().__init__(name, parent)

        self.monitorInput = MonitorIntervalInput()
        self.monitorInput.setToolTip('Set to 0 for disabling triggering')
        self.monitorInput.intervalChanged.connect(self.setMonitorInterval)
        self.addWidget(self.monitorInput)

        self.monitor = QtCore.QTimer()
        self.monitor.timeout.connect(self.monitorTriggered)

    Slot()
    def monitorTriggered(self):
        """
        Is called whenever the monitor timer triggers, and emit the