def _specViewLayout(self): dev = self.device.substitute(dev='TuneProc') # Mode lbl_mode = QLabel('Mode', self) self.cb_mode = PyDMEnumComboBox(self, dev.substitute(propty='SpecMode-Sel')) self.lb_mode = PyDMLabel(self, dev.substitute(propty='SpecMode-Sts')) hbox_mode = QHBoxLayout() hbox_mode.addWidget(self.cb_mode) hbox_mode.addWidget(self.lb_mode) # Time window lbl_timewdw = QLabel('Time Window [ms]', self) self.le_timewdw = PyDMLineEdit(self, dev.substitute(propty='SpecTime-SP')) self.le_timewdw.precisionFromPV = True self.lb_timewdw = PyDMLabel(self, dev.substitute(propty='SpecTime-RB')) hbox_timewdw = QHBoxLayout() hbox_timewdw.addWidget(self.le_timewdw) hbox_timewdw.addWidget(self.lb_timewdw) lay = QFormLayout() lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) lay.addRow(lbl_mode, hbox_mode) lay.addRow(lbl_timewdw, hbox_timewdw) return lay
def _device(self, node, channel): attrs = ['name', 'path', 'description', 'hidden', 'groups'] msgBox = QDialog() msgBox.setWindowTitle("Device Information For {}".format(node.name)) msgBox.setMinimumWidth(400) vb = QVBoxLayout() msgBox.setLayout(vb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vb.addLayout(fl) pb = QPushButton('Close') pb.pressed.connect(msgBox.close) vb.addWidget(pb) for a in attrs: le = QLineEdit() le.setReadOnly(True) le.setText(str(getattr(node,a))) fl.addRow(a,le) le = QLineEdit() le.setReadOnly(True) le.setText(channel.address) fl.addRow('PyDM Path',le) msgBox.exec()
def _setupConfigurationWidget(self): statebutton_Test = PyDMStateButton( self, self.dcct_prefix.substitute(propty='Test-Sel')) statebutton_Test.shape = 1 statebutton_Test.setStyleSheet('min-width:6em; max-width:6em;') label_Test = PyDMLabel(self, self.dcct_prefix.substitute(propty='Test-Sts')) hlay_test = QHBoxLayout() hlay_test.addWidget(statebutton_Test) hlay_test.addWidget(label_Test) self.bt_dl = PyDMPushButton( parent=self, pressValue=1, icon=qta.icon('fa5s.sync'), init_channel=self.dcct_prefix.substitute(propty='Download-Cmd')) self.bt_dl.setObjectName('bt_dl') self.bt_dl.setStyleSheet( '#bt_dl{min-width:25px; max-width:25px; icon-size:20px;}') gbox_test = QGroupBox('Configurations') lay = QFormLayout(gbox_test) lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) lay.addRow('Enable test current: ', hlay_test) lay.addRow('Download Configurations: ', self.bt_dl) return gbox_test
def _command(self, node, channel): attrs = ['name', 'path', 'description', 'hidden', 'groups', 'enum', 'typeStr', 'disp'] if node.isinstance(pyrogue.RemoteCommand): attrs += ['offset', 'bitSize', 'bitOffset', 'varBytes'] msgBox = QDialog() msgBox.setWindowTitle("Command Information For {}".format(node.name)) msgBox.setMinimumWidth(400) vb = QVBoxLayout() msgBox.setLayout(vb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vb.addLayout(fl) pb = QPushButton('Close') pb.pressed.connect(msgBox.close) vb.addWidget(pb) for a in attrs: le = QLineEdit() le.setReadOnly(True) le.setText(str(getattr(node,a))) fl.addRow(a,le) le = QLineEdit() le.setReadOnly(True) le.setText(channel.address) fl.addRow('PyDM Path',le) msgBox.exec()
def _setupLEDLayout(self): label_LedPwrLvl = QLabel('Intensity [%]: ', self) hbox_LedPwrLvl = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='LEDPwrLvl', propty_type='sprb') label_LedPwrScaleFactor = QLabel('Power Scale Factor: ', self) hbox_LedPwrScaleFactor = _create_propty_layout( parent=self, prefix=self.scrn_prefix, propty='LEDPwrScaleFactor', propty_type='sprb') label_LedThold = QLabel('Voltage Threshold [V]: ', self) hbox_LedThold = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='LEDThold', propty_type='sprb') flay_LED = QFormLayout() flay_LED.addItem( QSpacerItem(1, 10, QSzPlcy.Fixed, QSzPlcy.MinimumExpanding)) flay_LED.addRow(label_LedPwrLvl, hbox_LedPwrLvl) flay_LED.addRow(label_LedPwrScaleFactor, hbox_LedPwrScaleFactor) flay_LED.addRow(label_LedThold, hbox_LedThold) flay_LED.addItem( QSpacerItem(1, 10, QSzPlcy.Fixed, QSzPlcy.MinimumExpanding)) flay_LED.setLabelAlignment(Qt.AlignRight) flay_LED.setFormAlignment(Qt.AlignCenter) return flay_LED
def _statusWidget(self): label_Conn = QLabel('Connection:', self) hbox_Conn = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='Connection', propty_type='mon') label_Temp = QLabel('Temperature State:', self) self.lb_Temp = PyDMLabel(self, self.cam_prefix.substitute(propty='Temp-Mon')) self.lb_Temp.setStyleSheet('min-width:7.1em; max-width:7.1em;') self.lb_Temp.setAlignment(Qt.AlignCenter) self.led_TempState = SiriusLedAlert( self, self.cam_prefix.substitute(propty='TempState-Mon')) self.led_TempState.setStyleSheet('min-width:1.29em; max-width:1.29em;') self.lb_TempState = PyDMLabel( self, self.cam_prefix.substitute(propty='TempState-Mon')) self.lb_TempState.setStyleSheet('min-width:2.5em; max-width:2.5em;') hbox_Temp = QHBoxLayout() hbox_Temp.addWidget(self.lb_Temp) hbox_Temp.addWidget(self.led_TempState) hbox_Temp.addWidget(self.lb_TempState) label_LastErr = QLabel('Last Error:', self) hbox_LastErr = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='LastErr', propty_type='mon', cmd={ 'label': 'Clear Last Error', 'pressValue': 1, 'name': 'ClearLastErr' }) label_Reset = QLabel('Reset Camera:', self) self.pb_dtl = PyDMPushButton( label='', icon=qta.icon('fa5s.sync'), parent=self, pressValue=1, init_channel=self.cam_prefix.substitute(propty='Rst-Cmd')) self.pb_dtl.setObjectName('reset') self.pb_dtl.setStyleSheet( "#reset{min-width:25px; max-width:25px; icon-size:20px;}") wid = QWidget() flay = QFormLayout(wid) flay.setLabelAlignment(Qt.AlignRight) flay.setFormAlignment(Qt.AlignHCenter) flay.addRow(label_Conn, hbox_Conn) flay.addRow(label_Temp, hbox_Temp) flay.addRow(label_LastErr, hbox_LastErr) flay.addRow(label_Reset, self.pb_dtl) return wid
def _setupPositionLayout(self): label_AcceptedErr = QLabel('Error Tolerance [mm]: ', self) hbox_AcceptedErr = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='AcceptedErr', propty_type='sprb') label_FluorScrnPos = QLabel('Fluorescent Screen Position [mm]: ', self) hbox_FluorScrnPos = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='FluorScrnPos', propty_type='sprb', cmd={ 'label': 'Get Position', 'pressValue': 1, 'name': 'GetFluorScrnPos' }) label_CalScrnPos = QLabel('Calibration Screen Position [mm]: ', self) hbox_CalScrnPos = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='CalScrnPos', propty_type='sprb', cmd={ 'label': 'Get Position', 'pressValue': 1, 'name': 'GetCalScrnPos' }) label_NoneScrnPos = QLabel('Receded Screen Position [mm]: ', self) hbox_NoneScrnPos = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='NoneScrnPos', propty_type='sprb', cmd={ 'label': 'Get Position', 'pressValue': 1, 'name': 'GetNoneScrnPos' }) flay_pos = QFormLayout() flay_pos.addItem( QSpacerItem(1, 10, QSzPlcy.Fixed, QSzPlcy.MinimumExpanding)) flay_pos.addRow(label_AcceptedErr, hbox_AcceptedErr) flay_pos.addRow(label_FluorScrnPos, hbox_FluorScrnPos) flay_pos.addRow(label_CalScrnPos, hbox_CalScrnPos) flay_pos.addRow(label_NoneScrnPos, hbox_NoneScrnPos) flay_pos.addItem( QSpacerItem(1, 10, QSzPlcy.Fixed, QSzPlcy.MinimumExpanding)) flay_pos.setLabelAlignment(Qt.AlignRight) flay_pos.setFormAlignment(Qt.AlignCenter) return flay_pos
def _configLayout(self): self.bt_rst = PyDMPushButton( parent=self, init_channel=self.device.substitute(propty='Rst-Cmd'), pressValue=1, icon=qta.icon('fa5s.sync')) self.bt_rst.setObjectName('bt_rst') self.bt_rst.setStyleSheet( '#bt_rst{min-width:25px; max-width:25px; icon-size:20px;}') lay = QFormLayout() lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) lay.addRow('Restore Default', self.bt_rst) return lay
def _setupImageCalibLayout(self): cam_prefix = SiriusPVName(self.scrn_prefix).substitute(dev='ScrnCam') label_ImgScaleFactorX = QLabel('Scale Factor X: ', self) hbox_ImgScaleFactorX = _create_propty_layout(parent=self, prefix=cam_prefix, propty='ScaleFactorX', propty_type='sprb') label_ImgScaleFactorY = QLabel('Scale Factor Y: ', self) hbox_ImgScaleFactorY = _create_propty_layout(parent=self, prefix=cam_prefix, propty='ScaleFactorY', propty_type='sprb') label_ImgCenterOffsetX = QLabel('Center Offset X [pixels]: ', self) hbox_ImgCenterOffsetX = _create_propty_layout(parent=self, prefix=cam_prefix, propty='CenterOffsetX', propty_type='sprb') label_ImgCenterOffsetY = QLabel('Center Offset Y [pixels]: ', self) hbox_ImgCenterOffsetY = _create_propty_layout(parent=self, prefix=cam_prefix, propty='CenterOffsetY', propty_type='sprb') label_ImgThetaOffset = QLabel('Theta Offset [pixels]: ', self) hbox_ImgThetaOffset = _create_propty_layout(parent=self, prefix=cam_prefix, propty='ThetaOffset', propty_type='sprb') flay_Img = QFormLayout() flay_Img.addItem( QSpacerItem(1, 10, QSzPlcy.Fixed, QSzPlcy.MinimumExpanding)) flay_Img.addRow(label_ImgScaleFactorX, hbox_ImgScaleFactorX) flay_Img.addRow(label_ImgScaleFactorY, hbox_ImgScaleFactorY) flay_Img.addRow(label_ImgCenterOffsetX, hbox_ImgCenterOffsetX) flay_Img.addRow(label_ImgCenterOffsetY, hbox_ImgCenterOffsetY) flay_Img.addRow(label_ImgThetaOffset, hbox_ImgThetaOffset) flay_Img.addItem( QSpacerItem(1, 10, QSzPlcy.Fixed, QSzPlcy.MinimumExpanding)) flay_Img.setLabelAlignment(Qt.AlignRight) flay_Img.setFormAlignment(Qt.AlignCenter) return flay_Img
def _kick_layout(self): self.kick_sp_widget = PyDMSpinboxScrollbar(self, self._kick_sp_pv) self.kick_rb_label = PyDMLabel(self, self._kick_rb_pv) self.kick_rb_label.showUnits = True self.kick_rb_label.precisionFromPV = True self.kick_mon_label = PyDMLabel(self, self._kick_mon_pv) self.kick_mon_label.showUnits = True self.kick_mon_label.precisionFromPV = True kick_layout = QFormLayout() kick_layout.setLabelAlignment(Qt.AlignRight) kick_layout.setFormAlignment(Qt.AlignHCenter) kick_layout.addRow('SP:', self.kick_sp_widget) kick_layout.addRow('RB:', self.kick_rb_label) kick_layout.addRow('Mon:', self.kick_mon_label) return kick_layout
def _setupGeneralInfoLayout(self): label_MtrPrefix = QLabel('Motor Prefix: ', self) self.PyDMLabel_MtrPrefix = PyDMLabel( self, self.scrn_prefix.substitute(propty='MtrCtrlPrefix-Cte')) self.PyDMLabel_MtrPrefix.setStyleSheet( """max-width:14.20em; max-height:1.29em;""") label_CamPrefix = QLabel('Camera Prefix: ', self) self.PyDMLabel_CamPrefix = PyDMLabel( self, self.scrn_prefix.substitute(propty='CamPrefix-Cte')) self.PyDMLabel_CamPrefix.setStyleSheet( """max-width:14.20em; max-height:1.29em;""") flay = QFormLayout() flay.addRow(label_MtrPrefix, self.PyDMLabel_MtrPrefix) flay.addRow(label_CamPrefix, self.PyDMLabel_CamPrefix) flay.setLabelAlignment(Qt.AlignRight) flay.setFormAlignment(Qt.AlignCenter) return flay
def connection_changed(self, connected): build = (self._node is None) and (self._connected != connected and connected is True) super(RunControl, self).connection_changed(connected) if not build: return self._node = nodeFromAddress(self.channel) self._path = self.channel vb = QVBoxLayout() self.setLayout(vb) gb = QGroupBox('Run Control ({})'.format(self._node.name)) vb.addWidget(gb) vb = QVBoxLayout() gb.setLayout(vb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vb.addLayout(fl) w = PyDMEnumComboBox(parent=None, init_channel=self._path + '.runRate') w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Run Rate:', w) hb = QHBoxLayout() vb.addLayout(hb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) hb.addLayout(fl) w = PyDMEnumComboBox(parent=None, init_channel=self._path + '.runState') w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Run State:', w) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) hb.addLayout(fl) w = PyDMLabel(parent=None, init_channel=self._path + '.runCount') w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Run Count:', w)
def _setupGeneralSettingsWidget(self): gbox_generalsettings = QGroupBox('General Measurement Settings', self) l_enbl = QLabel('Enable:', self) self.pydmstatebutton_Enbl = PyDMStateButton( self, self.dcct_prefix.substitute(propty='Enbl-Sel')) self.pydmstatebutton_Enbl.shape = 1 self.led_Enbl = SiriusLedState( self, self.dcct_prefix.substitute(propty='Enbl-Sts')) hlay_enbl = QHBoxLayout() hlay_enbl.addWidget(self.pydmstatebutton_Enbl) hlay_enbl.addWidget(self.led_Enbl) l_meastrig = QLabel('Trigger Source: ', self) self.pydmenumcombobox_MeasTrg = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='MeasTrg-Sel')) self.pydmlabel_MeasTrg = PyDMLabel( self, self.dcct_prefix.substitute(propty='MeasTrg-Sts')) hlay_meastrig = QHBoxLayout() hlay_meastrig.addWidget(self.pydmenumcombobox_MeasTrg) hlay_meastrig.addWidget(self.pydmlabel_MeasTrg) l_trigmiss = QLabel('Trigger Is Missing?', self) self.led_TrgMiss = SiriusLedAlert( self, self.dcct_prefix.substitute(propty='TrgIsMissing-Mon')) hlay_trigmiss = QHBoxLayout() hlay_trigmiss.addWidget(self.led_TrgMiss) hlay_trigmiss.setAlignment(Qt.AlignLeft) l_range = QLabel('Range: ', self) self.pydmenumcombobox_Range = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='Range-Sel')) self.pydmlabel_Range = PyDMLabel( self, self.dcct_prefix.substitute(propty='Range-Sts')) hlay_range = QHBoxLayout() hlay_range.addWidget(self.pydmenumcombobox_Range) hlay_range.addWidget(self.pydmlabel_Range) l_lowlimenbl = QLabel('Low Beam Current Detection: ', self) self.pydmstatebutton_LowLimEnbl = PyDMStateButton( self, self.dcct_prefix.substitute(propty='LowLimEnbl-Sel')) self.pydmstatebutton_LowLimEnbl.shape = 1 self.pydmlabel_LowLimEnbl = PyDMLabel( self, self.dcct_prefix.substitute(propty='LowLimEnbl-Sts')) hlay_lowlimenbl = QHBoxLayout() hlay_lowlimenbl.addWidget(self.pydmstatebutton_LowLimEnbl) hlay_lowlimenbl.addWidget(self.pydmlabel_LowLimEnbl) l_currthold = QLabel('Current Threshold [mA]: ', self) self.pydmspinbox_CurrThold = PyDMSpinbox( self, self.dcct_prefix.substitute(propty='CurrThold-SP')) self.pydmspinbox_CurrThold.showStepExponent = False self.pydmlabel_CurrThold = PyDMLabel( self, self.dcct_prefix.substitute(propty='CurrThold-RB')) hlay_currthold = QHBoxLayout() hlay_currthold.addWidget(self.pydmspinbox_CurrThold) hlay_currthold.addWidget(self.pydmlabel_CurrThold) l_hfreject = QLabel('High Frequency Rejection: ', self) self.pydmstatebutton_HFReject = PyDMStateButton( self, self.dcct_prefix.substitute(propty='HFReject-Sel')) self.pydmstatebutton_HFReject.shape = 1 self.pydmlabel_HFReject = PyDMLabel( self, self.dcct_prefix.substitute(propty='HFReject-Sts')) hlay_hfreject = QHBoxLayout() hlay_hfreject.addWidget(self.pydmstatebutton_HFReject) hlay_hfreject.addWidget(self.pydmlabel_HFReject) l_measmode = QLabel('Mode: ', self) self.pydmenumcombobox_MeasMode = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='MeasMode-Sel')) self.pydmlabel_MeasMode = PyDMLabel( self, self.dcct_prefix.substitute(propty='MeasMode-Sts')) hlay_measmode = QHBoxLayout() hlay_measmode.addWidget(self.pydmenumcombobox_MeasMode) hlay_measmode.addWidget(self.pydmlabel_MeasMode) flay_generalsettings = QFormLayout() flay_generalsettings.setLabelAlignment(Qt.AlignRight) flay_generalsettings.setFormAlignment(Qt.AlignCenter) flay_generalsettings.addRow(l_enbl, hlay_enbl) flay_generalsettings.addRow(l_meastrig, hlay_meastrig) flay_generalsettings.addRow(l_trigmiss, hlay_trigmiss) flay_generalsettings.addRow(l_range, hlay_range) flay_generalsettings.addItem( QSpacerItem(1, 10, QSzPly.Ignored, QSzPly.Preferred)) flay_generalsettings.addRow(l_lowlimenbl, hlay_lowlimenbl) flay_generalsettings.addRow(l_currthold, hlay_currthold) flay_generalsettings.addRow(l_hfreject, hlay_hfreject) flay_generalsettings.addItem( QSpacerItem(1, 10, QSzPly.Ignored, QSzPly.Preferred)) flay_generalsettings.addRow(l_measmode, hlay_measmode) gbox_generalsettings.setLayout(flay_generalsettings) return gbox_generalsettings
def _setupUi(self): label = QLabel('<h3>' + self.device + ' Advanced Acquisition Settings</h3>', self, alignment=Qt.AlignHCenter) label.setStyleSheet('max-height:1.29em;') label_DataType = QLabel('Data Type:', self) hbox_DataType = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='DataType', propty_type='enum') label_BwAssigned = QLabel('Band Width Assigned [bytes]:', self) hbox_BwAssigned = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='BwAssigned', propty_type='mon') label_BwReserve = QLabel('Band Width Reserved [%]:', self) hbox_BwReserve = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='BwReserve', propty_type='sprb') label_BwReserveAccum = QLabel('Band Width Reserved Accum. [%]:', self) hbox_BwReserveAccum = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='BwReserveAccum', propty_type='sprb') label_CurrentThroughput = QLabel('Current Throughput [bytes/s]:', self) hbox_CurrentThroughput = create_propty_layout( parent=self, prefix=self.cam_prefix, propty='CurrentThroughput', propty_type='mon') label_MaxThroughput = QLabel('Maximum Throughput [bytes/s]:', self) hbox_MaxThroughput = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='MaxThroughput', propty_type='mon') label_FrameMaxJitter = QLabel('Frame Max Jitter [8 ns]:', self) hbox_FrameMaxJitter = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='FrameMaxJitter', propty_type='mon') label_PacketSize = QLabel('Packet Size [bytes]:', self) hbox_PacketSize = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='PacketSize', propty_type='sprb') label_PayloadSize = QLabel('Payload Size [bytes]:', self) hbox_PayloadSize = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='PayloadSize', propty_type='mon') label_InterPacketDelay = QLabel('Inter Packet Delay [8 ns]:', self) hbox_InterPacketDelay = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='InterPacketDelay', propty_type='sprb') label_ReadoutTime = QLabel('Readout Time [us]:', self) hbox_ReadoutTime = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='ReadoutTime', propty_type='mon') label_ResultFrameRate = QLabel('Result Frame Rate:', self) hbox_ResultFrameRate = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='ResultFrameRate', propty_type='mon') label_TransmDelay = QLabel('Inter Frame Delay [8 ns]:', self) hbox_TransmDelay = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='TransmDelay', propty_type='sprb') flay = QFormLayout(self) flay.setLabelAlignment(Qt.AlignRight) flay.setFormAlignment(Qt.AlignHCenter) flay.addRow(label) flay.addRow(label_DataType, hbox_DataType) flay.addRow(label_BwAssigned, hbox_BwAssigned) flay.addRow(label_BwReserve, hbox_BwReserve) flay.addRow(label_BwReserveAccum, hbox_BwReserveAccum) flay.addRow(label_CurrentThroughput, hbox_CurrentThroughput) flay.addRow(label_MaxThroughput, hbox_MaxThroughput) flay.addRow(label_FrameMaxJitter, hbox_FrameMaxJitter) flay.addRow(label_PacketSize, hbox_PacketSize) flay.addRow(label_PayloadSize, hbox_PayloadSize) flay.addRow(label_InterPacketDelay, hbox_InterPacketDelay) flay.addRow(label_ReadoutTime, hbox_ReadoutTime) flay.addRow(label_ResultFrameRate, hbox_ResultFrameRate) flay.addRow(label_TransmDelay, hbox_TransmDelay)
def _setupUi(self): lay_temp1 = QFormLayout() lay_temp1.setHorizontalSpacing(9) lay_temp1.setVerticalSpacing(9) lay_temp1.setLabelAlignment(Qt.AlignRight) lay_temp1.setFormAlignment(Qt.AlignTop) lb_temp1 = QLabel('Cell and Coupler\nTemperatures\nPT100', self) lb_temp1.setStyleSheet( 'font-weight:bold; qproperty-alignment:AlignCenter;') lay_temp1.addRow(lb_temp1) lims = self.chs['Cav Sts']['Temp']['Cells Limits'] tooltip = 'Interlock limits: \nMin: ' + str(lims[0]) + \ '°C, Max: '+str(lims[1])+'°C' for idx, cell in enumerate(self.chs['Cav Sts']['Temp']['Cells']): lbl = PyDMLabel(self, self.prefix+cell[0]) lbl.showUnits = True lbl.setStyleSheet('min-width:3.5em; max-width:3.5em;') led = PyDMLedMultiChannel( self, {self.prefix+cell[0]: {'comp': 'wt', 'value': lims}, self.prefix+cell[0].replace('T-Mon', 'TUp-Mon'): 0, self.prefix+cell[0].replace('T-Mon', 'TDown-Mon'): 0}) led.setToolTip(tooltip) hbox = QHBoxLayout() hbox.setAlignment(Qt.AlignLeft) hbox.addWidget(lbl) hbox.addWidget(led) lay_temp1.addRow('Cell '+str(idx + 1)+': ', hbox) ch_coup = self.chs['Cav Sts']['Temp']['Coupler'][0] lims_coup = self.chs['Cav Sts']['Temp']['Coupler Limits'] lb_coup = PyDMLabel(self, self.prefix+ch_coup) lb_coup.setStyleSheet('min-width:3.5em; max-width:3.5em;') lb_coup.showUnits = True led_coup = PyDMLedMultiChannel( self, {self.prefix+ch_coup: {'comp': 'wt', 'value': lims_coup}, self.prefix+ch_coup.replace('T-Mon', 'TUp-Mon'): 0, self.prefix+ch_coup.replace('T-Mon', 'TDown-Mon'): 0}) led_coup.setToolTip( 'Interlock limits: \n' 'Min: '+str(lims_coup[0])+'°C, Max: '+str(lims_coup[1])+'°C') hb_coup = QHBoxLayout() hb_coup.setAlignment(Qt.AlignLeft) hb_coup.addWidget(lb_coup) hb_coup.addWidget(led_coup) lay_temp1.addRow('Coupler: ', hb_coup) lay_temp2 = QFormLayout() lay_temp2.setHorizontalSpacing(9) lay_temp2.setVerticalSpacing(9) lay_temp2.setLabelAlignment(Qt.AlignRight) lay_temp2.setFormAlignment(Qt.AlignTop | Qt.AlignHCenter) lb_temp2 = QLabel('Cell\nTemperatures\nThermostats', self) lb_temp2.setStyleSheet( 'font-weight:bold; qproperty-alignment:AlignCenter;') lay_temp2.addRow(lb_temp2) for idx, cell in enumerate(self.chs['Cav Sts']['Temp']['Cells']): led = SiriusLedAlert(self) led.setToolTip('Interlock limits:\nMax: 60°C') led.channel = self.prefix+cell[0].replace('T-Mon', 'Tms-Mon') lay_temp2.addRow('Cell '+str(idx + 1)+': ', led) lay_dtemp = QFormLayout() lay_dtemp.setHorizontalSpacing(9) lay_dtemp.setVerticalSpacing(9) lay_dtemp.setLabelAlignment(Qt.AlignRight) lay_dtemp.setFormAlignment(Qt.AlignTop | Qt.AlignHCenter) lb_dtemp = QLabel('Disc\nTemperatures\nThermostats', self) lb_dtemp.setStyleSheet( 'font-weight:bold; qproperty-alignment:AlignCenter;') lay_dtemp.addRow(lb_dtemp) for idx, disc in enumerate(self.chs['Cav Sts']['Temp']['Discs']): led = SiriusLedAlert(self) led.setToolTip('Interlock limits:\nMax: 60°C') led.channel = self.prefix+disc lay_dtemp.addRow('Disc '+str(idx)+': ', led) self.led_hdflwrt1 = SiriusLedAlert( self, self.prefix+self.chs['Cav Sts']['FlwRt'][0]) self.led_hdflwrt2 = SiriusLedAlert( self, self.prefix+self.chs['Cav Sts']['FlwRt'][1]) self.led_hdflwrt3 = SiriusLedAlert( self, self.prefix+self.chs['Cav Sts']['FlwRt'][2]) lay_flwrt = QFormLayout() lay_flwrt.setHorizontalSpacing(9) lay_flwrt.setVerticalSpacing(9) lay_flwrt.setLabelAlignment(Qt.AlignRight) lay_flwrt.setFormAlignment(Qt.AlignTop) lb_flwrf = QLabel('Flow Switches', self) lb_flwrf.setStyleSheet( 'font-weight:bold; qproperty-alignment:AlignCenter;') lay_flwrt.addRow(lb_flwrf) lay_flwrt.addRow('Flow Switch 1: ', self.led_hdflwrt1) lay_flwrt.addRow('Flow Switch 2: ', self.led_hdflwrt2) lay_flwrt.addRow('Flow Switch 3: ', self.led_hdflwrt3) self.led_couppressure = SiriusLedAlert( self, self.prefix+self.chs['Cav Sts']['Vac']['Coupler ok']) self.led_pressure = SiriusLedAlert(self) self.led_pressure.setToolTip('Interlock limits:\nMax: 5e-7mBar') self.led_pressure.channel = \ self.prefix+self.chs['Cav Sts']['Vac']['Cells ok'] lay_vac = QFormLayout() lay_vac.setHorizontalSpacing(9) lay_vac.setVerticalSpacing(9) lay_vac.setLabelAlignment(Qt.AlignRight) lay_vac.setFormAlignment(Qt.AlignTop) lb_vac = QLabel('Vacuum', self) lb_vac.setStyleSheet( 'font-weight:bold; qproperty-alignment:AlignCenter;') lay_flwrt.addRow(lb_vac) lay_vac.addRow('Pressure Sensor: ', self.led_couppressure) lay_vac.addRow('Vacuum: ', self.led_pressure) lbl = QLabel('Cavity - Detailed Status', self) lbl.setStyleSheet( 'font-weight:bold; qproperty-alignment:AlignCenter;') lay = QGridLayout(self) lay.setHorizontalSpacing(30) lay.setVerticalSpacing(20) lay.addWidget(lbl, 0, 0, 1, 4) lay.addLayout(lay_temp1, 1, 0, 2, 1) lay.addLayout(lay_temp2, 1, 1, 2, 1) lay.addLayout(lay_dtemp, 1, 2, 2, 1) lay.addLayout(lay_flwrt, 1, 3) lay.addLayout(lay_vac, 2, 3) self.setStyleSheet(""" PyDMLabel{ qproperty-alignment: AlignLeft; } QLed{ max-width: 1.29em; } .QLabel{ max-height:4em; qproperty-alignment: AlignRight; }""")
def _setupMeasSettingsWidget(self, mode): if mode == 'Normal': prefix = self.dcct_prefix visible = True elif mode == 'Fast': prefix = self.dcct_prefix.substitute(propty_name=mode) visible = False gbox_modesettings = QGroupBox(mode + ' Measurement Mode Settings', self) l_smpcnt = QLabel('Sample Count: ', self) spinbox_SampleCnt = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'SampleCnt-SP')) spinbox_SampleCnt.showStepExponent = False label_SampleCnt = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'SampleCnt-RB')) hlay_smpcnt = QHBoxLayout() hlay_smpcnt.addWidget(spinbox_SampleCnt) hlay_smpcnt.addWidget(label_SampleCnt) l_measperiod = QLabel('Period [s]: ', self) spinbox_MeasPeriod = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'MeasPeriod-SP')) spinbox_MeasPeriod.showStepExponent = False label_MeasPeriod = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'MeasPeriod-RB')) hlay_measperiod = QHBoxLayout() hlay_measperiod.addWidget(spinbox_MeasPeriod) hlay_measperiod.addWidget(label_MeasPeriod) l_measupdateperiod = QLabel('Measured Period [s]: ', self) label_MeasUpdatePeriod = PyDMLabel( self, self.dcct_prefix.substitute(propty='MeasUpdatePeriod-Mon')) l_imped = QLabel('Impedance: ', self) enumcombobox_Imped = PyDMEnumComboBox( self, prefix.substitute(propty=prefix.propty_name + 'Imped-Sel')) label_Imped = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'Imped-Sts')) hlay_imped = QHBoxLayout() hlay_imped.addWidget(enumcombobox_Imped) hlay_imped.addWidget(label_Imped) l_offset = QLabel('Relative Offset Enable: ', self) statebutton_RelEnbl = PyDMStateButton( self, prefix.substitute(propty=prefix.propty_name + 'RelEnbl-Sel')) statebutton_RelEnbl.shape = 1 statebutton_RelEnbl.setStyleSheet('min-width:6em; max-width:6em;') label_RelEnbl = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'RelEnbl-Sts')) hlay_offset = QHBoxLayout() hlay_offset.addWidget(statebutton_RelEnbl) hlay_offset.addWidget(label_RelEnbl) l_rellvl = QLabel('Relative Offset Level [V]: ', self) spinbox_RelLvl = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'RelLvl-SP')) spinbox_RelLvl.showStepExponent = False label_RelLvl = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'RelLvl-RB')) label_RelLvl.precisionFromPV = False label_RelLvl.precision = 9 pushbutton_RelAcq = PyDMPushButton( parent=self, label='Acquire Offset', pressValue=1, init_channel=prefix.substitute(propty=prefix.propty_name + 'RelAcq-Cmd')) pushbutton_RelAcq.setAutoDefault(False) pushbutton_RelAcq.setDefault(False) hlay_rellvl = QHBoxLayout() hlay_rellvl.addWidget(spinbox_RelLvl) hlay_rellvl.addWidget(label_RelLvl) hlay_rellvl.addWidget(pushbutton_RelAcq) flay_modesettings = QFormLayout() flay_modesettings.setLabelAlignment(Qt.AlignRight) flay_modesettings.setFormAlignment(Qt.AlignHCenter) flay_modesettings.addRow(l_smpcnt, hlay_smpcnt) flay_modesettings.addRow(l_measperiod, hlay_measperiod) flay_modesettings.addRow(l_measupdateperiod, label_MeasUpdatePeriod) flay_modesettings.addRow(l_imped, hlay_imped) flay_modesettings.addRow(l_offset, hlay_offset) flay_modesettings.addRow(l_rellvl, hlay_rellvl) if mode == 'Normal': l_linesync = QLabel('Line Synchronization: ', self) statebutton_LineSync = PyDMStateButton( self, prefix.substitute(propty=prefix.propty_name + 'LineSync-Sel')) statebutton_LineSync.shape = 1 statebutton_LineSync.setStyleSheet('min-width:6em; max-width:6em;') label_LineSync = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'LineSync-Sts')) hlay_linesync = QHBoxLayout() hlay_linesync.addWidget(statebutton_LineSync) hlay_linesync.addWidget(label_LineSync) label_avg = QLabel('<h4>Average Filter</h4>', self) l_avgenbl = QLabel('Enable: ', self) statebutton_AvgFilterEnbl = PyDMStateButton( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterEnbl-Sel')) statebutton_AvgFilterEnbl.shape = 1 label_AvgFilterEnbl = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterEnbl-Sts')) hlay_avgenbl = QHBoxLayout() hlay_avgenbl.addWidget(statebutton_AvgFilterEnbl) hlay_avgenbl.addWidget(label_AvgFilterEnbl) l_avgcnt = QLabel('Samples: ', self) spinbox_AvgFilterCount = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterCnt-SP')) spinbox_AvgFilterCount.showStepExponent = False label_AvgFilterCount = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterCnt-RB')) hlay_avgcnt = QHBoxLayout() hlay_avgcnt.addWidget(spinbox_AvgFilterCount) hlay_avgcnt.addWidget(label_AvgFilterCount) l_avgtyp = QLabel('Type: ', self) enumcombobox_AvgFilterTyp = PyDMEnumComboBox( self, self.dcct_prefix.substitute(propty='AvgFilterTyp-Sel')) label_AvgFilterTyp = PyDMLabel( self, self.dcct_prefix.substitute(propty='AvgFilterTyp-Sts')) hlay_avgtyp = QHBoxLayout() hlay_avgtyp.addWidget(enumcombobox_AvgFilterTyp) hlay_avgtyp.addWidget(label_AvgFilterTyp) l_avgwin = QLabel('Noise window size [%]: ', self) spinbox_AvgFilterWind = PyDMSpinbox( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterWind-SP')) spinbox_AvgFilterWind.showStepExponent = False label_AvgFilterWind = PyDMLabel( self, prefix.substitute(propty=prefix.propty_name + 'AvgFilterWind-RB')) hlay_avgwin = QHBoxLayout() hlay_avgwin.addWidget(spinbox_AvgFilterWind) hlay_avgwin.addWidget(label_AvgFilterWind) flay_modesettings.addRow(l_linesync, hlay_linesync) flay_modesettings.addRow(QLabel('')) flay_modesettings.addRow(label_avg) flay_modesettings.addRow(l_avgenbl, hlay_avgenbl) flay_modesettings.addRow(l_avgcnt, hlay_avgcnt) flay_modesettings.addRow(l_avgtyp, hlay_avgtyp) flay_modesettings.addRow(l_avgwin, hlay_avgwin) gbox_modesettings.setLayout(flay_modesettings) gbox_modesettings.setVisible(visible) gbox_modesettings.setStyleSheet(""" PyDMSpinbox, PyDMLabel{ min-width:6em; max-width:6em; qproperty-alignment: AlignCenter;} PyDMLedMultiChannel, PyDMStateButton, PyDMEnumComboBox{ min-width:6em; max-width:6em;}""") return gbox_modesettings
def connection_changed(self, connected): build = (self._node is None) and (self._connected != connected and connected is True) super(Process, self).connection_changed(connected) if not build: return self._node = nodeFromAddress(self.channel) self._path = self.channel vb = QVBoxLayout() self.setLayout(vb) gb = QGroupBox('Process ({})'.format(self._node.name)) vb.addWidget(gb) vb = QVBoxLayout() gb.setLayout(vb) hb = QHBoxLayout() vb.addLayout(hb) w = PyDMPushButton(label='Start', pressValue=1, init_channel=self._path + '.Start') hb.addWidget(w) w = PyDMPushButton(label='Stop', pressValue=1, init_channel=self._path + '.Stop') hb.addWidget(w) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignVCenter) fl.setLabelAlignment(Qt.AlignRight) hb.addLayout(fl) w = PyRogueLineEdit(parent=None, init_channel=self._path + '.Running/disp') w.showUnits = False w.precisionFromPV = False w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Running:', w) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vb.addLayout(fl) w = PyDMScaleIndicator(parent=None, init_channel=self._path + '.Progress') w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = False w.showValue = False w.showLimits = False w.showTicks = False w.barIndicator = True fl.addRow('Progress:', w) w = PyRogueLineEdit(parent=None, init_channel=self._path + '.Message/disp') w.showUnits = False w.precisionFromPV = False w.alarmSensitiveContent = False w.alarmSensitiveBorder = False fl.addRow('Message:', w) # Auto add additional fields noAdd = ['enable', 'Start', 'Stop', 'Running', 'Progress', 'Message'] prc = nodeFromAddress(self.channel) for k, v in prc.nodes.items(): if v.name not in noAdd and not v.hidden: if v.disp == 'enum' and v.enum is not None and v.mode != 'RO' and v.typeStr != 'list': w = PyDMEnumComboBox(parent=None, init_channel=self._path + '.{}'.format(v.name)) w.alarmSensitiveContent = False w.alarmSensitiveBorder = True elif v.minimum is not None and v.maximum is not None and v.disp == '{}' and ( v.mode != 'RO' or v.isCommand): w = PyDMSpinbox(parent=None, init_channel=self._path + '.{}'.format(v.name)) w.precision = 0 w.showUnits = False w.precisionFromPV = False w.alarmSensitiveContent = False w.alarmSensitiveBorder = True w.showStepExponent = False w.writeOnPress = True elif v.mode == 'RO' and not v.isCommand: w = PyDMLabel(parent=None, init_channel=self._path + '.{}/disp'.format(v.name)) w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = True else: w = PyRogueLineEdit(parent=None, init_channel=self._path + '.{}/disp'.format(v.name)) w.showUnits = False w.precisionFromPV = True w.alarmSensitiveContent = False w.alarmSensitiveBorder = True fl.addRow(v.name + ':', w)
def connection_changed(self, connected): build = (self._node is None) and (self._connected != connected and connected is True) super(DataWriter, self).connection_changed(connected) if not build: return self._node = nodeFromAddress(self.channel) self._path = self.channel vb = QVBoxLayout() self.setLayout(vb) gb = QGroupBox('Data File Control ({}) '.format(self._node.name)) vb.addWidget(gb) vb = QVBoxLayout() gb.setLayout(vb) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vb.addLayout(fl) self._dataFile = PyRogueLineEdit(parent=None, init_channel=self._path + '.DataFile') self._dataFile.alarmSensitiveContent = False self._dataFile.alarmSensitiveBorder = True fl.addRow('Data File:', self._dataFile) hb = QHBoxLayout() vb.addLayout(hb) self._browsebutton = QPushButton('Browse') self._browsebutton.clicked.connect(self._browse) hb.addWidget(self._browsebutton) self._autonamebutton = PyDMPushButton(label='Auto Name', pressValue=1, init_channel=self._path + '.AutoName') hb.addWidget(self._autonamebutton) self._openbutton = PyDMPushButton(label='Open', pressValue=1, init_channel=self._path + '.Open') self._openbutton.clicked.connect(self._openDataFile) hb.addWidget(self._openbutton) self._closebutton = PyDMPushButton(label='Close', pressValue=1, init_channel=self._path + '.Close') self._closebutton.check_enable_state = lambda: None self._closebutton.clicked.connect(self._closeDataFile) self._closebutton.setEnabled(False) hb.addWidget(self._closebutton) hb = QHBoxLayout() vb.addLayout(hb) vbl = QVBoxLayout() hb.addLayout(vbl) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vbl.addLayout(fl) w = PyRogueLineEdit(parent=None, init_channel=self._path + '.BufferSize') w.alarmSensitiveContent = False w.alarmSensitiveBorder = True fl.addRow('Buffer Size:', w) w = PyDMLabel(parent=None, init_channel=self._path + '.IsOpen/disp') w.alarmSensitiveContent = False w.alarmSensitiveBorder = True fl.addRow('File Open:', w) w = PyDMLabel(parent=None, init_channel=self._path + '.CurrentSize') w.alarmSensitiveContent = False w.alarmSensitiveBorder = True fl.addRow('Current File Size:', w) vbr = QVBoxLayout() hb.addLayout(vbr) fl = QFormLayout() fl.setRowWrapPolicy(QFormLayout.DontWrapRows) fl.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) fl.setLabelAlignment(Qt.AlignRight) vbr.addLayout(fl) w = PyRogueLineEdit(parent=None, init_channel=self._path + '.MaxFileSize') w.alarmSensitiveContent = False w.alarmSensitiveBorder = True fl.addRow('Max Size:', w) w = PyDMLabel(parent=None, init_channel=self._path + '.FrameCount') w.alarmSensitiveContent = False w.alarmSensitiveBorder = True fl.addRow('Frame Count:', w) w = PyDMLabel(parent=None, init_channel=self._path + '.TotalSize') w.alarmSensitiveContent = False w.alarmSensitiveBorder = True fl.addRow('Total File Size:', w)
def _roiLayout(self): # StartX lbl_roistartx = QLabel('Start X [MHz]', self) self.le_roistartx = PyDMLineEdit( self, self.device.substitute(propty='ROIOffsetX-SP')) self.le_roistartx.precisionFromPV = True self.lb_roistartx = PyDMLabel( self, self.device.substitute(propty='ROIOffsetX-RB')) hbox_roistartx = QHBoxLayout() hbox_roistartx.addWidget(self.le_roistartx) hbox_roistartx.addWidget(self.lb_roistartx) # Width lbl_roiwidth = QLabel('Width [MHz]', self) self.le_roiwidth = PyDMLineEdit( self, self.device.substitute(propty='ROIWidth-SP')) self.le_roiwidth.precisionFromPV = True self.lb_roiwidth = PyDMLabel( self, self.device.substitute(propty='ROIWidth-RB')) hbox_roiwidth = QHBoxLayout() hbox_roiwidth.addWidget(self.le_roiwidth) hbox_roiwidth.addWidget(self.lb_roiwidth) # StartY lbl_roistarty = QLabel('Start Y [ms]', self) self.le_roistarty = PyDMLineEdit( self, self.device.substitute(propty='ROIOffsetY-SP')) self.le_roistarty.precisionFromPV = True self.lb_roistarty = PyDMLabel( self, self.device.substitute(propty='ROIOffsetY-RB')) hbox_roistarty = QHBoxLayout() hbox_roistarty.addWidget(self.le_roistarty) hbox_roistarty.addWidget(self.lb_roistarty) # Height lbl_roiheight = QLabel('Height [ms]', self) self.le_roiheight = PyDMLineEdit( self, self.device.substitute(propty='ROIHeight-SP')) self.le_roiheight.precisionFromPV = True self.lb_roiheight = PyDMLabel( self, self.device.substitute(propty='ROIHeight-RB')) hbox_roiheight = QHBoxLayout() hbox_roiheight.addWidget(self.le_roiheight) hbox_roiheight.addWidget(self.lb_roiheight) # Auto adjust lbl_roiauto = QLabel('Auto Positioning', self) self.bt_roiauto = PyDMStateButton( self, self.device.substitute(propty='ROIAuto-Sel')) self.bt_roiauto.shape = 1 self.led_roiauto = SiriusLedState( self, self.device.substitute(propty='ROIAuto-Sts')) hbox_roiauto = QHBoxLayout() hbox_roiauto.addWidget(self.bt_roiauto) hbox_roiauto.addWidget(self.led_roiauto) lay = QFormLayout() lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) lay.addRow(lbl_roistartx, hbox_roistartx) lay.addRow(lbl_roiwidth, hbox_roiwidth) lay.addRow(lbl_roistarty, hbox_roistarty) lay.addRow(lbl_roiheight, hbox_roiheight) lay.addRow(lbl_roiauto, hbox_roiauto) return lay
def _setupUi(self): cw = QWidget(self) self.setCentralWidget(cw) lay = QFormLayout(cw) lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) # title self.title_label = QLabel('<h3>' + self.title + '<h3>', self, alignment=Qt.AlignCenter) self.title_label.setObjectName('title') pal = self.title_label.palette() pal.setColor(QPalette.Background, self.background) self.title_label.setAutoFillBackground(True) self.title_label.setPalette(pal) lay.addRow(self.title_label) label_enbl = QLabel('Enable: ', self) self.bt_enbl = PyDMStateButton( self, self.dev.substitute(propty='Enbl' + self.mtyp + 'Mark' + self.idx + '-Sel')) self.bt_enbl.shape = 1 self.led_enbl = SiriusLedState( self, self.dev.substitute(propty='Enbl' + self.mtyp + 'Mark' + self.idx + '-Sts')) hbox_enbl = QHBoxLayout() hbox_enbl.addWidget(self.bt_enbl) hbox_enbl.addWidget(self.led_enbl) lay.addRow(label_enbl, hbox_enbl) label_enblautomax = QLabel('Auto Max Peak: ', self) ch_enblautomax = self.dev.substitute(propty='Enbl' + self.mtyp + 'MaxAuto' + self.idx + '-Sel') self.enblAutoMaxChannel = SiriusConnectionSignal(ch_enblautomax) self.enblAutoMaxChannel.new_value_signal[int].connect( self._handle_values_visibility) self.bt_enblautomax = PyDMStateButton(self, ch_enblautomax) self.bt_enblautomax.shape = 1 self.led_enblautomax = SiriusLedState( self, self.dev.substitute(propty='Enbl' + self.mtyp + 'MaxAuto' + self.idx + '-Sts')) hbox_enblautomax = QHBoxLayout() hbox_enblautomax.addWidget(self.bt_enblautomax) hbox_enblautomax.addWidget(self.led_enblautomax) lay.addRow(label_enblautomax, hbox_enblautomax) label_x = QLabel(' X: ', self) self.sb_x = PyDMLineEdit( self, self.dev.substitute(propty=self.mtyp + 'MarkX' + self.idx + '-SP')) self.lb_x = PyDMLabel( self, self.dev.substitute(propty=self.mtyp + 'MarkX' + self.idx + '-RB')) hbox_x = QHBoxLayout() hbox_x.addWidget(self.sb_x) hbox_x.addWidget(self.lb_x) lay.addRow(label_x, hbox_x) label_y = QLabel(' Y: ', self) self.lb_y = PyDMLabel( self, self.dev.substitute(propty=self.mtyp + 'MarkY' + self.idx + '-Mon')) hbox_y = QHBoxLayout() hbox_y.addWidget(self.lb_y) if self.mtyp == 'D': self.lb_dynamicY = PyDMLabel( self, self.dev.substitute(propty='DynamicDX' + self.idx + '-Mon')) self.lb_dynamicY.setVisible(False) hbox_y.addWidget(self.lb_dynamicY) lay.addRow(label_y, hbox_y) self.pb_max = PyDMPushButton( parent=self, label='Mark Max Peak', pressValue=1, init_channel=self.dev.substitute(propty=self.mtyp + 'MarkMax' + self.idx + '-Cmd')) self.pb_maxnext = PyDMPushButton( parent=self, label='Mark Max Next', pressValue=1, init_channel=self.dev.substitute(propty=self.mtyp + 'MarkMaxNext' + self.idx + '-Cmd')) self.pb_maxright = PyDMPushButton( parent=self, label='Mark Max Right', pressValue=1, init_channel=self.dev.substitute( propty=self.mtyp + 'MarkMaxRight' + self.idx + '-Cmd')) self.pb_maxleft = PyDMPushButton( parent=self, label='Mark Max Left', pressValue=1, init_channel=self.dev.substitute(propty=self.mtyp + 'MarkMaxLeft' + self.idx + '-Cmd')) vbox_cmd = QVBoxLayout() vbox_cmd.addWidget(self.pb_max) vbox_cmd.addWidget(self.pb_maxnext) vbox_cmd.addWidget(self.pb_maxright) vbox_cmd.addWidget(self.pb_maxleft) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(vbox_cmd) if self.mtyp == '' and self.idx == '1': lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) label_enblautomin = QLabel('Enable Auto Min: ', self) self.bt_enblautomin = PyDMStateButton( self, self.dev.substitute(propty='EnblMinAuto-Sel')) self.bt_enblautomin.shape = 1 self.led_enblautomin = SiriusLedState( self, self.dev.substitute(propty='EnblMinAuto-Sts')) hbox_enblautomin = QHBoxLayout() hbox_enblautomin.addWidget(self.bt_enblautomin) hbox_enblautomin.addWidget(self.led_enblautomin) lay.addRow(label_enblautomin, hbox_enblautomin) label_enbllimit = QLabel('Enable Mark Limit: ', self) self.bt_enbllimit = PyDMStateButton( self, self.dev.substitute(propty='EnblMarkLimit-Sel')) self.bt_enbllimit.shape = 1 self.led_enbllimit = SiriusLedState( self, self.dev.substitute(propty='EnblMarkLimit-Sts')) hbox_enbllimit = QHBoxLayout() hbox_enbllimit.addWidget(self.bt_enbllimit) hbox_enbllimit.addWidget(self.led_enbllimit) lay.addRow(label_enbllimit, hbox_enbllimit) label_limright = QLabel('Mark Limit Right: ', self) self.sb_limright = PyDMLineEdit( self, self.dev.substitute(propty='MarkLimitRight-SP')) self.lb_limright = PyDMLabel( self, self.dev.substitute(propty='MarkLimitRight-RB')) hbox_limright = QHBoxLayout() hbox_limright.addWidget(self.sb_limright) hbox_limright.addWidget(self.lb_limright) lay.addRow(label_limright, hbox_limright) label_limleft = QLabel('Mark Limit Left: ', self) self.sb_limleft = PyDMLineEdit( self, self.dev.substitute(propty='MarkLimitLeft-SP')) self.lb_limleft = PyDMLabel( self, self.dev.substitute(propty='MarkLimitLeft-RB')) hbox_limleft = QHBoxLayout() hbox_limleft.addWidget(self.sb_limleft) hbox_limleft.addWidget(self.lb_limleft) lay.addRow(label_limleft, hbox_limleft) self.setStyleSheet(""" QLed{ min-width:1.29em; max-width:1.29em; } #title { min-height:1.29em; max-height:1.29em; qproperty-alignment: "AlignVCenter | AlignHCenter"; } PyDMLabel, PyDMSpinbox, PyDMEnumComboBox, PyDMStateButton{ min-width:6em; max-width:6em; }""")
def _imgIntesityAndBGWidget(self): label_EnblAdjust = QLabel('Enable Scale and Offset Adjust:', self) hbox_EnblAdjust = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='EnblOffsetScale', propty_type='enbldisabl') label_AutoAdjust = QLabel('Automatic Intensity Adjust:', self) hbox_AutoAdjust = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AutoOffsetScale', cmd={ 'label': 'Auto Adjust', 'pressValue': 1, 'name': 'AutoOffsetScale' }) label_PixelScale = QLabel('Pixel Scale:', self) hbox_PixelScale = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='PixelScale', propty_type='sprb', use_linedit=True) label_PixelOffset = QLabel('Pixel Offset:', self) hbox_PixelOffset = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='PixelOffset', propty_type='sprb', use_linedit=True) label_EnblLowClip = QLabel('Enable Low Cliping:', self) hbox_EnblLowClip = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='EnblLowClip', propty_type='enbldisabl') label_LowClip = QLabel('Minimum Intensity for Low Cliping:', self) hbox_LowClip = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='LowClip', propty_type='sprb', use_linedit=True) label_EnblHighClip = QLabel('Enable High Cliping:', self) hbox_EnblHighClip = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='EnblHighClip', propty_type='enbldisabl') label_HighClip = QLabel('Maximum Intensity for High Cliping:', self) hbox_HighClip = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='HighClip', propty_type='sprb', use_linedit=True) label_EnblBG = QLabel('Enable BG Subtraction:', self) hbox_EnblBG = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='EnblBGSubtraction', propty_type='enbldisabl') label_SaveBG = QLabel('Save BG:', self) hbox_SaveBG = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='SaveBG', cmd={ 'label': 'Save', 'pressValue': 1, 'name': 'SaveBG' }) label_ValidBG = QLabel('Is valid BG?', self) hbox_ValidBG = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='ValidBG', propty_type='mon') wid = QWidget() flay = QFormLayout(wid) flay.setLabelAlignment(Qt.AlignRight) flay.setFormAlignment(Qt.AlignHCenter) flay.addRow(label_EnblAdjust, hbox_EnblAdjust) flay.addRow(label_AutoAdjust, hbox_AutoAdjust) flay.addRow(label_PixelScale, hbox_PixelScale) flay.addRow(label_PixelOffset, hbox_PixelOffset) flay.addRow(label_EnblLowClip, hbox_EnblLowClip) flay.addRow(label_LowClip, hbox_LowClip) flay.addRow(label_EnblHighClip, hbox_EnblHighClip) flay.addRow(label_HighClip, hbox_HighClip) flay.addRow(label_EnblBG, hbox_EnblBG) flay.addRow(label_SaveBG, hbox_SaveBG) flay.addRow(label_ValidBG, hbox_ValidBG) return wid
def _acquisitionWidget(self): label_CamEnbl = QLabel('Acquire Enable Status:', self) hbox_CamEnbl = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='Enbl', propty_type='enbldisabl') label_FrameCnt = QLabel('Frame Count:', self) hbox_FrameCnt = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='FrameCnt', propty_type='mon') label_AcqMode = QLabel('Acquire Mode:', self) hbox_AcqMode = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AcqMode', propty_type='enum') label_AcqPeriod = QLabel('Acquire Period [s]:', self) hbox_AcqPeriod = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AcqPeriod', propty_type='sprb') label_AcqPeriodLowLim = QLabel('Acquire Period Low Limit [s]:', self) hbox_AcqPeriodLowLim = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AcqPeriodLowLim', propty_type='sprb') label_ExpMode = QLabel('Exposure Mode:', self) hbox_ExpMode = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='ExposureMode', propty_type='enum') label_ExpTime = QLabel('Exposure Time [us]:', self) hbox_ExpTime = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='ExposureTime', propty_type='sprb') label_Gain = QLabel('Gain [dB]:', self) hbox_Gain = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='Gain', propty_type='sprb', cmd={ 'label': '', 'pressValue': 1, 'width': '25', 'height': '25', 'icon': qta.icon('mdi.auto-fix'), 'icon-size': '20', 'toolTip': 'Auto Gain', 'name': 'AutoGain' }) label_TransformType = QLabel('Transform Type:', self) hbox_TransformType = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='TransformType', propty_type='enum') label_BlackLevel = QLabel('Black Level [gray va]:', self) hbox_BlackLevel = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='BlackLevel', propty_type='sprb') label_DebouncerPeriod = QLabel('Debouncer Period [us]:', self) hbox_DebouncerPeriod = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='DebouncerPeriod', propty_type='sprb') self.pb_advanced = QPushButton('Advanced', self) my_window = create_window_from_widget( BaslerCamAcqAdvSettings, is_main=False, title='Basler Camera Advanced Acquisition Settings') util.connect_window(self.pb_advanced, my_window, parent=self, device=self.device, prefix=self.prefix) hbox_adv = QHBoxLayout() hbox_adv.addWidget(self.pb_advanced, alignment=Qt.AlignRight) wid = QWidget() flay = QFormLayout(wid) flay.setLabelAlignment(Qt.AlignRight) flay.setFormAlignment(Qt.AlignHCenter) flay.addRow(label_CamEnbl, hbox_CamEnbl) flay.addRow(label_FrameCnt, hbox_FrameCnt) flay.addRow(label_AcqMode, hbox_AcqMode) flay.addRow(label_AcqPeriod, hbox_AcqPeriod) flay.addRow(label_AcqPeriodLowLim, hbox_AcqPeriodLowLim) flay.addRow(label_ExpMode, hbox_ExpMode) flay.addRow(label_ExpTime, hbox_ExpTime) flay.addRow(label_Gain, hbox_Gain) flay.addRow(label_BlackLevel, hbox_BlackLevel) flay.addRow(label_DebouncerPeriod, hbox_DebouncerPeriod) flay.addRow(label_TransformType, hbox_TransformType) flay.addRow(hbox_adv) return wid
def _measLayout(self): # Acquisition lbl_acq = QLabel('Acquisition', self) self.bt_acq = PyDMStateButton( self, self.device.substitute(propty='SpecAnaGetSpec-Sel')) self.bt_acq.shape = 1 self.led_acq = SiriusLedState( self, self.device.substitute(propty='SpecAnaGetSpec-Sts')) hbox_acq = QHBoxLayout() hbox_acq.addWidget(self.bt_acq) hbox_acq.addWidget(self.led_acq) # Excitation lbl_drive = QLabel('Excitation', self) self.bt_drive = PyDMStateButton( self, self.device.substitute(propty='Enbl-Sel')) self.bt_drive.shape = 1 value = 0b111 if self.section == 'BO' else 1 self.led_drive = PyDMLedMultiChannel( parent=self, channels2values={self.device.substitute(propty='Enbl-Sts'): value}) self.led_drive.setOffColor(PyDMLed.DarkGreen) hbox_drive = QHBoxLayout() hbox_drive.addWidget(self.bt_drive) hbox_drive.addWidget(self.led_drive) # Excitation Status Detailed gbox_enblsts = QGridLayout() lbl_enblsts = QLabel('Excitation\nEnable Status\nDetailed', self, alignment=Qt.AlignVCenter | Qt.AlignRight) if self.section == 'BO': # # Carrier Generator self.led_carrier = SiriusLedState( self, self.device.substitute(propty='EnblCarrierGen-Sts')) gbox_enblsts.addWidget(self.led_carrier, 0, 0) gbox_enblsts.addWidget(QLabel('Carrier Generator'), 0, 1) # # Noise Generator self.led_noise = SiriusLedState( self, self.device.substitute(propty='EnblNoiseGen-Sts')) gbox_enblsts.addWidget(self.led_noise, 1, 0) gbox_enblsts.addWidget(QLabel('Noise Generator'), 1, 1) else: # # Noise Generator self.led_trkgen = SiriusLedState( self, self.device.substitute(propty='SpecAnaTrkGen-Sts')) gbox_enblsts.addWidget(self.led_trkgen, 1, 0) gbox_enblsts.addWidget(QLabel('Tracking Generator'), 1, 1) # # Amplifier self.led_amp = SiriusLedState( self, self.device.substitute(propty='EnblAmp-Sts')) gbox_enblsts.addWidget(self.led_amp, 2, 0) gbox_enblsts.addWidget(QLabel('Amplifier'), 2, 1) if self.section == 'BO': # Frame Count lbl_acqcnt = QLabel('Frame Count', self) dev = self.device.substitute(dev='TuneProc') self.lb_acqcnt = PyDMLabel(self, dev.substitute(propty='FrameCount-Mon')) self.lb_acqcnt.setAlignment(Qt.AlignCenter) self.led_acqcnt = PyDMLedMultiChannel(parent=self) self.trigNrPulseChannel = SiriusConnectionSignal( self.trigger.substitute(prefix=self.prefix, propty='NrPulses-RB')) self.trigNrPulseChannel.new_value_signal[int].connect( self._updateNrAcq) hbox_acqcnt = QHBoxLayout() hbox_acqcnt.addWidget(self.lb_acqcnt) hbox_acqcnt.addWidget(self.led_acqcnt) # Nr. Samples p/ spec lbl_nrsmp = QLabel('Nr. Samples p/ Spec.', self) self.lb_nrsmp = PyDMLabel(parent=self, init_channel=self.device.substitute( dev='TuneProc', propty_name='SwePts', propty_suffix='RB')) if self.section == 'SI': # Acquisition Time lbl_acqtime = QLabel('Acq. Time', self) self.cb_acqtime = PyDMEnumComboBox( parent=self, init_channel=self.device.substitute(dev='TuneProc', propty_name='Trace', propty_suffix='Mon', field='SCAN')) # Sweep time lbl_swetime = QLabel('Sweep Time [ms]', self) self.lb_swetime = PyDMLabel(parent=self, init_channel=self.device.substitute( dev='TuneProc', propty_name='SweTime', propty_suffix='Mon')) # Span lbl_span = QLabel('Span [kHz]', self) self.le_span = PyDMLineEdit(self, self.device.substitute(propty='Span-SP')) self.le_span.precisionFromPV = True self.lb_span = PyDMLabel(self, self.device.substitute(propty='Span-RB')) hbox_span = QHBoxLayout() hbox_span.addWidget(self.le_span) hbox_span.addWidget(self.lb_span) # RBW lbl_rbw = QLabel('RBW', self) if self.section == 'BO': self.cb_rbw = PyDMEnumComboBox( self, self.device.substitute(propty='SpecAnaRBW-Sel')) else: items = [ '1 Hz', '2 Hz', '3 Hz', '5 Hz', '10 Hz', '20 Hz', '30 Hz', '50 Hz', '100 Hz', '200 Hz', '300 Hz', '500 Hz', '1 kHz', '2 kHz', '3 kHz', '5 kHz', '6.25 kHz', '10 kHz', '20 kHz', '30 kHz', '50 kHz', '100 kHz', '200 kHz', '300 kHz', '500 kHz', '1 MHz', '2 MHz', '3 MHz', '5 MHz', '10 MHz' ] self.cb_rbw = SiriusStringComboBox( self, self.device.substitute(propty='SpecAnaRBW-Sel'), items=items) self.lb_rbw = PyDMLabel( self, self.device.substitute(propty='SpecAnaRBW-Sts')) hbox_rbw = QHBoxLayout() hbox_rbw.addWidget(self.cb_rbw) hbox_rbw.addWidget(self.lb_rbw) # Harmonic lbl_h = QLabel('Harmonic (n)', self) self.sb_h = PyDMSpinbox(self, self.device.substitute(propty='RevN-SP')) self.sb_h.showStepExponent = False self.sb_h.precisionFromPV = True self.lb_h = PyDMLabel(self, self.device.substitute(propty='RevN-RB')) hbox_h = QHBoxLayout() hbox_h.addWidget(self.sb_h) hbox_h.addWidget(self.lb_h) # Harmonic Frequency lbl_Fh = QLabel('Harm. Freq. [kHz]', self) self.lb_Fh = PyDMLabel(parent=self) self.lb_Fh.setToolTip('Frf/(h*n)') self.lb_Fh.channel = self.device.substitute(propty='FreqRevN-Mon') # Frequency Offset lbl_foff = QLabel('Frequency Offset [kHz]', self) self.sb_foff = PyDMSpinbox(self, self.device.substitute(propty='FreqOff-SP')) self.sb_foff.showStepExponent = False self.sb_foff.precisionFromPV = True self.lb_foff = PyDMLabel(self, self.device.substitute(propty='FreqOff-RB')) hbox_foff = QHBoxLayout() hbox_foff.addWidget(self.sb_foff) hbox_foff.addWidget(self.lb_foff) # Center Frequency lbl_Fc = QLabel('Center Frequency [MHz]', self) self.le_Fc = PyDMLineEdit( self, self.device.substitute(propty='CenterFreq-SP')) self.le_Fc.precisionFromPV = True self.lb_Fc = PyDMLabel(self, self.device.substitute(propty='CenterFreq-RB')) hbox_Fc = QHBoxLayout() hbox_Fc.addWidget(self.le_Fc) hbox_Fc.addWidget(self.lb_Fc) # Lock Center Freq. lbl_autoFc = QLabel('Lock Center Frequency ', self) self.bt_autoFc = PyDMStateButton( self, self.device.substitute(propty='CenterFreqAuto-Sel')) self.bt_autoFc.shape = 1 self.led_autoFc = SiriusLedState( self, self.device.substitute(propty='CenterFreqAuto-Sts')) hbox_autoFc = QHBoxLayout() hbox_autoFc.addWidget(self.bt_autoFc) hbox_autoFc.addWidget(self.led_autoFc) # Amplifier Gain lbl_drivegain = QLabel('Amplifier Gain [dB]', self) self.sb_drivegain = PyDMSpinbox( self, self.device.substitute(propty='AmpGain-SP')) self.sb_drivegain.showStepExponent = False self.sb_drivegain.precisionFromPV = True self.lb_drivegain = PyDMLabel( self, self.device.substitute(propty='AmpGain-RB')) hbox_drivegain = QHBoxLayout() hbox_drivegain.addWidget(self.sb_drivegain) hbox_drivegain.addWidget(self.lb_drivegain) if self.section == 'BO': # Auto Configure Excitation lbl_driveauto = QLabel('Auto Config. Excit.', self) self.bt_driveauto = PyDMStateButton( self, self.device.substitute(propty='DriveAuto-Sel')) self.bt_driveauto.shape = 1 self.led_driveauto = SiriusLedState( self, self.device.substitute(propty='DriveAuto-Sts')) hbox_driveauto = QHBoxLayout() hbox_driveauto.addWidget(self.bt_driveauto) hbox_driveauto.addWidget(self.led_driveauto) # Noise Amplitude lbl_noiseamp = QLabel('Noise Amplitude [V]', self) self.sb_noiseamp = PyDMSpinbox( self, self.device.substitute(propty='NoiseAmpl-SP')) self.sb_noiseamp.showStepExponent = False self.sb_noiseamp.precisionFromPV = True self.lb_noiseamp = PyDMLabel( self, self.device.substitute(propty='NoiseAmpl-RB')) hbox_noiseamp = QHBoxLayout() hbox_noiseamp.addWidget(self.sb_noiseamp) hbox_noiseamp.addWidget(self.lb_noiseamp) else: # Noise Amplitude lbl_trkgenlvl = QLabel('Trk. Gen. Power [dBm]', self) self.sb_trkgenlvl = PyDMLineEdit( self, self.device.substitute(propty='SpecAnaTrkGenLvl-SP')) self.lb_trkgenlvl = PyDMLabel( self, self.device.substitute(propty='SpecAnaTrkGenLvl-RB')) hbox_trkgenlvl = QHBoxLayout() hbox_trkgenlvl.addWidget(self.sb_trkgenlvl) hbox_trkgenlvl.addWidget(self.lb_trkgenlvl) # Spectrum Acquisition lbl_getspec = QLabel('Spectrum Acq.', self) self.cb_getspec = PyDMStateButton( parent=self, init_channel=self.device.substitute(dev='TuneProc', propty_name='GetSpectrum', propty_suffix='Sel')) self.cb_getspec.shape = 1 self.lb_getspec = PyDMLed(parent=self, init_channel=self.device.substitute( dev='TuneProc', propty_name='GetSpectrum', propty_suffix='Sts')) hbox_getspec = QHBoxLayout() hbox_getspec.addWidget(self.cb_getspec) hbox_getspec.addWidget(self.lb_getspec) lay = QFormLayout() lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) lay.addRow(lbl_acq, hbox_acq) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_drive, hbox_drive) lay.addRow(lbl_enblsts, gbox_enblsts) if self.section == 'BO': lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_acqcnt, hbox_acqcnt) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_nrsmp, self.lb_nrsmp) if self.section == 'SI': lay.addRow(lbl_acqtime, self.cb_acqtime) lay.addRow(lbl_swetime, self.lb_swetime) lay.addRow(lbl_span, hbox_span) lay.addRow(lbl_rbw, hbox_rbw) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_h, hbox_h) lay.addRow(lbl_Fh, self.lb_Fh) lay.addRow(lbl_foff, hbox_foff) lay.addRow(lbl_Fc, hbox_Fc) lay.addRow(lbl_autoFc, hbox_autoFc) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_drivegain, hbox_drivegain) if self.section == 'BO': lay.addRow(lbl_driveauto, hbox_driveauto) lay.addRow(lbl_noiseamp, hbox_noiseamp) else: lay.addRow(lbl_trkgenlvl, hbox_trkgenlvl) lay.addItem(QSpacerItem(1, 6, QSzPlcy.Ignored, QSzPlcy.Fixed)) lay.addRow(lbl_getspec, hbox_getspec) return lay
def __init__(self, parent, device='', prefix='', delay=True, duration=False, nrpulses=False, src=False): super().__init__(parent, device, prefix) flay = QFormLayout(self) flay.setLabelAlignment(Qt.AlignRight) flay.setFormAlignment(Qt.AlignCenter) l_TIstatus = QLabel('Status: ', self) ledmulti_TIStatus = PyDMLedMultiChannel( parent=self, channels2values={ self.get_pvname('State-Sts'): 1, self.get_pvname('Status-Mon'): 0 }) ledmulti_TIStatus.setStyleSheet( "min-width:1.29em; max-width:1.29em;" "min-height:1.29em; max-height:1.29em;") pb_trgdetails = QPushButton(qta.icon('fa5s.ellipsis-h'), '', self) pb_trgdetails.setToolTip('Open details') pb_trgdetails.setObjectName('detail') pb_trgdetails.setStyleSheet( "#detail{min-width:25px; max-width:25px; icon-size:20px;}") trg_w = create_window_from_widget(HLTriggerDetailed, title=device + ' Detailed Settings', is_main=True) connect_window(pb_trgdetails, trg_w, parent=None, device=self.device, prefix=self.prefix) hlay_TIstatus = QHBoxLayout() hlay_TIstatus.addWidget(ledmulti_TIStatus) hlay_TIstatus.addWidget(pb_trgdetails) flay.addRow(l_TIstatus, hlay_TIstatus) if delay: l_delay = QLabel('Delay [us]: ', self) l_delay.setStyleSheet("min-width:5em;") hlay_delay = self._create_propty_layout(propty='Delay-SP') flay.addRow(l_delay, hlay_delay) if duration: l_duration = QLabel('Duration [us]: ', self) l_duration.setStyleSheet("min-width:5em;") hlay_duration = self._create_propty_layout(propty='Duration-SP') flay.addRow(l_duration, hlay_duration) if nrpulses: l_nrpulses = QLabel('Nr Pulses: ', self) l_nrpulses.setStyleSheet("min-width:5em;") hlay_nrpulses = self._create_propty_layout(propty='NrPulses-SP') flay.addRow(l_nrpulses, hlay_nrpulses) if src: l_src = QLabel('Source: ', self) l_src.setStyleSheet("min-width:5em;") hlay_src = self._create_propty_layout(propty='Src-Sel') flay.addRow(l_src, hlay_src)
def _infoWidget(self): label_DevID = QLabel('Device ID:', self) hbox_DevID = create_propty_layout(parent=self, prefix=self.cam_prefix, width=15, propty='DeviceID', propty_type='cte') hbox_DevID.setAlignment(Qt.AlignLeft) label_DevVers = QLabel('Device Version:', self) hbox_DevVers = create_propty_layout(parent=self, prefix=self.cam_prefix, width=15, propty='DeviceVersion', propty_type='cte') hbox_DevVers.setAlignment(Qt.AlignLeft) label_DevModelName = QLabel('Device Model Name:', self) hbox_DevModelName = create_propty_layout(parent=self, prefix=self.cam_prefix, width=15, propty='DeviceModelName', propty_type='cte') hbox_DevModelName.setAlignment(Qt.AlignLeft) label_DevVendorName = QLabel('Device Vendor Name:', self) hbox_DevVendorName = create_propty_layout(parent=self, prefix=self.cam_prefix, width=15, propty='DeviceVendorName', propty_type='cte') hbox_DevVendorName.setAlignment(Qt.AlignLeft) label_DevFirmVers = QLabel('Firmware Version:', self) hbox_DevFirmVers = create_propty_layout(parent=self, prefix=self.cam_prefix, width=15, propty='DeviceFirmwareVersion', propty_type='cte') hbox_DevFirmVers.setAlignment(Qt.AlignLeft) label_SensorHeight = QLabel('Sensor Height [pixels]:', self) hbox_SensorHeight = create_propty_layout(parent=self, prefix=self.cam_prefix, width=15, propty='SensorHeight', propty_type='cte') hbox_SensorHeight.setAlignment(Qt.AlignLeft) label_SensorWidth = QLabel('Sensor Width [pixels]:', self) hbox_SensorWidth = create_propty_layout(parent=self, prefix=self.cam_prefix, width=15, propty='SensorWidth', propty_type='cte') hbox_SensorWidth.setAlignment(Qt.AlignLeft) wid = QWidget() flay = QFormLayout(wid) flay.setLabelAlignment(Qt.AlignRight) flay.setFormAlignment(Qt.AlignHCenter) flay.addRow(label_DevID, hbox_DevID) flay.addRow(label_DevVers, hbox_DevVers) flay.addRow(label_DevModelName, hbox_DevModelName) flay.addRow(label_DevVendorName, hbox_DevVendorName) flay.addRow(label_DevFirmVers, hbox_DevFirmVers) flay.addRow(label_SensorHeight, hbox_SensorHeight) flay.addRow(label_SensorWidth, hbox_SensorWidth) return wid
def _calibrationgridLayout(self): self.checkBox_showgrid = QCheckBox('Show', self) self.checkBox_showgrid.setEnabled(False) self.checkBox_showgrid.setStyleSheet(""" min-width:4em; max-width:4em; min-height:1.29em; max-height:1.29em;""") self.checkBox_showgrid.toggled.connect( self.image_view.showCalibrationGrid) self.pushbutton_savegrid = QPushButton('Save', self) self.pushbutton_savegrid.setEnabled(False) self.pushbutton_savegrid.setStyleSheet(""" min-width:4em; max-width:4em; min-height:1.29em; max-height:1.29em;""") self.pushbutton_savegrid.clicked.connect(self._saveCalibrationGrid) self.pushbutton_loadgrid = QPushButton('Load', self) self.pushbutton_loadgrid.setStyleSheet(""" min-width:4em; max-width:4em; min-height:1.29em; max-height:1.29em;""") self.pushbutton_loadgrid.clicked.connect(self._loadCalibrationGrid) hbox_grid = QHBoxLayout() hbox_grid.addWidget(self.checkBox_showgrid) hbox_grid.addWidget(self.pushbutton_savegrid) hbox_grid.addWidget(self.pushbutton_loadgrid) lb = QLabel('Show levels <') lb.setStyleSheet("min-width:7em;max-width:7em;") self.spinbox_gridfilterfactor = QSpinBoxPlus() self.spinbox_gridfilterfactor.setMaximum(100) self.spinbox_gridfilterfactor.setMinimum(0) self.spinbox_gridfilterfactor.setValue( self.image_view.calibration_grid_filterfactor) self.spinbox_gridfilterfactor.editingFinished.connect( self._setCalibrationGridFilterFactor) self.spinbox_gridfilterfactor.setStyleSheet(""" min-width:4em; max-width:4em;""") hbox_filter = QHBoxLayout() hbox_filter.setSpacing(0) hbox_filter.addWidget(lb) hbox_filter.addWidget(self.spinbox_gridfilterfactor) hbox_filter.addWidget(QLabel(' %')) lb = QLabel('Remove border: ') lb.setStyleSheet("min-width:7em;max-width:7em;") self.spinbox_removeborder = QSpinBoxPlus() self.spinbox_removeborder.setMaximum(512) self.spinbox_removeborder.setMinimum(0) self.spinbox_removeborder.setValue( self.image_view.calibration_grid_removeborder) self.spinbox_removeborder.editingFinished.connect( self._setCalibrationGridBorder2Remove) self.spinbox_removeborder.setStyleSheet(""" min-width:4em; max-width:4em;""") hbox_remove = QHBoxLayout() hbox_remove.setSpacing(0) hbox_remove.addWidget(lb) hbox_remove.addWidget(self.spinbox_removeborder) hbox_remove.addWidget(QLabel(' px')) hbox_EnblLED = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='EnblLED', propty_type='enbldisabl', width=4.68) lay = QFormLayout() lay.addItem(QSpacerItem(1, 10, QSzPlcy.Ignored, QSzPlcy.Preferred)) lay.addRow(' Grid: ', hbox_grid) lay.addItem(QSpacerItem(1, 10, QSzPlcy.Ignored, QSzPlcy.Preferred)) lay.addRow(' ', hbox_filter) lay.addRow(' ', hbox_remove) lay.addItem(QSpacerItem(1, 20, QSzPlcy.Ignored, QSzPlcy.Preferred)) lay.addRow(' LED: ', hbox_EnblLED) lay.addItem(QSpacerItem(1, 10, QSzPlcy.Ignored, QSzPlcy.Preferred)) lay.setLabelAlignment(Qt.AlignRight) lay.setFormAlignment(Qt.AlignCenter) return lay
def _ROIWidget(self): label_MaxWidth = QLabel('Maximum Width [pixels]:', self) self.PyDMLabel_MaxWidth = PyDMLabel( self, self.cam_prefix.substitute(propty='SensorWidth-Cte')) self.PyDMLabel_MaxWidth.setStyleSheet( """max-width:7.10em; max-height:1.29em;""") label_MaxHeight = QLabel('Maximum Height [pixels]:', self) self.PyDMLabel_MaxHeight = PyDMLabel( self, self.cam_prefix.substitute(propty='SensorHeight-Cte')) self.PyDMLabel_MaxHeight.setStyleSheet( """max-width:7.10em; max-height:1.29em;""") label_ROIWidth = QLabel('Width [pixels]:', self) hbox_ROIWidth = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AOIWidth', propty_type='sprb') label_ROIHeight = QLabel('Heigth [pixels]:', self) hbox_ROIHeight = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AOIHeight', propty_type='sprb') label_ROIOffsetX = QLabel('Offset X [pixels]:', self) hbox_ROIOffsetX = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AOIOffsetX', propty_type='sprb') label_ROIOffsetY = QLabel('Offset Y [pixels]:', self) hbox_ROIOffsetY = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AOIOffsetY', propty_type='sprb') label_AutoCenterX = QLabel('Auto Center X:', self) hbox_AutoCenterX = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AOIAutoCenterX', propty_type='offon') label_AutoCenterY = QLabel('Auto Center Y:', self) hbox_AutoCenterY = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AOIAutoCenterY', propty_type='offon') wid = QWidget() flay = QFormLayout(wid) flay.setLabelAlignment(Qt.AlignRight) flay.setFormAlignment(Qt.AlignHCenter) flay.addRow(label_MaxWidth, self.PyDMLabel_MaxWidth) flay.addRow(label_MaxHeight, self.PyDMLabel_MaxHeight) flay.addRow(label_ROIWidth, hbox_ROIWidth) flay.addRow(label_ROIHeight, hbox_ROIHeight) flay.addRow(label_ROIOffsetX, hbox_ROIOffsetX) flay.addRow(label_ROIOffsetY, hbox_ROIOffsetY) flay.addRow(label_AutoCenterX, hbox_AutoCenterX) flay.addRow(label_AutoCenterY, hbox_AutoCenterY) return wid
def _settingsLayout(self): label_CamEnbl = QLabel('Enable: ', self) hbox_CamEnbl = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='CamEnbl', propty_type='enbldisabl') label_CamAcqPeriod = QLabel('Acquire\nPeriod [s]:', self) hbox_CamAcqPeriod = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='CamAcqPeriod', propty_type='sprb', width=5.0) label_CamExposureTime = QLabel('Exposure\nTime [us]:', self) hbox_CamExposureTime = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='CamExposureTime', propty_type='sprb', width=5.0) label_CamGain = QLabel('Gain[dB]:', self) hbox_CamGain = _create_propty_layout(parent=self, prefix=self.scrn_prefix, propty='CamGain', width=5.0, propty_type='sprb') label_AutoGain = QLabel('Auto Gain: ', self) self.pb_autogain = PyDMPushButton( label='', icon=qta.icon('mdi.auto-fix'), parent=self, pressValue=1, init_channel=self.scrn_prefix.substitute(propty='CamAutoGain-Cmd')) self.pb_autogain.setObjectName('autog') self.pb_autogain.setStyleSheet( "#autog{min-width:25px; max-width:25px; icon-size:20px;}") cam_prefix = SiriusPVName(self.scrn_prefix).substitute(dev='ScrnCam') label_Reset = QLabel('Reset: ', self) self.pb_dtl = PyDMPushButton( label='', icon=qta.icon('fa5s.sync'), parent=self, pressValue=1, init_channel=cam_prefix.substitute(propty='Rst-Cmd')) self.pb_dtl.setObjectName('reset') self.pb_dtl.setStyleSheet( "#reset{min-width:25px; max-width:25px; icon-size:20px;}") self.pb_details = QPushButton(qta.icon('fa5s.ellipsis-h'), '', self) self.pb_details.setToolTip('More settings') self.pb_details.setObjectName('detail') self.pb_details.setStyleSheet( "#detail{min-width:25px; max-width:25px; icon-size:20px;}") self.pb_details.setSizePolicy(QSzPlcy.Expanding, QSzPlcy.Preferred) util.connect_window(self.pb_details, _ScrnSettingsDetails, parent=self, prefix=self.prefix, device=self.device) hbox_aux = QHBoxLayout() hbox_aux.addWidget(self.pb_dtl, alignment=Qt.AlignLeft) hbox_aux.addWidget(self.pb_details, alignment=Qt.AlignRight) lay = QFormLayout() lay.setFormAlignment(Qt.AlignCenter) lay.addRow(label_CamEnbl, hbox_CamEnbl) lay.addRow(label_CamAcqPeriod, hbox_CamAcqPeriod) lay.addRow(label_CamExposureTime, hbox_CamExposureTime) lay.addRow(label_CamGain, hbox_CamGain) lay.addRow(label_AutoGain, self.pb_autogain) lay.addRow(label_Reset, hbox_aux) return lay
def _setupSettingsLayout(self): label_CamEnbl = QLabel('Enable:', self) hbox_CamEnbl = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='Enbl', propty_type='enbldisabl', width=3) label_FrameCnt = QLabel('Frame Count:', self) hbox_FrameCnt = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='FrameCnt', propty_type='mon') label_Conn = QLabel('Connection:', self) hbox_Conn = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='Connection', propty_type='mon') label_Reset = QLabel('Reset Camera:', self) self.pb_dtl = PyDMPushButton( label='', icon=qta.icon('fa5s.sync'), parent=self, pressValue=1, init_channel=self.cam_prefix.substitute(propty='Rst-Cmd')) self.pb_dtl.setObjectName('reset') self.pb_dtl.setStyleSheet( "#reset{min-width:25px; max-width:25px; icon-size:20px;}") flay_sts = QFormLayout() flay_sts.setSpacing(6) flay_sts.setFormAlignment(Qt.AlignHCenter) flay_sts.setLabelAlignment(Qt.AlignRight) flay_sts.addRow(label_CamEnbl, hbox_CamEnbl) flay_sts.addRow(label_FrameCnt, hbox_FrameCnt) flay_sts.addRow(label_Conn, hbox_Conn) flay_sts.addRow(label_Reset, self.pb_dtl) label_AcqMode = QLabel('Acq. Mode:', self) hbox_AcqMode = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AcqMode', propty_type='enum') label_AcqPeriod = QLabel('Acq. Period [s]:', self) hbox_AcqPeriod = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='AcqPeriod', propty_type='sprb') label_ExpTime = QLabel('Exp. Time [us]:', self) hbox_ExpTime = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='ExposureTime', propty_type='sprb') label_Gain = QLabel('Gain [dB]:', self) hbox_Gain = create_propty_layout(parent=self, prefix=self.cam_prefix, propty='Gain', propty_type='sprb', cmd={ 'label': '', 'pressValue': 1, 'width': '25', 'height': '25', 'icon': qta.icon('mdi.auto-fix'), 'icon-size': '20', 'toolTip': 'Auto Gain', 'name': 'AutoGain' }) flay_ctrl = QFormLayout() flay_ctrl.setSpacing(6) flay_ctrl.setFormAlignment(Qt.AlignHCenter) flay_ctrl.setLabelAlignment(Qt.AlignRight) flay_ctrl.addRow(label_AcqMode, hbox_AcqMode) flay_ctrl.addRow(label_AcqPeriod, hbox_AcqPeriod) flay_ctrl.addRow(label_ExpTime, hbox_ExpTime) flay_ctrl.addRow(label_Gain, hbox_Gain) self.pb_details = QPushButton(qta.icon('fa5s.ellipsis-h'), '', self) self.pb_details.setToolTip('More settings') self.pb_details.setObjectName('detail') self.pb_details.setStyleSheet( "#detail{min-width:25px; max-width:25px; icon-size:20px;}") self.pb_details.setSizePolicy(QSzPlcy.Expanding, QSzPlcy.Preferred) MyWindow = create_window_from_widget(BaslerCamSettings, title=self.device + ' Settings Details', is_main=True) util.connect_window(self.pb_details, MyWindow, parent=self, prefix=self.prefix, device=self.device) lay = QHBoxLayout() lay.setSpacing(20) lay.addLayout(flay_sts) lay.addLayout(flay_ctrl) lay.addWidget(self.pb_details, alignment=Qt.AlignTop) return lay