Exemplo n.º 1
0
 def createActions(self):
     self.insertDatasetAction = QtGui.QAction(QtGui.QIcon(), 'Insert dataset', self,
                                        statusTip='Create and insert a dataset under currently selected group',
                                        triggered=self.insertDataset)
     self.insertGroupAction  = QtGui.QAction(QtGui.QIcon(), 'Insert group', self,
                                        statusTip='Create and insert a group under currently selected group',
                                        triggered=self.insertGroup)
     self.deleteNodeAction = QtGui.QAction(QtGui.QIcon(), 'Delete node', self,
                                     statusTip='Delete the currently selected node.',
                                     triggered=self.deleteNode)        
Exemplo n.º 2
0
    def initUI(self):
        self.setWindowTitle('Serial Plot Monitor')

        self.plot_button = QPushButton("start", self)
        self.plot_button.setCheckable(True)
        self.plot_button.toggled.connect(self.slot_plot_button_toggled)
        self.plot_button.setIcon(QtGui.QIcon('resource/icon1.jpg'))

        self.reset_button = QPushButton("reset", self)
        self.reset_button.clicked.connect(self.slot_reset_button_pushed)
        self.reset_button.setIcon(QtGui.QIcon('resource/icon2.jpg'))

        self.save_button = QPushButton("save", self)
        self.save_button.clicked.connect(self.slot_save_button_pushed)
        self.save_button.setIcon(QtGui.QIcon('resource/IMG_1776.PNG'))

        self.label1 = QLabel("baudrate: " + '%d' % self.ser.baudrate())
        self.label2 = QLabel("port: " + self.ser.port())
        self.spinbox = QSpinBox(self)
        self.spinbox.setPrefix("series: ")
        self.spinbox.setRange(1, 4)

        self.guiplot = pg.PlotWidget()
        self.guiplot.plotItem.getAxis('left').setTickSpacing(major=1,
                                                             minor=0.1)
        self.guiplot.plotItem.getAxis('bottom').setTickSpacing(major=1,
                                                               minor=0.1)
        self.zoomplot = pg.PlotWidget()
        self.zoomplot.plotItem.getAxis('left').setTickSpacing(major=1,
                                                              minor=0.1)
        self.zoomplot.plotItem.getAxis('bottom').setTickSpacing(major=1,
                                                                minor=0.1)

        layout2 = QHBoxLayout()
        layout2.addWidget(self.plot_button)
        layout2.addWidget(self.reset_button)
        layout2.addWidget(self.save_button)

        layout3 = QHBoxLayout()
        layout3.addWidget(self.label1)
        layout3.addWidget(self.label2)
        layout3.addWidget(self.spinbox)

        layout = QVBoxLayout()
        layout.addWidget(self.guiplot)
        layout.addWidget(self.zoomplot)

        layout.addLayout(layout3)
        layout.addLayout(layout2)
        self.setLayout(layout)

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.update_graph)
Exemplo n.º 3
0
 def createActions(self):
     self.openFileReadOnlyAction = QtGui.QAction(
         QtGui.QIcon(),
         'Open file(s) readonly',
         self,
         shortcut=QtGui.QKeySequence.Open,
         statusTip='Open an HDF5 file for reading',
         triggered=self.openFilesReadOnly)
     self.openFileReadWriteAction = QtGui.QAction(
         QtGui.QIcon(),
         '&Open file(s) read/write',
         self,
         # shortcut=QtGui.QKeySequence.Open,
         statusTip='Open an HDF5 file for editing',
         triggered=self.openFilesReadWrite)
     self.openFileOverwriteAction = QtGui.QAction(
         QtGui.QIcon(),
         'Overwrite file',
         self,
         # shortcut=QtGui.QKeySequence.Open,
         statusTip='Open an HDF5 file for writing (overwrite existing)',
         triggered=self.openFileOverwrite)
     self.createFileAction = QtGui.QAction(
         QtGui.QIcon(),
         '&New file',
         self,
         shortcut=QtGui.QKeySequence.New,
         statusTip='Create a new HDF5 file',
         triggered=self.createFile)
     self.closeFileAction = QtGui.QAction(
         QtGui.QIcon(),
         '&Close file(s)',
         self,
         shortcut=QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_K),
         statusTip='Close selected files',
         triggered=self.sigCloseFiles)
     self.quitAction = QtGui.QAction(QtGui.QIcon(),
                                     '&Quit',
                                     self,
                                     shortcut=QtGui.QKeySequence.Quit,
                                     statusTip='Quit dataviz',
                                     triggered=self.doQuit)
     self.showAttributesAction = QtGui.QAction(
         QtGui.QIcon(),
         'Show attributes',
         self,
         shortcut=QtGui.QKeySequence(QtCore.Qt.Key_Return),
         statusTip='Show attributes',
         triggered=self.sigShowAttributes)
     self.showDatasetAction = QtGui.QAction(
         QtGui.QIcon(),
         'Show dataset',
         self,
         shortcut=QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_Return),
         statusTip='Show dataset',
         triggered=self.sigShowDataset)
     self.plotDatasetAction = QtGui.QAction(
         QtGui.QIcon(),
         'Plot dataset',
         self,
         shortcut=QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_P),
         statusTip='Plot dataset',
         triggered=self.sigPlotDataset)
Exemplo n.º 4
0
    [7., 10, 15, 5, 13],
    [8., 13, 20, 9, 17],
    [9., 17, 23, 11, 14],
    [10., 14, 19, 5, 15],
    [11., 15, 22, 8, 9],
]

mycandle = CandleStick()  #instantiate a candlestick object
mycandle.set_data(data)  # reference the data

#plt = pg.PlotItem.plot(title=mytitle)
plt = pg.plot(title=mytitle)
plt.addItem(mycandle)

#plt.setXRange(data[-5][0],data[-1][0]+1)
plt.setWindowIcon(QtGui.QIcon("icon-mongol.jpg"))  # no icon??
plt.showAxis('right')  # set attributes of chart
plt.hideAxis('left')
plt.showGrid(x=True, y=True, alpha=1.0)
plt.addLine(y=10)
#plt.setAutoPan(x=True) # my try


def update():
    global mycandle, data
    data_len = len(data)
    rand = random.randint(0, len(data) - 1)
    new_bar = data[rand][:]
    new_bar[0] = data_len + 1
    data.append(new_bar)
    #ptr += 1
Exemplo n.º 5
0
def getIcon(name, size=(20, 20)):
    icon = QtGui.QIcon(op.join(op.dirname(__file__), name + ".png"))
    return icon.pixmap(*size)
Exemplo n.º 6
0
import pyqtgraph as pg
##from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph import QtCore, QtGui
import numpy as np
from time import sleep

win = pg.GraphicsWindow()
win.setWindowTitle('Sliding Window Test')
win.setWindowIcon(QtGui.QIcon("icon-mongol.jpg"))

p1 = win.addPlot()
p1.setLabels(left='Large Range')

## create third ViewBox.
## this time we need to create a new axis as well.
p3 = pg.ViewBox()
ax3 = pg.AxisItem('right')
p1.layout.addItem(ax3, 2, 3)
p1.scene().addItem(p3)
ax3.linkToView(p3)
p3.setXLink(p1)
ax3.setZValue(-10000)
ax3.setLabel('Small Range', color='#ff0000')

win.nextRow()
p5 = win.addPlot()
p5.setLabels(left='Large Range')

## create third ViewBox.
## this time we need to create a new axis as well.
p7 = pg.ViewBox()