{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import sys, os\n", "sys.path.insert(0, os.path.abspath('..'))\n", "import ipywe.fileselector" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Single file selector" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fsel= ipywe.fileselector.FileSelectorPanel(instruction='select file', start_dir='.')\n", "fsel.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print fsel.selected" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Single directory selector" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fsel= ipywe.fileselector.FileSelectorPanel(instruction='select file', start_dir='.', type='directory')\n", "fsel.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print fsel.selected" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Multiple files selector" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fsel= ipywe.fileselector.FileSelectorPanel(instruction='select file', start_dir='.', multiple=True)\n", "fsel.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print fsel.selected" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Multiple directories selector" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fsel= ipywe.fileselector.FileSelectorPanel(instruction='select file', start_dir='.', type='directory', multiple=True)\n", "fsel.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "print fsel.selected" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# Single file selector with callback" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def callback(selected):\n", " print selected\n", "fsel= ipywe.fileselector.FileSelectorPanel(instruction='select file', start_dir='.', next=callback)\n", "fsel.show()" ] } ], "metadata": { "kernelspec": { "display_name": "dev-imars3d", "language": "python", "name": "dev-imars3d" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.12" } }, "nbformat": 4, "nbformat_minor": 1 }