Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MX Energy Scan GUI changes #223

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions lsdcGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1908,15 +1908,21 @@ def createSampleTab(self):
if (daq_utils.beamline == "fmx"):
if (getBlConfig("attenType") == "RI"):
self.transmissionReadback = QtEpicsPVLabel(daq_utils.pvLookupDict["RI_Atten_SP"],self,60,3)
self.escan_transmissionReadback = QtEpicsPVLabel(daq_utils.pvLookupDict["RI_Atten_SP"],self,60,3)
self.transmissionSetPoint = QtEpicsPVEntry(daq_utils.pvLookupDict["RI_Atten_SP"],self,60,3)
self.escan_transmissionSetPoint = QtEpicsPVEntry(daq_utils.pvLookupDict["RI_Atten_SP"],self,60,3)
colTransmissionLabel = QtWidgets.QLabel('Transmission (RI) (0.0-1.0):')
else:
self.transmissionReadback = QtEpicsPVLabel(daq_utils.pvLookupDict["transmissionRBV"],self,60,3)
self.escan_transmissionReadback = QtEpicsPVLabel(daq_utils.pvLookupDict["transmissionRBV"],self,60,3)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense to show the escan readback? it is the same PV as "normal" transmission, so they should be the same, right?

self.transmissionSetPoint = QtEpicsPVEntry(daq_utils.pvLookupDict["transmissionSet"],self,60,3)
self.escan_transmissionSetPoint = QtEpicsPVEntry(daq_utils.pvLookupDict["transmissionSet"],self,60,3)
colTransmissionLabel = QtWidgets.QLabel('Transmission (BCU) (0.0-1.0):')
else:
self.transmissionReadback = QtEpicsPVLabel(daq_utils.pvLookupDict["transmissionRBV"],self,60,3)
self.escan_transmissionReadback = QtEpicsPVLabel(daq_utils.pvLookupDict["transmissionRBV"],self,60,3)
self.transmissionSetPoint = QtEpicsPVEntry(daq_utils.pvLookupDict["transmissionSet"],self,60,3)
self.escan_transmissionSetPoint = QtEpicsPVEntry(daq_utils.pvLookupDict["transmissionSet"],self,60,3)
colTransmissionLabel = QtWidgets.QLabel('Transmission (0.0-1.0):')
self.transmissionReadback_ledit = self.transmissionReadback.getEntry()

Expand Down Expand Up @@ -2029,7 +2035,7 @@ def createSampleTab(self):
self.protoOtherRadio = QtWidgets.QRadioButton("other")
self.protoOtherRadio.setEnabled(False)
self.protoRadioGroup.addButton(self.protoOtherRadio)
protoOptionList = ["standard","screen","raster","vector","burn","eScan","rasterScreen","stepRaster","stepVector","multiCol","characterize","ednaCol","specRaster"] # these should probably come from db
protoOptionList = ["standard","screen","raster","vector","burn","rasterScreen","stepRaster","stepVector","multiCol","characterize","ednaCol","specRaster"] # these should probably come from db
self.protoComboBox = QtWidgets.QComboBox(self)
self.protoComboBox.addItems(protoOptionList)
self.protoComboBox.activated[str].connect(self.protoComboActivatedCB)
Expand Down Expand Up @@ -2490,6 +2496,15 @@ def createSampleTab(self):
tempPlotButton.clicked.connect(self.queueEnScanCB)
clearEnscanPlotButton = QtWidgets.QPushButton("Clear")
clearEnscanPlotButton.clicked.connect(self.clearEnScanPlotCB)
escanTransmissionLabel = QtWidgets.QLabel("Transmission")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the transmission in the escan interface the same as in the main collection area? what is different about it?

some more explanation would help me understand the logic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention is that the setpoint is different for each tab, but the RBV has a duplicate label to allow it to be displayed on both tabs.

self.escan_transmissionReadback_ledit = self.transmissionReadback.getEntry()
escanTransmissionSPLabel = QtWidgets.QLabel("SetPoint:")
self.escan_transmission_ledit = self.escan_transmissionSetPoint.getEntry()
self.escan_transmission_ledit.returnPressed.connect(self.setEScanTransCB)
hBoxEScanButtons.addWidget(escanTransmissionLabel)
hBoxEScanButtons.addWidget(self.escan_transmissionReadback_ledit)
hBoxEScanButtons.addWidget(escanTransmissionSPLabel)
hBoxEScanButtons.addWidget(self.escan_transmission_ledit)
hBoxEScanButtons.addWidget(clearEnscanPlotButton)
hBoxEScanButtons.addWidget(tempPlotButton)
escanStepsLabel = QtWidgets.QLabel("Steps")
Expand Down Expand Up @@ -3046,7 +3061,7 @@ def processSampMove(self,posRBV,motID):
self.vecLine.setLine(self.vectorStart["graphicsitem"].x()+self.vectorStart["centerCursorX"]+self.centerMarkerCharOffsetX,self.vectorStart["graphicsitem"].y()+self.vectorStart["centerCursorY"]+self.centerMarkerCharOffsetY,self.vectorEnd["graphicsitem"].x()+self.vectorStart["centerCursorX"]+self.centerMarkerCharOffsetX,self.vectorEnd["graphicsitem"].y()+self.vectorStart["centerCursorY"]+self.centerMarkerCharOffsetY)

def queueEnScanCB(self):
self.protoComboBox.setCurrentIndex(self.protoComboBox.findText(str("eScan")))
self.protoComboBox.setCurrentText("eScan")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you remove the eScan protocol as an option from the combo box but add it back in text? can you explain why you did this?

maybe you can show me how the user is supposed to do the escan (which screens to go to, how to start, etc.) and then maybe it will become more obvious to me how this is supposed to work

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct, it is unusual. EScan is removed from the combo box list while on the main screen, so it can not be found with the "findText" when you queue from the e-scan tab. It does not appear on the list, instead the combo box on the main screen shows a blank when you switch back.

Overall it prevents you from queueing e-scans from the main tab and automatically applies it as the selected type when on the e-scan tab.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that it's hacking the protocol system and the combo box.

can you do something like have a callback monitor for the combo box, then bring up the eScan tab when that protocol is selected?

self.addRequestsToAllSelectedCB()
self.treeChanged_pv.put(1)

Expand Down Expand Up @@ -3661,6 +3676,18 @@ def calcLifetimeCB(self):
self.sampleLifetimeReadback_ledit.setText(lifeTime_s)
self.sampleLifetimeReadback_ledit.setStyleSheet("color : green");

def setEScanTransCB(self):
try:
if (float(self.escan_transmission_ledit.text()) > 1.0 or float(self.escan_transmission_ledit.text()) < 0.001):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any fundamental difference between this and setTransCB? couldn't you refactor setTransCB so it can work with this?

self.popupServerMessage("Transmission must be 0.001-1.0")
return
except ValueError as e:
self.popupServerMessage("Please enter a valid number")
return
comm_s = "setTrans(" + str(self.escan_transmission_ledit.text()) + ")"
logger.info(comm_s)
self.send_to_server(comm_s)


def setTransCB(self):
if (float(self.transmission_ledit.text()) > 1.0 or float(self.transmission_ledit.text()) < 0.001):
Expand Down