API reference

riffle.browser

class riffle.browser.FilesystemBrowser(root='', parent=None, iconFactory=None)

Bases: PySide.QtGui.QDialog

FilesystemBrowser dialog.

__init__(root='', parent=None, iconFactory=None)

Initialise browser with root path.

Use an empty root path to specify the computer.

parent is the optional owner of this UI element.

iconFactory specifies the optional factory to pass to the model for customising icons.

selected()

Return selected paths.

setLocation(path, interactive=False)

Set current location to path.

path must be the same as root or under the root.

Note

Comparisons are case-sensitive. If you set the root as ‘D:/’ then location can be set as ‘D:/folder’ not ‘d:/folder’.

If interactive is True, catch any exception occurring and display an appropriate warning dialog to the user. Otherwise allow exceptions to bubble up as normal.

riffle.icon_factory

class riffle.icon_factory.IconFactory

Bases: object

Icon provider.

icon(specification)

Return appropriate icon for specification.

specification should be either:

type(item)

Return appropriate icon type for item.

class riffle.icon_factory.IconType

Bases: object

Icon types.

Collection = 'Collection'
Computer = ('Computer',)
Directory = ('Directory',)
File = ('File',)
Mount = ('Mount',)
Unknown = 'Unknown'

riffle.model

class riffle.model.Collection(collection)

Bases: riffle.model.Item

Represent collection.

__init__(collection)

Initialise item with collection.

collection should be an instance of clique.Collection.

modified

Return last modified date of item.

size

Return size of item.

type

Return type of item as string.

class riffle.model.Computer

Bases: riffle.model.Item

Represent root.

__init__()

Initialise item.

name

Return name of item.

type

Return type of item as string.

class riffle.model.Directory(path)

Bases: riffle.model.Item

Represent directory.

type

Return type of item as string.

class riffle.model.File(path)

Bases: riffle.model.Item

Represent file.

mayHaveChildren()

Return whether item may have children.

type

Return type of item as string.

class riffle.model.Filesystem(path='', parent=None, iconFactory=None)

Bases: PySide.QtCore.QAbstractItemModel

Model representing filesystem.

ITEM_ROLE = <MagicMock name='mock.QtCore.Qt.UserRole.__add__()' id='140062382452048'>
__init__(path='', parent=None, iconFactory=None)

Initialise with root path.

canFetchMore(index)

Return if more data available for index.

columnCount(parent)

Return amount of data parent index has.

data(index, role)

Return data for index according to role.

fetchMore(index)

Fetch additional data under index.

flags(index)

Return flags for index.

hasChildren(index)

Return if index has children.

Optimised to avoid loading children at this stage.

headerData(section, orientation, role)

Return label for section according to orientation and role.

icon(index)

Return icon for index.

index(row, column, parent)

Return index for row and column under parent.

item(index)

Return item at index.

parent(index)

Return parent of index.

pathIndex(path)

Return index of item with path.

reset()

Reset model

rowCount(parent)

Return number of children parent index has.

class riffle.model.FilesystemSortProxy

Bases: PySide.QtGui.QSortFilterProxyModel

Sort directories before files.

canFetchMore(index)

Return if more data available for index.

fetchMore(index)

Fetch additional data under index.

hasChildren(index)

Return if index has children.

icon(index)

Return icon for index.

iconFactory

Return iconFactory of model.

item(index)

Return item at index.

lessThan(left, right)

Return ordering of left vs right.

pathIndex(path)

Return index of item with path.

root

Return root of model.

class riffle.model.Item(path)

Bases: object

Represent filesystem item.

__init__(path)

Initialise item with path.

addChild(item)

Add item as child of this item.

canFetchMore()

Return whether more items can be fetched under this one.

fetchChildren()

Fetch and return new children.

Will only fetch children whilst canFetchMore is True.

Note

It is the caller’s responsibility to add each fetched child to this parent if desired using Item.addChild().

mayHaveChildren()

Return whether item may have children.

modified

Return last modified date of item.

name

Return name of item.

refetch()

Reload children.

removeChild(item)

Remove item from children.

row

Return index of this item in its parent or 0 if no parent.

size

Return size of item.

type

Return type of item as string.

riffle.model.ItemFactory(path)

Return appropriate Item instance for path.

If path is null then return Computer root.

class riffle.model.Mount(path)

Bases: riffle.model.Directory

Represent mount point.

modified

Return last modified date of item.

size

Return size of item.

type

Return type of item as string.