def current_value_changed(self): input_field_text = self.new_value_ledit.text() if (self.new_value_validator.validate( input_field_text, 0)[0] == qt_import.QValidator.Acceptable): if self.units_combobox.currentIndex() == 0: BaseWidget.set_status_info("status", "Setting energy...", "running") HWR.beamline.energy.set_value(float(input_field_text)) else: HWR.beamline.energy.set_wavelength(float(input_field_text)) self.new_value_ledit.setText("") colors.set_widget_color(self.new_value_ledit, colors.LINE_EDIT_ACTIVE, qt_import.QPalette.Base)
def _do_login_as_proposal( self, proposal_code, proposal_number, proposal_password, beamline_name, impersonate=False, ): # Get proposal and sessions logging.getLogger().debug("ProposalBrick: querying ISPyB database...") prop = HWR.beamline.lims.getProposal(proposal_code, proposal_number) # Check if everything went ok prop_ok = True try: prop_ok = prop["status"]["code"] == "ok" except KeyError: prop_ok = False if not prop_ok: self.set_ispyb_down() BaseWidget.set_status_info("ispyb", "error") else: self.select_proposal(prop) BaseWidget.set_status_info( "user", "%s%s@%s" % (proposal_code, str(proposal_number), beamline_name) ) BaseWidget.set_status_info("ispyb", "ready")
def _do_login_as_user(self, user_name): logging.getLogger().debug("ProposalBrick: querying ISPyB database...") self.proposals = HWR.beamline.lims.get_proposals_by_user(user_name) if len(self.proposals) == 0: logging.getLogger("GUI").error( "No proposals for user %s found in ISPyB" % user_name ) self.set_ispyb_down() BaseWidget.set_status_info("ispyb", "error") else: self.proposal_combo.clear() proposal_tooltip = "Available proposals:" for proposal in self.proposals: proposal_info = "%s%s - %s" % ( proposal["Proposal"]["code"], proposal["Proposal"]["number"], proposal["Proposal"]["title"], ) self.proposal_combo.addItem(proposal_info) proposal_tooltip += "\n %s" % proposal_info if len(self.proposals) > 1: proposal_index = self.select_todays_proposal(self.proposals) self.proposal_combo.setEnabled(True) else: proposal_tooltip = "" proposal_index = 0 self.proposal_combo.setEnabled(False) self.select_proposal(self.proposals[proposal_index]) self.proposal_combo.setCurrentIndex(proposal_index) proposal_info = "%s%s - %s" % ( self.proposals[proposal_index]["Proposal"]["code"], self.proposals[proposal_index]["Proposal"]["number"], self.proposals[proposal_index]["Proposal"]["title"], ) proposal_tooltip += "\nSelected proposal:\n %s" % proposal_info self.proposal_combo.setToolTip(proposal_tooltip) logging.getLogger("GUI").info("ISPyB proposal: %s" % proposal_info) BaseWidget.set_status_info( "user", "%s@%s" % (user_name, HWR.beamline.lims.beamline_name) ) BaseWidget.set_status_info("ispyb", "ready")
def state_changed(self, state): self.setEnabled(HWR.beamline.energy.is_ready()) BaseWidget.set_status_info("status", "", "")