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 _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 import_pythonpath(self): """Import from PYTHONPATH environment variable""" env_pypath = os.environ.get('PYTHONPATH', '') if env_pypath: env_pypath = env_pypath.split(os.pathsep) dlg = QDialog(self) dlg.setWindowTitle(_("PYTHONPATH")) dlg.setWindowIcon(ima.icon('pythonpath')) dlg.setAttribute(Qt.WA_DeleteOnClose) dlg.setMinimumWidth(400) label = QLabel("The following paths from your PYTHONPATH " "environment variable will be imported.") listw = QListWidget(dlg) listw.addItems(env_pypath) bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) bbox.accepted.connect(dlg.accept) bbox.rejected.connect(dlg.reject) layout = QVBoxLayout() layout.addWidget(label) layout.addWidget(listw) layout.addWidget(bbox) dlg.setLayout(layout) if dlg.exec(): spy_pypath = self.get_path_dict() n = len(spy_pypath) for path in reversed(env_pypath): if (path in spy_pypath) or not self.check_path(path): continue item = self._create_item(path) self.listwidget.insertItem(n, item) self.refresh() else: QMessageBox.information( self, _("PYTHONPATH"), _("Your <tt>PYTHONPATH</tt> environment variable is empty, so " "there is nothing to import."), QMessageBox.Ok)