From ff3186c4b216c46d4ddbf38b840debdec92f3602 Mon Sep 17 00:00:00 2001 From: Wei Ouyang Date: Fri, 25 Sep 2020 00:03:36 +0200 Subject: [PATCH] Add colab example notebook (#111) * add colab example; set default theme * Update example-data/ImJoy_elFinder_Colab.ipynb Co-authored-by: Martin Hjelmare Co-authored-by: Martin Hjelmare --- README.md | 2 +- example-data/ImJoy_elFinder_Colab.ipynb | 93 +++++++++++++++++++++++ imjoy_elfinder/VERSION | 2 +- imjoy_elfinder/templates/elfinder/main.js | 2 +- 4 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 example-data/ImJoy_elFinder_Colab.ipynb diff --git a/README.md b/README.md index 01f3dc66..29481e95 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ImJoy elFinder [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/imjoy-team/imjoy-elfinder/master?urlpath=elfinder) [![PyPI](https://img.shields.io/pypi/v/imjoy-elfinder.svg?style=popout)](https://pypi.org/project/imjoy-elfinder/) ![Version](https://img.shields.io/badge/dynamic/json.svg?color=success&label=latest&prefix=v&query=version&url=https://raw.githubusercontent.com/imjoy-team/imjoy-elfinder/master/imjoy_elfinder/VERSION) [![Test](https://github.com/imjoy-team/imjoy-elfinder/workflows/Test/badge.svg)](https://github.com/imjoy-team/imjoy-elfinder/actions) +# ImJoy elFinder [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/imjoy-team/imjoy-elfinder/master?urlpath=elfinder) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/imjoy-team/imjoy-elfinder/blob/master/example-data/ImJoy_elFinder_Colab.ipynb) [![PyPI](https://img.shields.io/pypi/v/imjoy-elfinder.svg?style=popout)](https://pypi.org/project/imjoy-elfinder/) ![Version](https://img.shields.io/badge/dynamic/json.svg?color=success&label=latest&prefix=v&query=version&url=https://raw.githubusercontent.com/imjoy-team/imjoy-elfinder/master/imjoy_elfinder/VERSION) [![Test](https://github.com/imjoy-team/imjoy-elfinder/workflows/Test/badge.svg)](https://github.com/imjoy-team/imjoy-elfinder/actions) A web file browser for managing data on remote jupyter servers, specifically built for the [ImJoy](https://imjoy.io) project, an open source platform for deploying computational tools to the end user. diff --git a/example-data/ImJoy_elFinder_Colab.ipynb b/example-data/ImJoy_elFinder_Colab.ipynb new file mode 100644 index 00000000..1574c385 --- /dev/null +++ b/example-data/ImJoy_elFinder_Colab.ipynb @@ -0,0 +1,93 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "ImJoy-elFinder-Colab.ipynb", + "provenance": [], + "collapsed_sections": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "MgoYmq0DjwpX", + "colab_type": "text" + }, + "source": [ + "## ImJoy-elFinder in Google Colab\n", + "\n", + "ImJoy-elFinder is a file browser designed for the web.\n", + "\n", + "In this notebook, we demonstrate how you can run ImJoy-elFinder in Google Colab to support previewing, downloading and uploading files.\n" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "sS2qnw42jqh8", + "colab_type": "code", + "colab": {} + }, + "source": [ + "!pip install imjoy-elfinder" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "pzGAXh2RkLej", + "colab_type": "code", + "colab": {} + }, + "source": [ + "import threading\n", + "from google.colab import output\n", + "from imjoy_elfinder.app import main\n", + "\n", + "# start imjoy-elfinder server\n", + "thread = threading.Thread(target=main, args=[[\"--root-dir=/content\", \"--port=8765\"]])\n", + "thread.start()\n", + "\n", + "# view the \n", + "output.serve_kernel_port_as_iframe(8765, height='800')" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "v4aBe_K_lgF0", + "colab_type": "code", + "colab": {} + }, + "source": [ + "# open imjoy-elfinder in a new tab\n", + "output.serve_kernel_port_as_window(8765)" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "_ufulSAnm286", + "colab_type": "code", + "colab": {} + }, + "source": [ + "" + ], + "execution_count": null, + "outputs": [] + } + ] +} diff --git a/imjoy_elfinder/VERSION b/imjoy_elfinder/VERSION index 44899442..462a0697 100644 --- a/imjoy_elfinder/VERSION +++ b/imjoy_elfinder/VERSION @@ -1,3 +1,3 @@ { - "version": "0.1.58" + "version": "0.1.59" } \ No newline at end of file diff --git a/imjoy_elfinder/templates/elfinder/main.js b/imjoy_elfinder/templates/elfinder/main.js index c9db287f..af331b17 100644 --- a/imjoy_elfinder/templates/elfinder/main.js +++ b/imjoy_elfinder/templates/elfinder/main.js @@ -155,7 +155,7 @@ height: '100%', rememberLastDir: false, cssAutoLoad: true, - theme: 'material-light', + theme: 'default', themes: { 'dark-slim': 'https://johnfort.github.io/elFinder.themes/dark-slim/manifest.json', 'material': 'https://nao-pon.github.io/elfinder-theme-manifests/material-default.json',