Skip to content

Commit

Permalink
📝 added AutoFileUpload
Browse files Browse the repository at this point in the history
  • Loading branch information
jgunstone committed Mar 10, 2023
1 parent fa2b58e commit 45c7cd2
Showing 1 changed file with 41 additions and 7 deletions.
48 changes: 41 additions & 7 deletions docs/autoui.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,38 +79,72 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 23,
"id": "9d70dd9d-cd5b-4b59-a5d3-32a0f184c7bf",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4b70305949f0421da5c95110b0615013",
"model_id": "247cbbe38ce6431eae93dc1b3178d3b9",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"AutoUi(children=(SaveButtonBar(children=(ToggleButton(value=False, button_style='success', disabled=True, icon"
"AutoObject(children=(SaveButtonBar(children=(ToggleButton(value=False, button_style='success', disabled=True, …"
]
},
"execution_count": 4,
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from pydantic import BaseModel, Field\n",
"from ipyautoui.custom.fileupload import AutoUploadPaths\n",
"from ipyautoui.autoipywidget import AutoObject\n",
"\n",
"class Test(BaseModel):\n",
" paths: list[pathlib.Path] = Field(autoui=\"__main__.AutoUploadPaths\")\n",
"\n",
" paths: list[pathlib.Path] = Field(autoui=\"ipyautoui.custom.fileupload.AutoUploadPaths\")\n",
" a: str\n",
"\n",
"aui = AutoUi(Test)\n",
" class Config:\n",
" schema_extra = {\n",
" 'nested_widgets': ['ipyautoui.custom.fileupload.AutoUploadPaths']\n",
" }\n",
"aui = AutoObject(Test) # , nested_widgets=[AutoUploadPaths]\n",
"aui"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "cb49c754-8660-49e4-a65e-218f71fbe920",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'title': 'Test',\n",
" 'type': 'object',\n",
" 'properties': {'paths': {'title': 'Paths',\n",
" 'autoui': 'ipyautoui.custom.fileupload.AutoUploadPaths',\n",
" 'type': 'array',\n",
" 'items': {'type': 'string', 'format': 'path'}},\n",
" 'a': {'title': 'A', 'type': 'string'}},\n",
" 'required': ['paths', 'a'],\n",
" 'nested_widgets': ['ipyautoui.custom.fileupload.AutoUploadPaths']}"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Test.schema()"
]
},
{
"cell_type": "markdown",
"id": "21a44310",
Expand Down

0 comments on commit 45c7cd2

Please sign in to comment.