Created
May 17, 2019 08:44
-
-
Save oeway/f8dddda6532d91902c9fb881a8684d39 to your computer and use it in GitHub Desktop.
This file contains hidden or 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": "CreateFolder", | |
| "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, 'title': 'creating folder'}) | |
| name = await api.prompt(f'What is the folder name you want to create?') | |
| newpath = os.path.join(retObj.path, name) | |
| if not os.path.exists(newpath): | |
| os.makedirs(newpath) | |
| api.alert('folder created!') | |
| else: | |
| api.alert('folder already exists.') | |
| api.export(ImJoyPlugin()) | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment