Skip to content

Commit

Permalink
Edited second and third tab
Browse files Browse the repository at this point in the history
  • Loading branch information
namitasshah committed Mar 31, 2024
1 parent 9361c2d commit 2d487c7
Show file tree
Hide file tree
Showing 7 changed files with 303 additions and 216 deletions.
105 changes: 66 additions & 39 deletions nbs/firstTab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@
"cells": [
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 17,
"id": "f561c615-c749-46ad-be05-1c23b4895b1c",
"metadata": {},
"outputs": [],
"source": [
"## This is the first tab for the log-in screen. "
]
},
{
"cell_type": "code",
"execution_count": 61,
"id": "543f060f-5d9b-4b76-9354-f8483575b468",
"metadata": {},
"outputs": [],
Expand All @@ -12,68 +22,85 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 66,
"id": "112bc93b-c8cb-4576-87e9-045e953979d0",
"metadata": {},
"outputs": [],
"source": [
"#| export\n",
"import ipywidgets as widgets\n",
"from ipywidgets import Tab, Output, Button\n"
"from ipywidgets import VBox, HTML, HBox, Label, Tab, Output, Button, Text\n",
"from IPython.display import display, clear_output\n",
"import ipyvuetify as v\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 70,
"id": "7a9ea954-5bcd-4871-87a6-fe01fc3590f3",
"metadata": {},
"outputs": [],
"source": [
"#| export\n",
"class FirstTab(widgets.VBox):\n",
"class FirstTab(VBox):\n",
" \n",
" def __init__(self):\n",
" # If you forget to call the superconstructor on an extended widget\n",
" # you will get an AttributeError: object has no attribute '_model_id'\n",
" super().__init__()\n",
" \n",
" # Using Accordion\n",
" # Create accordion containing HTML content\n",
" self.using_acc = widgets.Accordion()\n",
" # self.using_acc.set_title(0, 'Using this App')\n",
" USING_TEXT = '''\n",
" In the Data tab above, you can review the dataset.\n",
" In the Selection tab, you can search for and download data of interest.\n",
" Once you've selected data, generate plots in the Visualize tab.\n",
" '''\n",
" self.using_body = widgets.HTML(USING_TEXT)\n",
" self.using_acc.children = (self.using_body, )\n",
" # Username input\n",
" self.username_label = Label('Username:')\n",
" self.username_input = Text(placeholder='Enter username')\n",
" \n",
" # Password input\n",
" self.key_label = Label('API Key:')\n",
" self.key_input = Text(placeholder='Enter API key', password=True)\n",
" \n",
" # Data Souces Accordion\n",
" # Create accordion containing HTML content\n",
" self.sources_acc = widgets.Accordion()\n",
" # self.sources_acc.set_title(0, 'Data Sources')\n",
" SOURCES_TEXT = '''\n",
" Land-Ocean Temperature Index\n",
" Global Temperature (NASA)\n",
" ,\n",
" GISS Surface Temperature Analysis (NASA)\n",
" \n",
" This site is based on data downloaded from the following site on 2020-07-14:\n",
" Global Mean Estimates based on Land_and Ocean Data (NASA)\n",
" '''\n",
" self.sources_body = widgets.HTML(SOURCES_TEXT)\n",
" self.sources_acc.children = (self.sources_body, )\n",
"\n",
" self.next_button = Button(description='Next')\n",
" # Login button\n",
" self.login_button = Button(description='Login')\n",
" \n",
" self.children = (self.using_acc, self.sources_acc, self.next_button)\n",
" "
" # Arrange labels and inputs horizontally\n",
" self.username_box = HBox([self.username_label, self.username_input])\n",
" self.key_box = HBox([self.key_label, self.key_input])\n",
" \n",
" # Arrange widgets vertically\n",
" self.children = [\n",
" HTML('<h2>Login</h2>'), # Heading\n",
" self.username_box, # Username label and input box\n",
" self.key_box, # Password label and input box\n",
" HBox([self.login_button], layout={'justify_content': 'flex-end'}), # Login button aligned to the right\n",
" ]\n"
]
},
{
"cell_type": "code",
"execution_count": 71,
"id": "6e8d6319-0a74-4021-b604-cf66c4656cf9",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "66459e4e0d67411b92e13488c94219d3",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"FirstTab(children=(HTML(value='<h2>Login</h2>'), HBox(children=(Label(value='Username:'), Text(value='', place…"
]
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"main = FirstTab()\n",
"main"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 65,
"id": "8ffe56dd-b8e8-43e2-9adf-c0e2531504c1",
"metadata": {},
"outputs": [],
Expand All @@ -85,7 +112,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2a71b3eb-3d78-473b-8991-e2251a7c09ed",
"id": "94fce144-391e-4917-86ea-d8e8fde8c3ca",
"metadata": {},
"outputs": [],
"source": []
Expand Down
22 changes: 15 additions & 7 deletions nbs/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"id": "bdd83822-655e-4a13-a9e5-557609cd3f0d",
"metadata": {},
"outputs": [],
Expand All @@ -17,7 +17,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "ff4ce152-adef-4c60-828a-8bbf68129209",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -48,7 +48,7 @@
"\n",
"\n",
" # Add event handlers to \"Next\" buttons in each tab\n",
" self.first.next_button.on_click(self.switch_to_second)\n",
" self.first.login_button.on_click(self.switch_to_second)\n",
" self.second.next_button.on_click(self.switch_to_third)\n",
" self.third.next_button.on_click(self.switch_to_fourth)\n",
" \n",
Expand All @@ -65,22 +65,22 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"id": "9ca28623-ed1f-4f1c-b671-462ee582040f",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9b446a86216549e0998d60e86963c8f9",
"model_id": "6ecf9b0a144a44489c662575e6d97739",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Main(children=(FirstTab(children=(Accordion(children=(HTML(value=\"\\n In the Data tab above, you can"
"Main(children=(FirstTab(children=(HTML(value='<h2>Login</h2>'), HBox(children=(Label(value='Username:'), Text("
]
},
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -97,6 +97,14 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "3d5f570c-0b64-4a9e-bec7-d44d04006894",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
62 changes: 26 additions & 36 deletions nbs/nbdevFolder/firstTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,38 @@
# %% auto 0
__all__ = ['FirstTab']

# %% ../firstTab.ipynb 1
# %% ../firstTab.ipynb 2
import ipywidgets as widgets
from ipywidgets import Tab, Output, Button
from ipywidgets import VBox, HTML, HBox, Label, Tab, Output, Button, Text
from IPython.display import display, clear_output


# %% ../firstTab.ipynb 2
class FirstTab(widgets.VBox):
# %% ../firstTab.ipynb 3
class FirstTab(VBox):

def __init__(self):
# If you forget to call the superconstructor on an extended widget
# you will get an AttributeError: object has no attribute '_model_id'
super().__init__()

# Using Accordion
# Create accordion containing HTML content
self.using_acc = widgets.Accordion()
# self.using_acc.set_title(0, 'Using this App')
USING_TEXT = '''
In the Data tab above, you can review the dataset.
In the Selection tab, you can search for and download data of interest.
Once you've selected data, generate plots in the Visualize tab.
'''
self.using_body = widgets.HTML(USING_TEXT)
self.using_acc.children = (self.using_body, )
# Username input
self.username_label = Label('Username:')
self.username_input = Text(placeholder='Enter username')

# Data Souces Accordion
# Create accordion containing HTML content
self.sources_acc = widgets.Accordion()
# self.sources_acc.set_title(0, 'Data Sources')
SOURCES_TEXT = '''
Land-Ocean Temperature Index
Global Temperature (NASA)
,
GISS Surface Temperature Analysis (NASA)
This site is based on data downloaded from the following site on 2020-07-14:
Global Mean Estimates based on Land_and Ocean Data (NASA)
'''
self.sources_body = widgets.HTML(SOURCES_TEXT)
self.sources_acc.children = (self.sources_body, )

self.next_button = Button(description='Next')
# Password input
self.key_label = Label('API Key:')
self.key_input = Text(placeholder='Enter API key', password=True)

self.children = (self.using_acc, self.sources_acc, self.next_button)

# Login button
self.login_button = Button(description='Login')

# Arrange labels and inputs horizontally
self.username_box = HBox([self.username_label, self.username_input])
self.key_box = HBox([self.key_label, self.key_input])

# Arrange widgets vertically
self.children = [
HTML('<h2>Login</h2>'), # Heading
self.username_box, # Username label and input box
self.key_box, # Password label and input box
HBox([self.login_button], layout={'justify_content': 'flex-end'}), # Login button aligned to the right
]

52 changes: 21 additions & 31 deletions nbs/nbdevFolder/secondTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,36 @@

# %% ../secondTab.ipynb 1
import ipywidgets as widgets
from ipywidgets import Tab, Output, Button
from ipywidgets import VBox, HTML, HBox, Label, Tab, Output, Button, Text
from IPython.display import display, clear_output
import ipyvuetify as v


# %% ../secondTab.ipynb 2
class SecondTab(widgets.VBox):

def __init__(self):
# If you forget to call the superconstructor on an extended widget
# you will get an AttributeError: object has no attribute '_model_id'
super().__init__()

# Using Accordion
# Create accordion containing HTML content
self.using_acc = widgets.Accordion()
# self.using_acc.set_title(0, 'Using this App')
USING_TEXT = '''
In the Data tab above, you can review the dataset.
In the Selection tab, you can search for and download data of interest.
Once you've selected data, generate plots in the Visualize tab.
'''
self.using_body = widgets.HTML(USING_TEXT)
self.using_acc.children = (self.using_body, )
# Username input
self.username_label = Label('Name:')
self.username_input = Text(placeholder='Enter your name')

# Data Souces Accordion
# Create accordion containing HTML content
self.sources_acc = widgets.Accordion()
# self.sources_acc.set_title(0, 'Data Sources')
SOURCES_TEXT = '''
Land-Ocean Temperature Index
Global Temperature (NASA)
,
GISS Surface Temperature Analysis (NASA)
This site is based on data downloaded from the following site on 2020-07-14:
Global Mean Estimates based on Land_and Ocean Data (NASA)
'''
self.sources_body = widgets.HTML(SOURCES_TEXT)
self.sources_acc.children = (self.sources_body, )
# Password input
self.key_label = Label('Educator:')
self.key_input = Text(placeholder='Enter Your Level', password=True)

# Next button
self.next_button = Button(description='Next')

self.children = (self.using_acc, self.sources_acc, self.next_button)

# Arrange labels and inputs horizontally
self.username_box = HBox([self.username_label, self.username_input])
self.key_box = HBox([self.key_label, self.key_input])

# Arrange widgets vertically
self.children = [
HTML('<h2>User Profile</h2>'), # Heading
self.username_box, # Username label and input box
self.key_box, # Password label and input box
HBox([self.next_button], layout={'justify_content': 'flex-end'}), # Login button aligned to the right
]
Loading

0 comments on commit 2d487c7

Please sign in to comment.