diff --git a/gui/control_main.py b/gui/control_main.py index 03390db8..75f21f38 100644 --- a/gui/control_main.py +++ b/gui/control_main.py @@ -395,6 +395,7 @@ def createSampleTab(self): colStartLabel.setFixedWidth(140) colStartLabel.setAlignment(QtCore.Qt.AlignCenter) self.osc_start_ledit = QtWidgets.QLineEdit() + self.setGuiValues({"osc_start": "0.0"}) self.osc_start_ledit.setFixedWidth(60) self.osc_start_ledit.setValidator(QtGui.QDoubleValidator()) self.colEndLabel = QtWidgets.QLabel("Oscillation Range:") @@ -599,6 +600,7 @@ def createSampleTab(self): self.detDistRBVLabel = QtEpicsPVLabel( daq_utils.motor_dict["detectorDist"] + ".RBV", self, 70 ) + self.detDistTextChanged(self.detDistRBVLabel.getEntry().text()) detDistSPLabel = QtWidgets.QLabel("SetPoint:") self.detDistMotorEntry = QtEpicsPVEntry( daq_utils.motor_dict["detectorDist"] + ".VAL", self, 70, 2 @@ -4454,8 +4456,8 @@ def unmountSampleCB(self): self.send_to_server("unmountSample") - def refreshCollectionParams(self, selectedSampleRequest, validate_hdf5=True): - reqObj = selectedSampleRequest["request_obj"] + def fillRequestParameters(self, reqObj): + """Fills UI elements based on reqObj dictionary passed to it""" self.protoComboBox.setCurrentIndex( self.protoComboBox.findText(str(reqObj["protocol"])) ) @@ -4498,9 +4500,9 @@ def refreshCollectionParams(self, selectedSampleRequest, validate_hdf5=True): energy_s = str(daq_utils.wave2energy(reqObj["wavelength"], digits=6)) dist_s = str(reqObj["detDist"]) self.detDistMotorEntry.getEntry().setText(str(dist_s)) - self.dataPathGB.setFilePrefix_ledit(str(reqObj["file_prefix"])) - self.dataPathGB.setBasePath_ledit(str(reqObj["basePath"])) - self.dataPathGB.setDataPath_ledit(str(reqObj["directory"])) + + def refreshCollectionParams(self, selectedSampleRequest, validate_hdf5=True): + reqObj = selectedSampleRequest["request_obj"] if ( str(reqObj["protocol"]) == "characterize" or str(reqObj["protocol"]) == "ednaCol" diff --git a/gui/data_loc_info.py b/gui/data_loc_info.py index 999c1839..41d1d2b5 100644 --- a/gui/data_loc_info.py +++ b/gui/data_loc_info.py @@ -45,6 +45,7 @@ def __init__(self, parent: "ControlMain"): self.hBoxDPathParams2.addWidget(self.prefix_ledit) self.dataNumstartLabel = QtWidgets.QLabel("File Number Start:") self.file_numstart_ledit = QtWidgets.QLineEdit() + self.file_numstart_ledit.setText("1") self.file_numstart_ledit.setValidator(QtGui.QIntValidator(1, 99999, self)) self.file_numstart_ledit.setFixedWidth(50) self.hBoxDPathParams3 = QtWidgets.QHBoxLayout() diff --git a/gui/dewar_tree.py b/gui/dewar_tree.py index 186b1f03..72135b6f 100644 --- a/gui/dewar_tree.py +++ b/gui/dewar_tree.py @@ -42,6 +42,7 @@ def __init__(self, parent: "ControlMain"): # self.isExpanded = 1 self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.openMenu) + self.setStyleSheet("QTreeView::item::hover{background-color: #999966;}") # Keeps track of whether the user is part of a proposal self.proposal_membership = {} @@ -59,6 +60,8 @@ def openMenu(self, position): level = list(selectedLevels)[0] menu = QtWidgets.QMenu() if level == 2: # This is usually a request + useParamsAction = QtWidgets.QAction('Use Request Parameters', self) + useParamsAction.triggered.connect(self.useParamsCB) deleteReqAction = QtWidgets.QAction( "Delete selected request(s)", self ) @@ -73,6 +76,7 @@ def openMenu(self, position): "Dequeue selected request(s)", self ) dequeueSelAction.triggered.connect(self.deQueueAllSelectedCB) + menu.addAction(useParamsAction) menu.addAction(cloneReqAction) menu.addAction(queueSelAction) menu.addAction(dequeueSelAction) @@ -80,6 +84,38 @@ def openMenu(self, position): menu.addAction(deleteReqAction) menu.exec_(self.viewport().mapToGlobal(position)) + def useParamsCB(self): + index = self.selectedIndexes()[0] + item = self.model.itemFromIndex(index) + requestData = db_lib.getRequestByID(item.data(32)) + reqObj = requestData['request_obj'] + self.parent.fillRequestParameters(reqObj) + + def fillToolTip(self, data): + text = "" + table_data = {} + if 'request_obj' in data: + req_data = data['request_obj'] + table_data['Exposure Time'] = req_data['exposure_time'] + table_data['Transmission'] = req_data['attenuation'] + table_data['Oscillation Width'] = req_data['img_width'] + table_data['Oscillation Range'] = req_data['sweep_end'] - req_data['sweep_start'] + table_data['Oscillation Start'] = req_data['sweep_start'] + table_data['Detector Distance'] = req_data['detDist'] + table_data['Resolution'] = req_data['resolution'] + table_data['Energy (eV)'] = req_data['energy'] + table_data['Wavelength'] = req_data['wavelength'] + text = """
Parameter | +Value | +
---|---|
{key} | +{value} |