Cleanup of pyqt gui
This commit is contained in:
@@ -54,43 +54,21 @@ class ecmcFFTGui(QtWidgets.QDialog):
|
||||
self.xDataValid = 0
|
||||
self.plotted_line = None
|
||||
self.ax = None
|
||||
# this is the Canvas Widget that
|
||||
# displays the 'figure'it takes the
|
||||
# 'figure' instance as a parameter to __init__
|
||||
self.canvas = FigureCanvas(self.figure)
|
||||
|
||||
# this is the Navigation widget
|
||||
# it takes the Canvas widget and a parent
|
||||
self.canvas = FigureCanvas(self.figure)
|
||||
self.toolbar = NavigationToolbar(self.canvas, self)
|
||||
|
||||
# Pause
|
||||
self.pauseBtn = QPushButton(text = 'pause')
|
||||
self.pauseBtn.setFixedSize(100, 50)
|
||||
self.pauseBtn.clicked.connect(self.pauseBtnAction)
|
||||
self.pauseBtn.setStyleSheet("background-color: green");
|
||||
|
||||
self.startval = 0
|
||||
self.pvNameY = yname # "IOC_TEST:Plugin-FFT1-Spectrum-Amp-Act"
|
||||
self.pvNameX = xname # "IOC_TEST:Plugin-FFT1-Spectrum-X-Axis-Act"
|
||||
self.connectPvs() # Epics
|
||||
|
||||
# Define the geometry of the main window
|
||||
self.connectPvs() # Epics
|
||||
self.setGeometry(300, 300, 900, 700)
|
||||
self.setWindowTitle("ecmc FFT plot: " + self.pvNameY + ' vs ' + self.pvNameX)
|
||||
|
||||
# creating a Vertical Box layout
|
||||
layout = QVBoxLayout()
|
||||
|
||||
# adding tool bar to the layout
|
||||
layout.addWidget(self.toolbar)
|
||||
|
||||
# adding canvas to the layout
|
||||
layout.addWidget(self.canvas)
|
||||
|
||||
# adding push button to the layout
|
||||
layout.addWidget(self.pauseBtn)
|
||||
|
||||
# setting layout to the main window
|
||||
self.setLayout(layout)
|
||||
return
|
||||
|
||||
@@ -113,16 +91,13 @@ class ecmcFFTGui(QtWidgets.QDialog):
|
||||
#print('self.pvY: ' + self.pvY.info)
|
||||
|
||||
self.pvX.add_callback(self.onChangePvX)
|
||||
self.pvY.add_callback(self.onChangePvY)
|
||||
#self.myFig.addData(self.startval)
|
||||
self.pvY.add_callback(self.onChangePvY)
|
||||
QCoreApplication.processEvents()
|
||||
|
||||
def onChangePvX(self,pvname=None, value=None, char_value=None,timestamp=None, **kw):
|
||||
#print ('PV X Changed! ', pvname, char_value, time.ctime())
|
||||
self.comSignalX.data_signal.emit(value)
|
||||
|
||||
def onChangePvY(self,pvname=None, value=None, char_value=None,timestamp=None, **kw):
|
||||
#print ('PV Y Changed! ', pvname, char_value, time.ctime())
|
||||
self.comSignalY.data_signal.emit(value)
|
||||
|
||||
def pauseBtnAction(self):
|
||||
@@ -136,23 +111,17 @@ class ecmcFFTGui(QtWidgets.QDialog):
|
||||
|
||||
|
||||
def callbackFuncX(self, value):
|
||||
#print ('Callback X: ' + str(np.size(value)) )# + value )
|
||||
if(np.size(value)) > 0:
|
||||
self.spectX = value
|
||||
self.xDataValid = 1
|
||||
return
|
||||
|
||||
def callbackFuncY(self, value):
|
||||
#print ('Callback y: ')# + value )
|
||||
if(np.size(value)) > 0:
|
||||
self.spectY = value
|
||||
self.plotSpect()
|
||||
return
|
||||
|
||||
def setYLabel(self,label):
|
||||
#self.myFig.setYLabel(label)
|
||||
return
|
||||
|
||||
def plotSpect(self):
|
||||
if self.pause:
|
||||
print('paused!')
|
||||
@@ -182,8 +151,8 @@ class ecmcFFTGui(QtWidgets.QDialog):
|
||||
self.ax.autoscale(enable=False)
|
||||
|
||||
def printOutHelp():
|
||||
print("ecmcFFTGui: Plots waveforms of FFT data (updates when on Y data callback) ")
|
||||
print("python ecmcFFTGui.py [<x.pv>,<y.pv>]")
|
||||
print("ecmcFFTGui: Plots waveforms of FFT data (updates on Y data callback). ")
|
||||
print("python ecmcFFTGui.py <x.pv> <y.pv>")
|
||||
print("example: python ecmcFFTGui.py IOC_TEST:Plugin-FFT1-Spectrum-X-Axis-Act IOC_TEST:Plugin-FFT1-Spectrum-Amp-Act")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user