How to use the plottr.QtGui 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 / test / gui / dimension_assignment_widgets.py View on Github external
def _makeSlider(self, value=0):
        npts = 5
        w = QtGui.QSlider(0x01)
        w.setMinimum(0)
        w.setMaximum(npts-1)
        w.setSingleStep(1)
        w.setPageStep(1)
        w.setTickInterval(10)
        w.setTickPosition(QtGui.QSlider.TicksBelow)
        w.setValue(value)
        return w
github data-plottr / plottr / test / gui / dimension_assignment_widgets.py View on Github external
def _makeSlider(self, value=0):
        npts = 5
        w = QtGui.QSlider(0x01)
        w.setMinimum(0)
        w.setMaximum(npts-1)
        w.setSingleStep(1)
        w.setPageStep(1)
        w.setTickInterval(10)
        w.setTickPosition(QtGui.QSlider.TicksBelow)
        w.setValue(value)
        return w
github data-plottr / plottr / plottr / gui / widgets.py View on Github external
def __init__(self, parent=None):
        super().__init__(parent)

        self.spin = QtGui.QSpinBox()
        layout = QtGui.QFormLayout()
        layout.addRow('Refresh interval (s)', self.spin)
        self.setLayout(layout)

        self.spin.valueChanged.connect(self.spinValueChanged)

    @QtCore.pyqtSlot(int)
    def spinValueChanged(self, val):
        self.intervalChanged.emit(val)


class PlotWindow(QtGui.QMainWindow):
    """
    Simple MainWindow class for embedding flowcharts and plots.

    All keyword arguments supplied will be propagated to
    :meth:`addNodeWidgetFromFlowchart`.
    """

    plotWidgetClass = MPLAutoPlot

    def __init__(self, parent=None, fc: Flowchart = None, **kw):
        super().__init__(parent)

        self.plot = PlotWidgetContainer(parent=self)
        self.setCentralWidget(self.plot)
        self.plotWidget = None
github data-plottr / plottr / plottr / gui / data_display.py View on Github external
"""data_display_widgets.py

UI elements for inspecting data structure and content.
"""

from typing import Union, List, Tuple, Dict

from .. import QtGui, QtCore
from ..data.datadict import DataDictBase


class DataSelectionWidget(QtGui.QTreeWidget):
    """A simple tree widget to show data fields and dependencies."""

    #: signal (List[str]) that is emitted when the selection is modified.
    dataSelectionMade = QtCore.pyqtSignal(list)

    def __init__(self, parent: QtGui.QWidget = None, readonly: bool = False):
        super().__init__(parent)

        self.setColumnCount(3)
        self.setHeaderLabels(['Name', 'Dependencies', 'Size'])
        self.dataItems = {}

        self._dataStructure = DataDictBase()
        self._dataShapes = {}
        self._readonly = readonly
github data-plottr / plottr / plottr / apps / autoplot.py View on Github external
self.fc = fc
        if loaderName is not None:
            self.loaderNode = fc.nodes()[loaderName]
        else:
            self.loaderNode = None

        # a flag we use to set reasonable defaults when the first data
        # is processed
        self._initialized = False

        windowTitle = "Plottr | Autoplot"
        self.setWindowTitle(windowTitle)

        # status bar
        self.status = QtGui.QStatusBar()
        self.setStatusBar(self.status)

        # menu bar
        self.menu = self.menuBar()
        self.fileMenu = self.menu.addMenu('&Data')

        if self.loaderNode is not None:
            refreshAction = QtGui.QAction('&Refresh', self)
            refreshAction.setShortcut('R')
            refreshAction.triggered.connect(self.refreshData)
            self.fileMenu.addAction(refreshAction)

        # add monitor if needed
        if monitor:
            self.monitorToolBar = UpdateToolBar('Monitor data')
            self.addToolBar(self.monitorToolBar)
github data-plottr / plottr / plottr / apps / ui / monitr.py View on Github external
def add(parent, name):
            item = self.find(parent, name)
            if item is None:
                item = QtWidgets.QTreeWidgetItem(parent, [name])
                if os.path.splitext(name)[-1] in self.fileExtensions:
                    fnt = QtGui.QFont()
                    item.setFont(0, fnt)
                else:
                    pass
                if isinstance(parent, DataFileList):
                    parent.addTopLevelItem(item)
                else:
                    parent.addChild(item)
            return item
github data-plottr / plottr / apps / monitr.py View on Github external
import sys
import os
import argparse

from plottr import QtGui
from plottr.apps.monitr import Monitr

QtWidgets = QtGui


def main(path, refresh_interval):
    app = QtWidgets.QApplication([])
    win = Monitr(path, refresh_interval)
    win.show()
    return app.exec_()


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Monitr main application')
    parser.add_argument("path", help="path to monitor for data", default=None)
    parser.add_argument("-r", "--refresh_interval", default=2,
                        help="interval at which to look for changes in the "
                             "monitored path (in seconds)")
    args = parser.parse_args()
github data-plottr / plottr / plottr / gui / tools.py View on Github external
def widgetDialog(widget: QtGui.QWidget, title: str = '',
                 show: bool = True) -> QtGui.QDialog:
    win = QtGui.QDialog()
    win.setWindowTitle('plottr ' + title)
    layout = QtGui.QVBoxLayout()
    layout.addWidget(widget)
    win.setLayout(layout)
    if show:
        win.show()

    return win