How to use the silx.gui.qt.QModelIndex function in silx

To help you get started, we’ve selected a few silx 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 silx-kit / pyFAI / pyFAI / gui / tasks / PeakPickingTask.py View on Github external
def __invalidateItem(self, index):
        index1 = self.index(index, 0, qt.QModelIndex())
        index2 = self.index(index, self.columnCount() - 1, qt.QModelIndex())
        self.dataChanged.emit(index1, index2)
github silx-kit / silx / silx / gui / hdf5 / Hdf5TreeModel.py View on Github external
    def columnCount(self, parent=qt.QModelIndex()):
        return len(self.COLUMN_IDS)
github silx-kit / silx / silx / app / view / CustomNxdataWidget.py View on Github external
def __init__(self, parent=None):
        """Constructor"""
        super(CustomNxDataToolBar, self).__init__(parent=parent)
        self.__nxdataWidget = None
        self.__initContent()
        # Initialize action state
        self.__currentSelectionChanged(qt.QModelIndex(), qt.QModelIndex())
github silx-kit / silx / silx / gui / hdf5 / Hdf5TreeModel.py View on Github external
def insertNode(self, row, node):
        if row == -1:
            row = self.__root.childCount()
        self.beginInsertRows(qt.QModelIndex(), row, row)
        self.__root.insertChild(row, node)
        self.endInsertRows()
github silx-kit / silx / silx / gui / hdf5widget.py View on Github external
def insertNode(self, row, node):
        if row == -1:
            row = self.__root.childCount()
        self.beginInsertRows(qt.QModelIndex(), row, row)
        self.__root.insertChild(row, node)
        self.endInsertRows()
github silx-kit / silx / silx / app / view / Viewer.py View on Github external
def __synchronizeH5pyObject(self, h5):
        model = self.__treeview.findHdf5TreeModel()
        # This is buggy right now while h5py do not allow to close a file
        # while references are still used.
        # FIXME: The architecture have to be reworked to support this feature.
        # model.synchronizeH5pyObject(h5)

        filename = h5.filename
        row = model.h5pyObjectRow(h5)
        index = self.__treeview.model().index(row, 0, qt.QModelIndex())
        paths = self.__getPathFromExpandedNodes(self.__treeview, index)
        model.removeH5pyObject(h5)
        model.insertFile(filename, row)
        index = self.__treeview.model().index(row, 0, qt.QModelIndex())
        self.__expandNodesFromPaths(self.__treeview, index, paths)
github silx-kit / silx / silx / gui / hdf5 / Hdf5TreeModel.py View on Github external
def index(self, row, column, parent=qt.QModelIndex()):
        try:
            node = self.nodeFromIndex(parent)
            return self.createIndex(row, column, node.child(row))
        except IndexError:
            return qt.QModelIndex()
github silx-kit / silx / silx / app / view / CustomNxdataWidget.py View on Github external
:rtype: List[Union[numpy.ndarray,h5py.Dataset,silx.io.commonh5.Dataset,None]]
        """
        datasets = []
        for axis in self.__axes:
            datasets.append(axis.getDataset())
        return datasets


class _Model(qt.QStandardItemModel):
    """Model storing a list of custom NXdata items.

    Supports drag and drop of datasets.
    """

    sigNxdataUpdated = qt.Signal(qt.QModelIndex)
    """Emitted when stored NXdata was edited"""

    def __init__(self, parent=None):
        """Constructor"""
        qt.QStandardItemModel.__init__(self, parent)
        root = self.invisibleRootItem()
        root.setDropEnabled(True)
        root.setDragEnabled(False)

    def supportedDropActions(self):
        """Inherited method to redefine supported drop actions."""
        return qt.Qt.CopyAction | qt.Qt.MoveAction

    def mimeTypes(self):
        """Inherited method to redefine draggable mime types."""
        return [Hdf5DatasetMimeData.MIME_TYPE]