Commit b4af3217 authored by Fabian Wachsmann's avatar Fabian Wachsmann
Browse files

dry

parent adbbfa39
......@@ -610,6 +610,21 @@
" validate_container_output, background='#B7E9F7')"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"def toggle_button(button):\n",
" if button.disabled:\n",
" button.disabled = False\n",
" button.loading = False\n",
" else :\n",
" button.disabled = True\n",
" button.loading = True"
]
},
{
"cell_type": "code",
"execution_count": 4,
......@@ -617,8 +632,7 @@
"outputs": [],
"source": [
"def try_swift_container_input(b):\n",
" validate_container.disabled=True\n",
" validate_container.loading=True\n",
" toggle_button(validate_container)\n",
" [validate_container_output.pop(0) for i in range(len(validate_container_output))]\n",
" input_missing=False\n",
" for inputobject in os_config:\n",
......@@ -630,8 +644,7 @@
" validate_container_output.append(\"Please specify {0}!\".format(inputobject.name))\n",
" input_missing=True\n",
" if input_missing :\n",
" validate_container.disabled=False\n",
" validate_container.loading=False\n",
" toggle_button(validate_container)\n",
" return False\n",
" \n",
" try:\n",
......@@ -641,13 +654,11 @@
" verbose=verbose.value\n",
" )\n",
" container.open_store(zarr_dataset_name.value)\n",
" validate_container.disabled=False\n",
" validate_container.loading=False\n",
" toggle_button(validate_container)\n",
" validate_container_output.append(\"Verified Swift Container Input!\")\n",
" return container\n",
" except Exception as e:\n",
" validate_container.disabled=False\n",
" validate_container.loading=False\n",
" toggle_button(validate_container)\n",
" validate_container_output.append(e)\n",
" return False\n",
" \n",
......@@ -881,8 +892,7 @@
"outputs": [],
"source": [
"def try_dataset_input(c):\n",
" validate_dataset.disabled=True\n",
" validate_dataset.loading=True\n",
" toggle_button(validate_dataset)\n",
" [validate_dataset_output.pop(0) for i in range(len(validate_dataset_output))]\n",
" \n",
" container = try_swift_container_input(\"dummy\")\n",
......@@ -905,8 +915,7 @@
" validate_dataset_output.append(\"Your input dataset as specified cannot be used.\")\n",
" else:\n",
" validate_dataset_output.append(\"You have to specify a valid configuration for the output swift container first!\")\n",
" validate_dataset.disabled=False\n",
" validate_dataset.loading=False\n",
" toggle_button(validate_dataset)\n",
" return container\n",
"\n",
"validate_dataset.on_click(try_dataset_input)"
......@@ -1044,10 +1053,8 @@
"# validate_writing.clicks = 0\n",
"# validate=True\n",
"\n",
" start_writing.disabled=True\n",
" start_writing.loading=True\n",
" validate_writing.disabled=True\n",
" validate_writing.loading=True\n",
" toggle_button(start_writing)\n",
" toggle_button(validate_writing)\n",
"\n",
" container = try_dataset_input(\"dummy\")\n",
" if not container : \n",
......@@ -1068,10 +1075,8 @@
" except Exception as e:\n",
" start_writing_output.append(e)\n",
" \n",
" start_writing.disabled=False\n",
" start_writing.loading=False\n",
" validate_writing.disabled=False\n",
" validate_writing.loading=False\n",
" toggle_button(start_writing)\n",
" toggle_button(validate_writing)\n",
"\n",
"start_writing.on_click(start_write_process)\n",
"validate_writing.on_click(start_validate_process)"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment