Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def plotEMGGraphs(self):
- x = self.emg_xValues
- self.plotsEMG[:] = []
- self.EMGlayout = QGridLayout()
- for i in range(self.emg_yValues.__len__()):
- plotWidget = pg.PlotWidget()
- self.plotsEMG.append(plotWidget)
- hideShowButton = QPushButton()
- self.hideAndShowButtonPlotsEMG.append(hideShowButton)
- self.hidAndShowButtonIsShowed.append(True)
- QtCore.QObject.connect(self.hideAndShowButtonPlotsEMG[i], QtCore.SIGNAL("clicked()"), functools.partial(self.showHideGraph, i))
- for i in range(self.emg_yValues.__len__()):
- # -------------- adding graphs --------------#
- y = self.emg_yValues[i]
- self.plotsEMG[i].setBackground(None)
- self.plotsEMG[i].setLabel('left', "Tension", units='V')
- self.plotsEMG[i].setLabel('bottom', "Time", units='s')
- self.plotsEMG[i].setTitle("EMG : " + str(self.emg_column_names[i+1]))
- self.plotsEMG[i].setMouseEnabled(False)
- thePenForEMG = pg.mkPen(color=(72,118,255), width=2)
- plot = self.plotsEMG[i].plot(x, y, pen=thePenForEMG)
- thePenForHandVLines = pg.mkPen(color=(166,166,166), width=2)
- hLine = pg.InfiniteLine(angle=0, movable=False, pen=thePenForHandVLines)
- self.vLines.append(pg.InfiniteLine(angle=90, movable=False, pen=thePenForHandVLines))
- self.vLines[i].setPos(self.plotEMGXRangeVLineValue)
- hLine.setPos(0)
- self.plotsEMG[i].addItem(self.vLines[i], ignoreBounds=True)
- self.plotsEMG[i].addItem(hLine, ignoreBounds=True)
- self.plotsEMG[i].setXRange(self.plotEMGXRangeMin, self.plotEMGXRangeMax, update=True)
- self.plotsEMG[i].setYRange(0-self.plotEMGYRangeMaxABS, self.plotEMGYRangeMaxABS)
- self.EMGlayout.addWidget(self.plotsEMG[i], i, 0)
- # ---------- adding hide/show button ----------#
- self.hideAndShowButtonPlotsEMG[i].setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
- self.hideAndShowButtonPlotsEMG[i].setText("Hide EMG " + str(i+1))
- self.EMGlayout.addWidget(self.hideAndShowButtonPlotsEMG[i], i, 1)
- #self.verticalLayout_17.addWidget(self.plotsEMG[i])
- previewButton = QPushButton(self.tab_4)
- previewButton.setText("Preview")
- QtCore.QObject.connect(previewButton, QtCore.SIGNAL("clicked()"), self.previewViewEMG)
- self.EMGlayout.addWidget(previewButton)
- nextButton = QPushButton(self.tab_4)
- nextButton.setText("Next")
- QtCore.QObject.connect(nextButton, QtCore.SIGNAL("clicked()"), self.nextViewEMG)
- self.EMGlayout.addWidget(nextButton)
- wid = QWidget()
- wid.setLayout(self.EMGlayout)
- scroll = QScrollArea()
- scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
- scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
- scroll.setWidgetResizable(False)
- scroll.setWidget(wid)
- sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
- scroll.setSizePolicy(sizePolicy)
- self.verticalLayout_17.addWidget(scroll)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement