Created
May 17, 2019 08:45
-
-
Save oeway/538a19795e13ffe7f3ed8b0a35257485 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<docs lang="markdown"> | |
[TODO: write documentation for this plugin.] | |
</docs> | |
<config lang="json"> | |
{ | |
"name": "RemoveFolder", | |
"type": "native-python", | |
"version": "0.1.0", | |
"description": "[TODO: describe this plugin with one sentence.]", | |
"tags": [], | |
"ui": "", | |
"cover": "", | |
"inputs": null, | |
"outputs": null, | |
"flags": [], | |
"icon": "extension", | |
"api_version": "0.1.5", | |
"env": "", | |
"requirements": [], | |
"dependencies": [] | |
} | |
</config> | |
<script lang="python"> | |
from imjoy import api | |
import asyncio | |
import os | |
import shutil | |
class ImJoyPlugin(): | |
def setup(self): | |
api.log('initialized') | |
async def run(self, ctx): | |
retObj = await api.showFileDialog({'engine': api.ENGINE_URL}) | |
confirm = await api.confirm(f'Are you sure you want to remove everything including folders, subfolders and files in {retObj.path} located on plugin engine {api.ENGINE_URL}?') | |
if not confirm: | |
return | |
confirm = await api.confirm(f'Are you really sure you want to remove EVERYTHING inside?') | |
if confirm: | |
shutil.rmtree(retObj.path) | |
api.alert('All Files and folders removed.') | |
api.export(ImJoyPlugin()) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment