This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add colab and layout helper functions
Fixes #18
- Loading branch information
Showing
15 changed files
with
164,255 additions
and
1,354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.0.3" | ||
__version__ = "0.0.4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_colab.ipynb. | ||
|
||
# %% auto 0 | ||
__all__ = ['set_colab_output_cell_height'] | ||
|
||
# %% ../nbs/00_colab.ipynb 3 | ||
def set_colab_output_cell_height(max_height): | ||
"""Sets the maximum height for the current notebook cell's output.""" | ||
import google | ||
|
||
from IPython.display import Javascript | ||
from string import Template | ||
s = Template('google.colab.output.setIframeHeight(0, true, {maxHeight: $height})') | ||
display(Javascript(s.substitute(height=max_height))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/02_panel.ipynb. | ||
|
||
# %% auto 0 | ||
__all__ = ['MapInspectorHBox'] | ||
|
||
# %% ../nbs/02_panel.ipynb 4 | ||
from .ipyleaflet import Map | ||
from .ipyleaflet import Inspector | ||
import ipywidgets | ||
from traitlets import Unicode | ||
|
||
# %% ../nbs/02_panel.ipynb 6 | ||
class MapInspectorHBox(ipywidgets.HBox): | ||
"""A panel that includes a map and Inspector widget.""" | ||
|
||
def __init__(self, | ||
map_obj=None, | ||
**kwargs): | ||
if map_obj is None: | ||
kwargs['height'] = '300px' | ||
map_obj = Map(**kwargs) | ||
inspector_obj = Inspector(map_obj) | ||
self.map = map_obj | ||
self.inspector = inspector_obj | ||
|
||
if 'children' not in kwargs: | ||
kwargs['children'] = [] | ||
kwargs['children'].insert(0, self.map) | ||
kwargs['children'].insert(1, self.inspector) | ||
super().__init__(**kwargs) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "05d86507-c00c-4f70-96a5-e47b56eb54e7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#|hide\n", | ||
"# Copyright 2022 Google LLC\n", | ||
"#\n", | ||
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n", | ||
"# you may not use this file except in compliance with the License.\n", | ||
"# You may obtain a copy of the License at\n", | ||
"# \n", | ||
"# https://www.apache.org/licenses/LICENSE-2.0\n", | ||
"# \n", | ||
"# Unless required by applicable law or agreed to in writing, software\n", | ||
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n", | ||
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", | ||
"# See the License for the specific language governing permissions and\n", | ||
"# limitations under the License." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5427930d-da44-425f-adac-6a9a2ca769e5", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#| default_exp colab" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "85662442-f26a-400f-9656-005d342855de", | ||
"metadata": {}, | ||
"source": [ | ||
"# Colab module\n", | ||
"\n", | ||
"> Tools specific to working within a Colab environment." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e682b176-cf69-4cf2-9d4c-d2acc18f93b3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#|export\n", | ||
"def set_colab_output_cell_height(max_height):\n", | ||
" \"\"\"Sets the maximum height for the current notebook cell's output.\"\"\"\n", | ||
" import google\n", | ||
" \n", | ||
" from IPython.display import Javascript\n", | ||
" from string import Template\n", | ||
" s = Template('google.colab.output.setIframeHeight(0, true, {maxHeight: $height})')\n", | ||
" display(Javascript(s.substitute(height=max_height)))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e6cb06b8-a5ee-4f12-bab6-a292581be7de", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#|eval: false\n", | ||
"set_output_cell_height(max_height=200)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"widgets": { | ||
"application/vnd.jupyter.widget-state+json": { | ||
"state": {}, | ||
"version_major": 2, | ||
"version_minor": 0 | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.