Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self._cmd.arg:
self._path += '/True'
if self._cmd.disp == 'enum' and self._cmd.enum is not None and self._cmd.mode != 'RO':
w = PyDMEnumComboBox(parent=None, init_channel=self._path)
w.alarmSensitiveContent = False
w.alarmSensitiveBorder = False
else:
w = PyDMLineEdit(parent=None, init_channel=self._path)
w.showUnits = False
w.precisionFromPV = True
w.alarmSensitiveContent = False
w.alarmSensitiveBorder = False
else:
w = PyDMPushButton(label='Exec',pressValue=1,init_channel=self._path)
self._top._tree.setItemWidget(self,2,w)
self._loadConfigValue = QLineEdit()
self._loadConfigValue.textChanged.connect(self._loadConfigChanged)
hb.addWidget(self._loadConfigValue)
pb = QPushButton('Browse')
pb.clicked.connect(self._loadConfigBrowse)
hb.addWidget(pb)
# Save Config
# This needs to be changed to the new pydm command interface with the push
# button commiting the line edit value
hb = QHBoxLayout()
vb.addLayout(hb)
self._saveConfigCmd = PyDMPushButton(label='Save Config',
pressValue='',
init_channel=self._path + '.SaveConfig')
hb.addWidget(self._saveConfigCmd)
self._saveConfigValue = QLineEdit()
self._saveConfigValue.textChanged.connect(self._saveConfigChanged)
hb.addWidget(self._saveConfigValue)
pb = QPushButton('Browse')
pb.clicked.connect(self._saveConfigBrowse)
hb.addWidget(pb)
# Save State
# This needs to be changed to the new pydm command interface with the push
# button commiting the line edit value
fl.setLabelAlignment(Qt.AlignRight)
vb.addLayout(fl)
self._dataFile = PyDMLineEdit(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)
pb = QPushButton('Browse')
pb.clicked.connect(self._browse)
hb.addWidget(pb)
w = PyDMPushButton(label='Auto Name',pressValue=1,init_channel=self._path + '.AutoName')
hb.addWidget(w)
w = PyDMPushButton(label='Open',pressValue=1,init_channel=self._path + '.Open')
hb.addWidget(w)
w = PyDMPushButton(label='Close',pressValue=1,init_channel=self._path + '.Close')
hb.addWidget(w)
hb = QHBoxLayout()
vb.addLayout(hb)
vbl = QVBoxLayout()
hb.addLayout(vbl)
fl = QFormLayout()
fl.setRowWrapPolicy(QFormLayout.DontWrapRows)
self._saveConfigValue = QLineEdit()
self._saveConfigValue.textChanged.connect(self._saveConfigChanged)
hb.addWidget(self._saveConfigValue)
pb = QPushButton('Browse')
pb.clicked.connect(self._saveConfigBrowse)
hb.addWidget(pb)
# Save State
# This needs to be changed to the new pydm command interface with the push
# button commiting the line edit value
hb = QHBoxLayout()
vb.addLayout(hb)
self._saveStateCmd = PyDMPushButton(label='Save State ',
pressValue='',
init_channel=self._path + '.SaveState')
hb.addWidget(self._saveStateCmd)
self._saveStateValue = QLineEdit()
self._saveStateValue.textChanged.connect(self._saveStateChanged)
hb.addWidget(self._saveStateValue)
pb = QPushButton('Browse')
pb.clicked.connect(self._saveStateBrowse)
hb.addWidget(pb)
self._tree.setHeaderLabels(['Variable','Mode','Type','Value','Units'])
self._tree.setContextMenuPolicy(Qt.CustomContextMenu)
self._tree.customContextMenuRequested.connect(self._openMenu)
self._tree.itemExpanded.connect(self._expandCb)
hb = QHBoxLayout()
vb.addLayout(hb)
if self._node == self._client.root:
chan = 'rogue://{}:{}/root.ReadAll'.format(self._addr,self._port)
else:
chan = 'rogue://{}:{}/{}.ReadDevice'.format(self._addr,self._port,self._node.path)
pb = PyDMPushButton(label='Read',pressValue=1,init_channel=chan)
hb.addWidget(pb)
self._children.append(VariableDev(top=self, parent=self._tree, dev=self._node, noExpand=False))
w = PyDMLabel(parent=None, init_channel=self._path + '/name')
w.showUnits = False
w.precisionFromPV = False
w.alarmSensitiveContent = False
w.alarmSensitiveBorder = True
self._top._tree.setItemWidget(self,0,w)
self.setToolTip(0,self._cmd.description)
self.setText(1,self._cmd.typeStr)
# This needs to be changed when pydm is updated. In the future the primary
# channel interface will be the input widget, with the button generating a
# update of the channel.
self._btn = PyDMPushButton(label='Exec',
pressValue=self._value,
init_channel=self._path + '/disp')
self._btn.setToolTip(self._cmd.description)
self._top._tree.setItemWidget(self,2,self._btn)
if self._cmd.arg:
if self._cmd.disp == 'enum' and self._cmd.enum is not None:
self._widget = QComboBox()
for i in self._cmd.enum:
self._widget.addItem(self._cmd.enum[i])
self._value = self._cmd.valueDisp()
self._widget.setCurrentIndex(self._widget.findText(self._value))
self._widget.setToolTip(self._cmd.description)
gb = QGroupBox('System Log')
vb.addWidget(gb)
vb = QVBoxLayout()
gb.setLayout(vb)
self._systemLog = QTreeWidget()
vb.addWidget(self._systemLog)
self._systemLog.setColumnCount(2)
self._systemLog.setHeaderLabels(['Field','Value'])
self._logCount = 0
self._pb = PyDMPushButton(label='Clear Log',pressValue=1,init_channel=cpath)
vb.addWidget(self._pb)
vb = QVBoxLayout()
self.setLayout(vb)
self._tree = QTreeWidget()
vb.addWidget(self._tree)
self._tree.setColumnCount(5)
self._tree.setHeaderLabels(['Variable','Mode','Type','Value','Units'])
self._tree.itemExpanded.connect(self._expandCb)
hb = QHBoxLayout()
vb.addLayout(hb)
if self._node.isinstance(pyrogue.Root):
hb.addWidget(PyDMPushButton(label='Read All',
pressValue=True,
init_channel=self._path + '.ReadAll'))
else:
hb.addWidget(PyDMPushButton(label='Read Recursive',
pressValue=True,
init_channel=self._path + '.ReadDevice'))
self.setUpdatesEnabled(False)
VariableDev(path = self._path, top=self, parent=self._tree, dev=self._node, noExpand=False)
self.setUpdatesEnabled(True)