Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Removed tab from layout
Browse files Browse the repository at this point in the history
Fixes #23.
  • Loading branch information
tylere committed Nov 28, 2022
1 parent f9a5ab2 commit 5e8b540
Show file tree
Hide file tree
Showing 4 changed files with 555 additions and 677 deletions.
4 changes: 1 addition & 3 deletions ee_jupyter/_modidx.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
'ee_jupyter/ipyleaflet.py')},
'ee_jupyter.layout': { 'ee_jupyter.layout.MapWithInspector': ('layout.html#mapwithinspector', 'ee_jupyter/layout.py'),
'ee_jupyter.layout.MapWithInspector.__init__': ( 'layout.html#mapwithinspector.__init__',
'ee_jupyter/layout.py'),
'ee_jupyter.layout.MapWithInspector.print': ( 'layout.html#mapwithinspector.print',
'ee_jupyter/layout.py')},
'ee_jupyter/layout.py')},
'ee_jupyter.rich_display': { 'ee_jupyter.rich_display.ee.Element.__repr__': ( 'rich_display.html#ee.element.__repr__',
'ee_jupyter/rich_display.py'),
'ee_jupyter.rich_display.ee.Element.__str__': ( 'rich_display.html#ee.element.__str__',
Expand Down
24 changes: 3 additions & 21 deletions ee_jupyter/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,18 @@ def __init__(self,

inspector_obj = Inspector(map_obj)
self.inspector = inspector_obj

output_obj = ipywidgets.Output()
self.output = output_obj

tab = ipywidgets.Tab(
children = [self.inspector, self.output],
titles = ['Inspector', 'Console'],
selected_index = 1,
#layout = {'width': '50%'}
)
self.tab = tab

box = ipywidgets.HBox([
self.map,
self.tab,
self.inspector,
])

slider = ipywidgets.FloatSlider(min=0, max=100, readout=False, layout={'width':'100%'})

def handle_slider_change(change):
self.map.layout.width = f'{change.new}%'
self.tab.layout.width = f'{100 - change.new}%'
slider.observe(handle_slider_change, names='value')
self.inspector.layout.width = f'{100 - change.new}%'
slider.observe(handle_slider_change, names='value')

if 'children' not in kwargs:
kwargs['children'] = []
Expand All @@ -56,10 +45,3 @@ def handle_slider_change(change):
slider.value = '50'

super().__init__(**kwargs)

def print(self, obj):
with self.output:
if isinstance(obj, str):
print(obj)
else:
display(obj)
Loading

0 comments on commit 5e8b540

Please sign in to comment.