Riffle¶
Filesystem browser for PySide.
Installation¶
Installing Riffle is simple with pip:
$ pip install riffle
If the Cheeseshop (a.k.a. PyPI) is down, you can also install Riffle from one of the mirrors:
$ pip install --use-mirrors riffle
Alternatively, you may wish to download manually from Github where Riffle is actively developed.
You can clone the public repository:
$ git clone git://github.com/4degrees/riffle.git
Or download an appropriate tarball or zipball
Once you have a copy of the source, you can install it into your site-packages:
$ python setup.py install
Usage¶
To use the browser, first create an instance of it and configure the size as desired:
import riffle.browser
browser = riffle.browser.FilesystemBrowser()
browser.setMinimumSize(800, 400)
Then open it in blocking mode and retrieve any selected files chosen by the user:
if browser.exec_():
selected = browser.selected()
print('Selected: {0}'.format(selected))

Selected: [u'C:\\Users\\Martin\\data\\scratch\\ftrack_test.mov']
The browser can also identify sequences of files (using Clique). They will be displayed as a special collection item and can be navigated into like a directory to see and select individual files.


Each browser instance can be configured with a root path. The browser will not be able to navigate above this root path:
browser = riffle.browser.FilesystemBrowser('C:\\Users')
browser.show()

In addition to a root, a browser also has a location that can be set to change the currently displayed location:
browser.setLocation('C:\\Users\\Martin')

Note
It is not possible to set a location that is outside the root path tree. An error is raised if attempted.
Icons¶
Icons displayed for entries in the browser are provided by an IconFactory. You can pass in your own icon factory to the browser to customise the icons used:
class AllFilesIconFactory(object):
'''Force all icons to be file icons.'''
def icon(self, specification):
'''Return appropriate icon for *specification*.
*specification* should be either:
* An instance of :py:class:`riffle.model.Item`
* One of the defined icon types (:py:class:`IconType`)
'''
return QtGui.QIcon(':riffle/icon/file')
browser = riffle.browser.FilesystemBrowser(
iconFactory=AllFilesIconFactory()
)

Glossary¶
Indices and tables¶
Copyright & License¶
Copyright (c) 2014 Martin Pengelly-Phillips
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE.txt file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.