Skip to content

Commit

Permalink
Some file cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Dcosthephalump committed Aug 4, 2023
1 parent 7a61940 commit cd96806
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 171 deletions.
Binary file modified glyptodon/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file modified glyptodon/__pycache__/annotation.cpython-311.pyc
Binary file not shown.
Binary file modified glyptodon/__pycache__/classes.cpython-311.pyc
Binary file not shown.
Binary file modified glyptodon/__pycache__/export.cpython-311.pyc
Binary file not shown.
Binary file modified glyptodon/__pycache__/information.cpython-311.pyc
Binary file not shown.
Binary file modified glyptodon/__pycache__/manuscriptFiles.cpython-311.pyc
Binary file not shown.
Binary file modified glyptodon/__pycache__/selection.cpython-311.pyc
Binary file not shown.
1 change: 0 additions & 1 deletion glyptodon/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def saveNContinuteCallback(
saveTranscripts(manContents, manFilenames, selectedManuscript[0])

manuscripts = currentManuscripts()
print(manuscripts)
selectionKey = {}
selectionNames = []
for manuscript in manuscripts:
Expand Down
188 changes: 18 additions & 170 deletions nbs/07_app.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -41,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -130,7 +130,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -155,7 +155,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -346,7 +346,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -415,36 +415,9 @@
"When the ```finalizeSelection``` button is clicked, we need to start creating the figures that will be used in the ```annotation-figure``` object. This is a CPU intensive process (taking roughly 20 seconds to perform on my machine), so it isn't something performed trivially."
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"#| export\n",
"@callback(\n",
" Output(\"page-selector\", \"options\"),\n",
" Output(\"page-selector\", \"value\"),\n",
" Output(\"tabs-object\",\"value\", allow_duplicate=True),\n",
" Input(\"finalize-selection\", \"n_clicks\"),\n",
" prevent_initial_call=True,\n",
")\n",
"def finalizeSelectionCallback(clicks):\n",
" global selectedManuscript\n",
" dropdownOptions = []\n",
" relativePaths = manuscriptImages(selectedManuscript[0])\n",
"\n",
" index = 1\n",
" for path in relativePaths:\n",
" imageName = path.split(\"/\")[-1]\n",
" if imageName[0] != \".\":\n",
" dropdownOptions.append({\"label\": f\"Page {index}\", \"value\": path})\n",
" index = index + 1\n",
"\n",
" return dropdownOptions, dropdownOptions[0][\"value\"], \"information\""
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -469,7 +442,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -583,97 +556,6 @@
" return \"annotation\", manSelectVal, manSelectOpts, dropdownOptions, dropdownOptions[0][\"value\"]"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"#| export\n",
"@callback(\n",
" Output(\"tabs-object\", \"value\", allow_duplicate=True),\n",
" Output(\"manuscript-select\", \"value\"),\n",
" Output(\"manuscript-select\", \"options\"),\n",
" Input(\"save-and-continue\", \"n_clicks\"),\n",
" # Input objects\n",
" State(\"work\", \"value\"),\n",
" State(\"author\", \"value\"),\n",
" State(\"language\", \"value\"),\n",
" State(\"country\", \"value\"),\n",
" State(\"city\", \"value\"),\n",
" State(\"institution\", \"value\"),\n",
" State(\"centuries-slider\", \"value\"),\n",
" # Upload objects\n",
" State(\"upload-images\", \"contents\"),\n",
" State(\"upload-images\", \"filename\"),\n",
" State(\"upload-manuscripts\",\"contents\"),\n",
" State(\"upload-manuscripts\",\"filename\"),\n",
" # Conditional object\n",
" State(\"manuscript-select\", \"value\"),\n",
" State(\"manuscript-select\", \"options\"),\n",
" prevent_initial_call=True,\n",
")\n",
"def saveNContinuteCallback(\n",
" clicks, # Input save-and-continue\n",
" work, # State work\n",
" author, # State author\n",
" language, # State language\n",
" country, # State country\n",
" city, # State city\n",
" institution, # State institution\n",
" centuriesValue, # State centuries-slider\n",
" imContents, # State upload-images\n",
" imFilenames, # State upload-images\n",
" manContents, # State upload-manuscripts\n",
" manFilenames, # State upload-manuscripts\n",
" manSelectVal, # State manuscript-select value\n",
" manSelectOpts, # State manuscript select options\n",
"):\n",
" global selectedManuscript\n",
" global centuries\n",
" global selectionKey\n",
" centuriesData = \"\"\n",
" if centuriesValue[0] == centuriesValue[1]:\n",
" centuriesData = centuries[centuriesValue[0]] + \" Century\"\n",
" else:\n",
" centuriesData = (\n",
" centuries[centuriesValue[0]]\n",
" + \" to \"\n",
" + centuries[centuriesValue[1]]\n",
" + \" Centuries\"\n",
" )\n",
" \n",
" information = {\n",
" \"Work\": work,\n",
" \"Author\": author,\n",
" \"Language\": language,\n",
" \"Country\": country,\n",
" \"City\": city,\n",
" \"Institution\": institution,\n",
" \"Centuries\": centuriesData,\n",
" }\n",
"\n",
" if manSelectVal == \"Create New Manuscript\":\n",
" selectedManuscript = (createManuscriptDirectory(information), information)\n",
" saveImages(imContents, imFilenames, selectedManuscript[0])\n",
" saveTranscripts(manContents, manFilenames, selectedManuscript[0])\n",
" \n",
" manuscripts = currentManuscripts()\n",
" \n",
" selectionKey = {}\n",
" selectionNames = []\n",
" for manuscript in manuscripts:\n",
" selectionNames.append(manuscript[1][\"Work\"])\n",
" selectionKey[selectionNames[-1]] = manuscript\n",
" \n",
" manSelectVal = information[\"Work\"]\n",
" manSelectOpts = selectionNames + [\"Create New Manuscript\"]\n",
" \n",
" return \"annotation\", manSelectVal, manSelectOpts\n",
" else:\n",
" updateMetadata(selectedManuscript[0], information)\n",
" \n",
" return \"annotation\", manSelectVal, manSelectOpts"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand All @@ -687,7 +569,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -864,7 +746,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -948,7 +830,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -1001,7 +883,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -1099,7 +981,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -1124,7 +1006,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -1155,33 +1037,11 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"650\"\n",
" src=\"http://127.0.0.1:8050/\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7fdebb74cb90>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"#| export\n",
"if __name__ == \"__main__\":\n",
Expand All @@ -1190,23 +1050,11 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[('/home/dc/glyptodon/nbs/manuscripts/eparchos', {'Work': 'EPARCHOS', 'Author': 'None', 'Language': 'None', 'Country': 'None', 'City': 'None', 'Institution': 'None', 'Centuries': '1st to 20th Centuries'}), ('/home/dc/glyptodon/nbs/manuscripts/stvrnktmnstrygrkcllctnn.53', {'Work': 'Stavronikita Monastery Greek handwritten document Collection no.53', 'Author': '', 'Language': 'Greek', 'Country': 'Greece', 'City': 'Mount Athos', 'Institution': 'Stavronikita Monastery', 'Centuries': '14th Century'})]\n",
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n",
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)\n",
"\u001b[1;31mKeyError\u001b[0m: 'shapes'\n",
"\n"
]
}
],
"outputs": [],
"source": [
"#| hide\n",
"import nbdev\n",
Expand Down

0 comments on commit cd96806

Please sign in to comment.