How to use the nexusformat.nexus.NXlink function in nexusformat

To help you get started, we’ve selected a few nexusformat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nexpy / nexpy / src / nexpy / gui / treeview.py View on Github external
return '\n'.join(tree.split('\n')[0:50])+'\n...'
            else:
                return tree
        elif role == QtCore.Qt.DecorationRole:
            if isinstance(self.node, NXroot):
                if self.node.nxfilemode == 'r':
                    if self.node._file_modified:
                        return self._locked_modified
                    else:
                        return self._locked
                elif self.node.nxfilemode == 'rw':
                    if self.node._file_modified:
                        return self._unlocked_modified
                    else:
                        return self._unlocked
            elif isinstance(self.node, NXlink):
                return self._linked
            else:
                return None
github nexpy / nexpy / src / nexpy / gui / datadialogs.py View on Github external
self.node = node
        self.spinboxes = []

        layout = QtWidgets.QVBoxLayout()
        self.properties = GridParameters()
        
        self.properties.add('class', node.__class__.__name__, 'Class')
        self.properties.add('name', node.nxname, 'Name')
        self.properties.add('path', node.nxpath, 'Path')
        if node.nxroot.nxfilename:
            self.properties.add('file', node.nxroot.nxfilename, 'File')
        if node.exists():
            target_label = 'Target File'
        else:
            target_label = 'Target File*'
        if isinstance(node, NXlink):
            self.properties.add('target', node._target, 'Target Path')
            if node._filename:
                self.properties.add('linkfile', node._filename, target_label)
            elif node.nxfilename and node.nxfilename != node.nxroot.nxfilename:
                self.properties.add('linkfile', node.nxfilename, target_label)
        elif node.nxfilename and node.nxfilename != node.nxroot.nxfilename:
            self.properties.add('target', node.nxfilepath, 'Target Path')
            self.properties.add('linkfile', node.nxfilename, target_label)
        if node.nxfilemode:
            self.properties.add('filemode', node.nxfilemode, 'Mode')
        if not node.exists():
            pass
        elif isinstance(node, NXfield) and node.shape is not None:
            if node.shape == () or node.shape == (1,):
                self.properties.add('value', six.text_type(node), 'Value')
            self.properties.add('dtype', node.dtype, 'Dtype')
github nexpy / nexpy / src / nexpy / gui / treeview.py View on Github external
self.mainwindow.unlockfile_action.setEnabled(True)
                else:
                    self.mainwindow.lockfile_action.setEnabled(True)
                self.mainwindow.backup_action.setEnabled(True)
                if node.nxbackup:
                    self.mainwindow.restore_action.setEnabled(True)
            if node.nxfilemode is None or node.nxfilemode == 'rw':
                if self.mainwindow.copied_node is not None:
                    self.mainwindow.pastedata_action.setEnabled(True)
                    self.mainwindow.pastelink_action.setEnabled(True)
            if node.nxfilemode is None:
                self.mainwindow.delete_action.setEnabled(True)
        else:
            self.mainwindow.copydata_action.setEnabled(True)
            self.mainwindow.cutdata_action.setEnabled(True)
            if isinstance(node, NXlink):
                self.mainwindow.link_action.setEnabled(True)
            try:
                if (isinstance(node, NXdata) and
                    node.plottable_data.nxsignal.plot_rank == 1):
                    self.mainwindow.export_action.setEnabled(True)
            except Exception as error:
                pass
            if node.nxfilemode is None or node.nxfilemode == 'rw':
                if isinstance(node, NXgroup):
                    self.mainwindow.initialize_action.setEnabled(True)
                    if self.mainwindow.copied_node is not None:
                        self.mainwindow.pastedata_action.setEnabled(True)
                        self.mainwindow.pastelink_action.setEnabled(True)
                self.mainwindow.delete_action.setEnabled(True)
                if isinstance(node, NXentry) or isinstance(node, NXdata):
                    self.mainwindow.default_action.setEnabled(True)