How to use the riffle.icon_factory function in Riffle

To help you get started, we’ve selected a few Riffle 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 4degrees / riffle / source / riffle / model.py View on Github external
def __init__(self, path='', parent=None, iconFactory=None):
        '''Initialise with root *path*.'''
        super(Filesystem, self).__init__(parent=parent)
        self.root = ItemFactory(path)
        self.columns = ['Name', 'Size', 'Type', 'Date Modified']

        if iconFactory is None:
            # Local import to circumvent circular dependency.
            import riffle.icon_factory
            iconFactory = riffle.icon_factory.IconFactory()

        self.iconFactory = iconFactory
github 4degrees / riffle / source / riffle / browser.py View on Github external
# Ensure children for each segment in path are loaded.
        segments = self._segmentPath(path)
        for segment in reversed(segments):
            pathIndex = model.pathIndex(segment)
            model.fetchMore(pathIndex)

        self._filesystemWidget.setRootIndex(model.pathIndex(path))
        self._locationWidget.clear()

        # Add history entry for each segment.
        for segment in segments:
            index = model.pathIndex(segment)
            if not index.isValid():
                # Root item.
                icon = model.iconFactory.icon(
                    riffle.icon_factory.IconType.Computer
                )
                self._locationWidget.addItem(
                    icon, model.root.path or model.root.name, model.root.path
                )
            else:
                icon = model.icon(index)
                self._locationWidget.addItem(icon, segment, segment)

        if self._locationWidget.count() > 1:
            self._upButton.setEnabled(True)
            self._upShortcut.setEnabled(True)
        else:
            self._upButton.setEnabled(False)
            self._upShortcut.setEnabled(False)