diff --git a/jupyter_mentor/student_course_overview.py b/jupyter_mentor/student_course_overview.py index 25b81ff..1489ffa 100644 --- a/jupyter_mentor/student_course_overview.py +++ b/jupyter_mentor/student_course_overview.py @@ -1,31 +1,62 @@ # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/14_student_course_overview.ipynb. # %% auto 0 -__all__ = ['StudentCourseOverview'] +__all__ = ['FileDownloader', 'StudentCourseOverview'] # %% ../nbs/14_student_course_overview.ipynb 1 from .file_viewer import FileViewer import ipywidgets as widgets from ipywidgets import VBox, HBox, HTML, Button, Label, Text, Checkbox, Accordion, FileUpload +from ipyfilechooser import FileChooser from IPython.display import display, clear_output import ipyvuetify as v from traitlets import observe # %% ../nbs/14_student_course_overview.ipynb 2 +class FileDownloader(widgets.VBox): + def __init__(self): + super().__init__() + self.file_chooser = FileChooser() + self.download_button = v.Btn( + class_="ma-2", + outlined=True, + href="./course_files/hussey2015.pdf", + attributes={"download": "hussey2015.pdf"}, + children=["Download All"] + ) + self.children = [self.file_chooser, self.download_button] + +# %% ../nbs/14_student_course_overview.ipynb 3 class StudentCourseOverview(VBox): - def __init__(self, file_viewer): + def __init__(self): super().__init__() # global file viewer (that has model) - self.file_viewer = file_viewer + #self.file_viewer = file_viewer # Course overview text - self.course_overview_label = Label('Course Overview:') + self.course_overview_label = Label('Available Files:') # self.course_overview_text = Text(placeholder=‘Enter course overview’) + + self.file_downloader = FileDownloader() + + # Next button self.next_button = Button(description='Next') + + #Header + self.header = v.Container(children=[ + v.Html( + tag='h1', + attributes={'title': 'a title'}, + children=['Student Course Overview'] + ) + ]) + + # Arrange widgets vertically self.children = [ - HTML('

Course Overview

'), # Heading - self.file_viewer, + self.header, # Heading + #self.file_viewer, self.course_overview_label, # Course overview + self.file_downloader, HBox([self.next_button], layout={'justify_content': 'flex-end'}), ] diff --git a/nbs/00_main.ipynb b/nbs/00_main.ipynb index bf3d490..ff89410 100644 --- a/nbs/00_main.ipynb +++ b/nbs/00_main.ipynb @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "89293f18-ab92-426e-abf4-249f3e17727d", "metadata": {}, "outputs": [], @@ -38,7 +38,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "af80f333-81cd-4f2d-8f92-195b79a8e307", "metadata": {}, "outputs": [], @@ -55,7 +55,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "d25ddd77-b1e3-41e6-9254-686a04ee7633", "metadata": {}, "outputs": [], @@ -83,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "ff4ce152-adef-4c60-828a-8bbf68129209", "metadata": {}, "outputs": [], @@ -133,10 +133,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "9ca28623-ed1f-4f1c-b671-462ee582040f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "45777c8ce5e544ccb75ef60ea2d3f504", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "EducatorMain(children=(Login(children=(Container(children=[Html(attributes={'title': 'a title'}, children=['Lo…" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "educator_main = EducatorMain()\n", "educator_main" @@ -144,7 +160,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "7548d87a-94e3-4cdc-bb20-fe46ec366425", "metadata": {}, "outputs": [], @@ -163,7 +179,8 @@ " self.first = Login()\n", " self.second = StudentProfile()\n", " self.file_viewer = FileViewerView()\n", - " self.third = StudentCourseOverview(self.file_viewer)\n", + " #self.third = StudentCourseOverview(self.file_viewer\n", + " self.third = StudentCourseOverview()\n", " self.fourth = ChatBot(self.student_chatbot_model)\n", "\n", " \n", @@ -173,7 +190,7 @@ " self.set_title(0, 'LogIn')\n", " self.set_title(1, 'User Profile')\n", " self.set_title(2, 'Course Overview')\n", - " self.set_title(3, 'Test/Assn Generator')\n", + " self.set_title(3, 'Student Chatbox')\n", "\n", "\n", " # Add event handlers to \"Next\" buttons in each tab\n", @@ -193,10 +210,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "36cabf8d-427b-4d24-9c5d-8a6f8e4ab6b5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "5ba5c5efdcdb42fa8efc2fcc9c77d2b5", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "StudentMain(children=(Login(children=(Container(children=[Html(attributes={'title': 'a title'}, children=['Log…" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "student_main = StudentMain()\n", "student_main" @@ -224,9 +257,21 @@ ], "metadata": { "kernelspec": { - "display_name": "python3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.19" } }, "nbformat": 4, diff --git a/nbs/14_student_course_overview.ipynb b/nbs/14_student_course_overview.ipynb index 7c8ffdf..0f3a42a 100644 --- a/nbs/14_student_course_overview.ipynb +++ b/nbs/14_student_course_overview.ipynb @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "0320fe7e-0ec7-4dd1-90c2-74a3e25bab86", "metadata": {}, "outputs": [], @@ -21,6 +21,7 @@ "from jupyter_mentor.file_viewer import FileViewer\n", "import ipywidgets as widgets\n", "from ipywidgets import VBox, HBox, HTML, Button, Label, Text, Checkbox, Accordion, FileUpload\n", + "from ipyfilechooser import FileChooser\n", "from IPython.display import display, clear_output\n", "import ipyvuetify as v\n", "from traitlets import observe" @@ -28,62 +29,101 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, + "id": "ab283a97-289b-49ba-94ce-4b7c34353e04", + "metadata": {}, + "outputs": [], + "source": [ + "#| export\n", + "\n", + "class FileDownloader(widgets.VBox):\n", + " def __init__(self):\n", + " super().__init__()\n", + " self.file_chooser = FileChooser()\n", + " self.download_button = v.Btn(\n", + " class_=\"ma-2\",\n", + " outlined=True,\n", + " href=\"./course_files/hussey2015.pdf\",\n", + " attributes={\"download\": \"hussey2015.pdf\"},\n", + " children=[\"Download All\"]\n", + " )\n", + " self.children = [self.file_chooser, self.download_button]" + ] + }, + { + "cell_type": "code", + "execution_count": 15, "id": "f0e47085-1303-4292-b752-0ee05eef872d", "metadata": {}, "outputs": [], "source": [ "#| export\n", "class StudentCourseOverview(VBox):\n", - " def __init__(self, file_viewer):\n", + " def __init__(self):\n", " super().__init__()\n", " # global file viewer (that has model)\n", - " self.file_viewer = file_viewer\n", + " #self.file_viewer = file_viewer\n", " # Course overview text\n", - " self.course_overview_label = Label('Course Overview:')\n", + " self.course_overview_label = Label('Available Files:')\n", " # self.course_overview_text = Text(placeholder=‘Enter course overview’)\n", + "\n", + " self.file_downloader = FileDownloader()\n", + "\n", + " \n", " # Next button\n", " self.next_button = Button(description='Next')\n", + "\n", + " #Header\n", + " self.header = v.Container(children=[\n", + " v.Html(\n", + " tag='h1',\n", + " attributes={'title': 'a title'},\n", + " children=['Student Course Overview']\n", + " )\n", + " ])\n", + "\n", + " \n", " # Arrange widgets vertically\n", " self.children = [\n", - " HTML('

Course Overview

'), # Heading\n", - " self.file_viewer,\n", + " self.header, # Heading\n", + " #self.file_viewer,\n", " self.course_overview_label, # Course overview\n", + " self.file_downloader,\n", " HBox([self.next_button], layout={'justify_content': 'flex-end'}),\n", " ]" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "54fb4f23-dabc-4109-a482-feee5c130f36", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "504e53f418464756a1b33d67d9d4fc64", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "StudentCourseOverview(children=(Container(children=[Html(attributes={'title': 'a title'}, children=['Student C…" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "file_viewer = FileViewer()\n", - "main = StudentCourseOverview(file_viewer)\n", + "#file_viewer = FileViewer()\n", + "main = StudentCourseOverview()\n", "main" ] }, { "cell_type": "code", - "execution_count": null, - "id": "55ed3ffc-d154-4b77-9117-6f580fbeb0fe", - "metadata": {}, - "outputs": [], - "source": [ - "v.Container(children=[\n", - " v.Html(\n", - " tag='h1',\n", - " attributes={'title': 'a title'},\n", - " children=['My heading']\n", - " )\n", - "])" - ] - }, - { - "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "11872b33-a907-4acb-9537-0a2f4237d791", "metadata": {}, "outputs": [], @@ -103,9 +143,21 @@ ], "metadata": { "kernelspec": { - "display_name": "python3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.19" } }, "nbformat": 4,