Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Bokeh Layout #4343

Merged
merged 280 commits into from
May 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
280 commits
Select commit Hold shift + click to select a range
f6fc7e1
Have Box and Widget recompute height on render if mode is responsive
birdsarah May 13, 2016
7e33759
Add example with lots of widgets laid out.
birdsarah May 13, 2016
818d609
Fix layout tests
birdsarah May 13, 2016
504d6dd
Get layout working on page load
birdsarah May 13, 2016
83b628a
Add a space to top for aesthetics.
birdsarah May 13, 2016
b594f5f
Remove coloring from slider, and tweak slider template.
birdsarah May 13, 2016
81f98b2
Start tweaking css for widgets
birdsarah May 13, 2016
f2e0022
Start tweaking styling of widgets to give better consistency
birdsarah May 13, 2016
06c608f
Small tweak back for layout box
birdsarah May 13, 2016
6f5a12d
Tweak constraints on LayoutDOM & Widget
birdsarah May 13, 2016
2589fa4
Fix up tests after changing layout constraints.
birdsarah May 13, 2016
c540ebd
Tweak button display
birdsarah May 13, 2016
1393463
Set the text_input height
birdsarah May 13, 2016
526980e
Continue small styling tweaks
birdsarah May 14, 2016
8b7ee69
Add grow concept
birdsarah May 14, 2016
04c8726
Merge branch 'master' into birdsarah/4164_add_initial_box_layouts_2
birdsarah May 15, 2016
c96738f
Merge branch 'birdsarah/4164_split_plot_to_plotcanvas' into birdsarah…
birdsarah May 15, 2016
204d4d9
Add ToolBar widget to python side
birdsarah May 15, 2016
245c115
Add ToolBar object to Plot
birdsarah May 15, 2016
fc3537f
Merge branch 'master' into birdsarah/4164_add_initial_box_layouts_2
birdsarah May 15, 2016
4b4586d
Merge branch 'birdsarah/4164_add_initial_box_layouts_2' into birdsara…
birdsarah May 15, 2016
5220a34
tools is also deprecated on Plot.
birdsarah May 15, 2016
342c8cc
Move ToolManager to Toolbar model
birdsarah May 15, 2016
ea85c1e
Be resilient to setting logo via Plot declaration
birdsarah May 15, 2016
1e22f0c
Toolbar becomes a Widget
birdsarah May 16, 2016
ed99ae7
Add a simple example for laying out plots with rows & columns
birdsarah May 16, 2016
752775b
Massive simplification of responsive width_height example
birdsarah May 16, 2016
651ffe6
Update responsive tests
birdsarah May 16, 2016
8b17ae6
Fix-up bokehjs tests and remove resize tests
birdsarah May 16, 2016
d4b6625
Move location of toolbar definition
birdsarah May 16, 2016
d5d1d0a
Remove old resize code
birdsarah May 16, 2016
e20fba0
Also add protection onto plot.tools
birdsarah May 16, 2016
cc9c285
Remove plot_template (keep it for grid_plot)
birdsarah May 16, 2016
2fcfdbd
Trigger a resize event from document not a layout_update event
birdsarah May 16, 2016
2246d12
Remove the update_dimensions method
birdsarah May 16, 2016
d9675eb
Remove the plot template
birdsarah May 16, 2016
f36ca86
Don't repeate create Variables
birdsarah May 16, 2016
871d621
Update responsive box test
birdsarah May 16, 2016
055995a
Remove min_size constraint from plot_canvas, and use parent constraints
birdsarah May 16, 2016
4d3d7c2
Remove all title related code
birdsarah May 16, 2016
af270db
Move grow onto LayoutDOM
birdsarah May 16, 2016
18c7b78
Make adding toolbar less flaky
birdsarah May 16, 2016
b77569c
Make all variables identifiable & improve kiwi error
birdsarah May 16, 2016
ef783b8
Increase information in logger statement
birdsarah May 16, 2016
f168e77
Comment out WEAK_EQ whitespace constraint.
birdsarah May 16, 2016
577a767
Improve error reporting in kiwi further
birdsarah May 16, 2016
1a6b1f1
Update document resize values
birdsarah May 16, 2016
df611b7
Slightly improve resize triggering
birdsarah May 16, 2016
7d520a5
Factor out edit_variable in responsive mode onto LayoutDOM
birdsarah May 16, 2016
98d8570
Remove whitespace constraints on LayoutDOM
birdsarah May 16, 2016
b722dbf
Give the layout engine a bit of a workout
birdsarah May 16, 2016
24ea02e
Factor out a render_dom method
birdsarah May 16, 2016
90f9c30
Move render_dom into LayoutDOM for use by plot
birdsarah May 16, 2016
63b595f
Correct layout_canvas test
birdsarah May 16, 2016
720575a
Lots of logging when defaults don't match
birdsarah May 16, 2016
150a6e2
Toolbar should be in define, not in internal
birdsarah May 16, 2016
013992d
Add resize to plot_canvas
birdsarah May 16, 2016
6317e80
Need to add back in that extra resize :s
birdsarah May 16, 2016
33ae245
Trigger on resize if plot is root
birdsarah May 16, 2016
0ce63ee
Toolbar can render itself!
birdsarah May 17, 2016
a33b346
Update document
birdsarah May 17, 2016
d6e517c
Add some protection into canvas so it doesn't try and set to zero (wh…
birdsarah May 17, 2016
7c3b08e
Update Box render to handle width and fixed mode
birdsarah May 17, 2016
393a5b3
Update layout_dom to handle fixed mode properly
birdsarah May 17, 2016
9514303
Update box to work with fixed layout
birdsarah May 17, 2016
128e729
Update widgets to handle fixed view
birdsarah May 17, 2016
3970399
Get Toolbar playing nicely with layout engine
birdsarah May 17, 2016
783d650
Make default responsive mode on PlotCanvas box
birdsarah May 17, 2016
22fa65b
PlotCanvas handles fixed responsive mode now.
birdsarah May 17, 2016
c05db1d
Tweak toolbar tooltips
birdsarah May 17, 2016
a9abab5
Add custom dom layout for toolbar
birdsarah May 17, 2016
ddf66af
Plot is a subclass of Box and creates a PlotCanvas
birdsarah May 17, 2016
fb98a10
Make Plot into a Box layout that holds Toolbar and PlotCanvas
birdsarah May 17, 2016
5acd86b
Get GMapPlot working again
birdsarah May 17, 2016
a286404
Clean-up duplicated or no-longer needed css
birdsarah May 17, 2016
9a5c629
Remove no-longer needed property from document
birdsarah May 17, 2016
7475d21
Improve defaults mismatch reporting
birdsarah May 17, 2016
4e0b5aa
Tweak properties to get defaults test passing
birdsarah May 17, 2016
12cebf7
Add new base screenshots
birdsarah May 17, 2016
44abdd5
Add other failing screenshot test and small tweaks
birdsarah May 17, 2016
922a72c
Deprecate old layouts from models interface.
birdsarah May 15, 2016
0144048
Fix-up erroring layout tests
birdsarah May 17, 2016
14a9f7e
Merge branch 'birdsarah/4164_turn_plot_into_box_2' into birdsarah/416…
birdsarah May 17, 2016
56fc649
Remove throttled resize for now
birdsarah May 17, 2016
7461177
Try slightly more aggressive handling of minimum sizes on canvas
birdsarah May 17, 2016
499421a
Do not render margins on plots
birdsarah May 17, 2016
eace593
We can't mess with dom_left.
birdsarah May 17, 2016
e542929
Merge branch 'birdsarah/4164_turn_plot_into_box_2' into birdsarah/416…
birdsarah May 18, 2016
60ac11b
Small tweak to set a default location.
birdsarah May 18, 2016
2603ec7
Merge branch 'birdsarah/4164_turn_plot_into_box_2' into birdsarah/416…
birdsarah May 18, 2016
a2d6174
Correct model deprecation
birdsarah May 18, 2016
f4692ae
Tweak some defaults for a more unified theme.
birdsarah May 18, 2016
8684e2b
Merge branch 'birdsarah/4164_turn_plot_into_box_2' into birdsarah/416…
birdsarah May 18, 2016
024c939
Continue deprecating old style layouts
birdsarah May 18, 2016
bd63336
Undo changes that added item to curdoc.
birdsarah May 18, 2016
0ab8cc5
Revert "Undo changes that added item to curdoc."
birdsarah May 18, 2016
d3eaf01
Make Row & Column available via bokeh.plotting
birdsarah May 18, 2016
a954066
show methods handle adding object to document if necessary
birdsarah May 18, 2016
56b9560
Fix up examples that were still not rendering.
birdsarah May 18, 2016
3799785
Add an explanatory note to side panel
birdsarah May 18, 2016
6cd4b8d
Remove responsive and grow, and give bk-root height
birdsarah May 19, 2016
1ba80bd
Reset all new layouts
birdsarah May 19, 2016
9ff1068
Take logic out of LayoutDOM, Setup Plot as a container
birdsarah May 19, 2016
40e45dd
Remove responsive stuff from document
birdsarah May 19, 2016
c9a4af3
Have plot pull up constraints
birdsarah May 19, 2016
c50c925
Have plot initialize its children's views
birdsarah May 19, 2016
9ddd80f
Have toolbar render itself
birdsarah May 19, 2016
9a340ad
Get PlotCanvas and Toolbar stuck together
birdsarah May 19, 2016
5588332
Get toolbar laid out above plot.
birdsarah May 19, 2016
543dee4
Make naming on canvas/canvas.coffee clearer
birdsarah May 19, 2016
859d1f5
Add dom_left dom_top variables
birdsarah May 19, 2016
02a6e74
Delayed trigger
birdsarah May 19, 2016
3913c22
Plot correctly renders with no toolbar.
birdsarah May 19, 2016
9d12355
Add the orientation variables
birdsarah May 19, 2016
cd8fa23
Children's order doesn't matter for the way we're constructing constr…
birdsarah May 19, 2016
456d723
Get toolbar rendering correctly above and below
birdsarah May 19, 2016
523e837
Correct weak constrainer export
birdsarah May 19, 2016
6633342
Get toolbar displaying on all four sides in a responsive box
birdsarah May 19, 2016
af23664
Have resize work against bk-root, not window.
birdsarah May 19, 2016
5efda9f
Remove unused responsive mode
birdsarah May 19, 2016
c1a6dee
Add a note about how to do multiple roots.
birdsarah May 19, 2016
9b96c6c
INDIVIDUAL PLOTS WITH TOOLBARS ARE RESPONSIVE AT THIS POINT!
birdsarah May 19, 2016
cc8a4c3
Add whitespace constrained variables and make dom_left and dom_top ed…
birdsarah May 19, 2016
9dccd4b
Boxes inherit from LayoutDOM
birdsarah May 19, 2016
27b9de2
We're going to use two new variables
birdsarah May 19, 2016
6b067ad
Add hook so boxes can be found in dom
birdsarah May 19, 2016
cb7efb2
Add some more variables needed for layout
birdsarah May 19, 2016
d9edb3a
A single column or row will work-ish
birdsarah May 19, 2016
b59df75
Will layout a grid if every plot is wrapped in a box.
birdsarah May 19, 2016
a5e7221
Merge branch 'master' into birdsarah/4164_rework_layout
birdsarah May 19, 2016
72c8a3b
Tweak box algorithm for readability & testability
birdsarah May 20, 2016
3ab9361
Update LayoutDOM and Plot after box tweaking
birdsarah May 20, 2016
bf33a41
Small layout clean-up
birdsarah May 20, 2016
0545429
Small clean-up - still need Box wrapper for plots to line up correctly
birdsarah May 20, 2016
73f16db
Plots no longer need to be wrapped
birdsarah May 20, 2016
264ce36
Update the test layouts
birdsarah May 20, 2016
d6eca60
More clean-up
birdsarah May 20, 2016
c05c52b
Document doesn't have an ide so tweak variable name
birdsarah May 20, 2016
1f28680
Get deeply nested layouts working again.
birdsarah May 20, 2016
069221c
Get plots axes aligning (works with no toolbars)
birdsarah May 20, 2016
91f2a35
Small tweak to variable name for consistency and easy of editing
birdsarah May 20, 2016
037c466
Start playing with alignment vars (toolbars have gone missing)
birdsarah May 20, 2016
f6a4972
Get plots w/ toolbars nested and aligning
birdsarah May 20, 2016
313635a
Get toolbars lining up awesomely.
birdsarah May 20, 2016
150372d
Add a widget box.
birdsarah May 20, 2016
8dbd92d
Add a note to charts, get vplot/hplot/vform working again
birdsarah May 20, 2016
de983e8
Add a demo layout "mega plot"
birdsarah May 20, 2016
f12d68d
Add back responsive property, clean-up adding layouts to document
birdsarah May 21, 2016
bb46dc4
Sort out tests after the epic overhaul
birdsarah May 21, 2016
b34b87e
XFail VBoxForm & Plot test
birdsarah May 21, 2016
b9097b7
fix-up xfail test
birdsarah May 21, 2016
fa86086
color_sliders needs to be executable
birdsarah May 21, 2016
d9e7dc9
Use Column for VBoxForm not WidgetContainer
birdsarah May 21, 2016
7e399de
Clean-up document resize code
birdsarah May 21, 2016
9f96b72
Make box_layout more flexible about presence of width & height variab…
birdsarah May 21, 2016
2c84a2b
Increase trigger delay
birdsarah May 21, 2016
cf1094d
Only use the bits of bootstrap we need for bokeh core css.
birdsarah May 21, 2016
4bb2959
Clean-up rendering of canvas
birdsarah May 21, 2016
86df1ba
Implement fixed responsive mode.
birdsarah May 21, 2016
33d18b3
Toolbar inherits from Model not LayoutDOM
birdsarah May 22, 2016
ce75d3b
WIP Width responsive boxes
birdsarah May 22, 2016
5387fac
Tweak deprecation, make plot fixed by default.
birdsarah May 22, 2016
fc5af25
Merge branch 'master' into birdsarah/4164_rework_layout
birdsarah May 23, 2016
c3e8ab0
Fix deprecation warning when using charts due to new tools.
birdsarah May 23, 2016
68be7fe
Fix hover toolbar
birdsarah May 23, 2016
c5b7bd9
Tweak tests
birdsarah May 23, 2016
8386332
Fix missing crosshair tool.
birdsarah May 23, 2016
29ace2d
Plots are back to fixed by default, stop xfailing test
birdsarah May 23, 2016
9084773
Move canvas resize wait into utils, and use it on all tests.
birdsarah May 23, 2016
0db6314
Add missing asserts to wheel zoom test
birdsarah May 23, 2016
12e3588
Update screenhot tests
birdsarah May 23, 2016
21be572
Small tweaks to range and responsive tests.
birdsarah May 23, 2016
2cb43d7
Remove testing examples cruft
birdsarah May 23, 2016
e3d428f
Update responsive modes to `fixed`, `box`, `width_ar`, `height_ar`, `…
birdsarah May 23, 2016
a9ddb66
Add re-run option to integration tests
birdsarah May 23, 2016
1d4cd45
Fix-up widget display.
birdsarah May 23, 2016
d4492a1
Fix-up tests after new resposnive names
birdsarah May 23, 2016
0fa2e36
Give widgets a little more room to breathe
birdsarah May 23, 2016
64b0a68
Plot test had wrong indentation
birdsarah May 23, 2016
4133c11
Get fixed and width_ar layouts playing nicer in mixed-layouts.
birdsarah May 23, 2016
66203c6
Fix-up selenium tests
birdsarah May 23, 2016
a1eebba
Implement height_ar mode
birdsarah May 23, 2016
888b016
Small clean-up of layout_dom.coffee
birdsarah May 23, 2016
bc5fafe
Implement box_ar on plot - must be wrapped in a box.
birdsarah May 23, 2016
38a1289
set reponsive defaults, tweak warning message
bryevdv May 23, 2016
3be1b4e
Add missing default for toolbar_location (how was this not picked up)
birdsarah May 24, 2016
02c69f4
Add a toolbar box that can layout a toolbar anywhere.
birdsarah May 24, 2016
4b933b2
Merge branch 'master' into birdsarah/4164_rework_layout
birdsarah May 24, 2016
c09ca05
Update GridPlot responsive default
birdsarah May 24, 2016
295cb4a
Try and fix wierd rendering issue after merge
birdsarah May 24, 2016
1026fea
Revert "Revert "Make hidpi work for webgl""
birdsarah May 24, 2016
7422b20
Merge branch 'master' into birdsarah/4164_rework_layout
birdsarah May 24, 2016
cf77571
Give ToolbarBox merge tools capability
birdsarah May 24, 2016
1ba26b3
Massively simplified gridplot.
birdsarah May 24, 2016
542c778
Add initial python implementation of GridPlot
birdsarah May 24, 2016
88487c9
update custom model JS for random_tiles example
bryevdv May 24, 2016
8353577
Restore to height_width responsive functionality
birdsarah May 24, 2016
1532ade
Merge branch 'birdsarah/4164_rework_layout' of github.com:bokeh/bokeh…
birdsarah May 24, 2016
4399b88
Merge remote-tracking branch 'origin/revert-4358-revert-4348-almarkle…
almarklein May 24, 2016
e1073d2
GridPlot is a function, clean-up to ToolbarBox
birdsarah May 25, 2016
c146bf6
ToolbarBase needs to be a LayoutDOM
birdsarah May 25, 2016
e507f2e
Give clear to all row objects
birdsarah May 25, 2016
47081ce
Add get_width function to box.coffee
birdsarah May 25, 2016
47cd784
Have layout dom try harder to get a size in fixed mode
birdsarah May 25, 2016
dc4c28d
Deprecate io.gridplot
birdsarah May 25, 2016
dec7ac2
Add a spacer class and use it so gridplot can support None
birdsarah May 25, 2016
738de9c
Remove BokehJS GridPlot
birdsarah May 25, 2016
a95a7e2
Ensure rendering order and remove work-around for mixed layouts.
birdsarah May 25, 2016
200db92
Only render positions when not in fixed mode
birdsarah May 25, 2016
4ceafa7
Return null from get_width
birdsarah May 25, 2016
72557e5
Tweak styling so fixed grid right toolbar is correct
birdsarah May 25, 2016
0cd5cd3
Remove gridplot tests now its deprecated
birdsarah May 25, 2016
d231b83
Add tests for toolbar tweaks, clean-up constraints tests
birdsarah May 25, 2016
38f0102
Make gridplot fixed by default
birdsarah May 25, 2016
2f532a6
Merge pull request #4360 from bokeh/try_merging_hdpi
birdsarah May 25, 2016
d06952b
Merge branch 'master' into birdsarah/4164_rework_layout
birdsarah May 25, 2016
06b6014
Remove console.log statement from canvas
birdsarah May 25, 2016
ce1fb39
Fix-up nasty merge conflict on plot tests
birdsarah May 25, 2016
007f8e1
vform and VBoxForm deprecate as WidgetBox
birdsarah May 25, 2016
944efd2
Improve toolbar and widgets in layouts
birdsarah May 25, 2016
0b87c3d
Merge branch 'master' into birdsarah/4164_rework_layout
birdsarah May 25, 2016
b25fc1b
Fix-up annotations tests after merge
birdsarah May 25, 2016
7e030a7
All default to fixed, auto-wrap widgets into widget boxes
birdsarah May 26, 2016
085fb2e
Update geojson points after API change
birdsarah May 26, 2016
f14e328
Correct bad defaults - LayoutDOM is null, others are fixed
birdsarah May 26, 2016
dc1d82b
Make sure widgets have enough room
birdsarah May 26, 2016
ba9c232
Small improvements to widgets css
birdsarah May 26, 2016
f941942
Turn None's into spacer, make spacers responsive
birdsarah May 26, 2016
3a17d0d
CSS to get tabs rendering properly
birdsarah May 26, 2016
7f8a050
Reset should trigger a document resize.
birdsarah May 26, 2016
18186a4
Fix gmap plot
birdsarah May 26, 2016
fbdf785
Add title back to Plot
birdsarah May 26, 2016
3f3ce59
Fix responsive box_ar test
birdsarah May 26, 2016
fa5151c
Remove title prop from chart now we've changed up title
birdsarah May 26, 2016
182759c
use synthetic renderers for crosshair spans
bryevdv May 26, 2016
b9dde92
Clean-up Plot title properties
birdsarah May 26, 2016
2b93daa
Finish plot title deprecations, clean-up tests.
birdsarah May 27, 2016
b71c6b1
Merge branch 'birdsarah/4164_rework_layout' of github.com:bokeh/bokeh…
birdsarah May 27, 2016
5e6e56d
Fix crosshair tool test after change to synthetic renderers
birdsarah May 27, 2016
7f64b49
Initial implementation of a smarter deprecation for VBoxForm.
birdsarah May 27, 2016
fdf908f
Add deprecated properties to deprecated attributes list
birdsarah May 27, 2016
26b8cfd
Initial fix for tabs
birdsarah May 27, 2016
34f198c
Correct title position (shouldn't have changed it)
birdsarah May 27, 2016
5f1b68f
Change "" to None title property
birdsarah May 27, 2016
a2a0cb4
Correct title property deprecation and add better warnings
birdsarah May 27, 2016
973ad61
Add tests for tabs fix
birdsarah May 27, 2016
1786b2f
Update screenshot test to check outside all axes.
birdsarah May 27, 2016
1c3dcab
Try and improve clarity of Responsive property transform
birdsarah May 27, 2016
f9364b2
Add layout convenience function and two examples
birdsarah May 27, 2016
ea89c11
Restore chart test for defaults
birdsarah May 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@ win-64
.cache/

# generated coffeescript
/bokehjs/test/test_common/defaults/models_defaults.coffee
/bokehjs/test/test_common/defaults/widgets_defaults.coffee
/bokehjs/test/common/generated_defaults/models_defaults.coffee
/bokehjs/test/common/generated_defaults/widgets_defaults.coffee
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ script:
#
# Run integration tests only once (Py 3.4)
- if [[ -z "$TRAVIS_TAG" && "$GROUP" == integration && -n "${SAUCELABS}" ]]; then travis_start_sauce_connect; fi
- if [[ -z "$TRAVIS_TAG" && "$GROUP" == integration && -n "${SAUCELABS}" ]]; then py.test -m integration --driver SauceLabs --html=tests/pytest-report.html -n4 --upload; fi # Run the integration tests on saucelabs
- if [[ -z "$TRAVIS_TAG" && "$GROUP" == integration && -n "${SAUCELABS}" ]]; then py.test -m integration --driver SauceLabs --html=tests/pytest-report.html -n4 -r3 --upload; fi # Run the integration tests on saucelabs
- if [[ -z "$TRAVIS_TAG" && "$GROUP" == integration && -n "${SAUCELABS}" ]]; then travis_stop_sauce_connect; fi
- if [[ -z "$TRAVIS_TAG" && "$GROUP" == integration && -z "${SAUCELABS}" ]]; then py.test -m integration --driver Firefox; fi
#
Expand Down
6 changes: 1 addition & 5 deletions bokeh/charts/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,11 @@ def create_and_build(builder_class, *data, **kws):
builder = builder_class(*data, **builder_kws)

# create a chart to return, since there isn't one already
chart_kws = { k:v for k,v in kws.items() if k not in builder_props}
chart_kws = {k: v for k, v in kws.items() if k not in builder_props}
chart = Chart(**chart_kws)
chart.add_builder(builder)
chart.start_plot()

curdoc()._current_plot = chart # TODO (havocp) store this on state, not doc?
if curstate().autoadd:
curdoc().add_root(chart)

return chart


Expand Down
25 changes: 11 additions & 14 deletions bokeh/charts/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ class Chart(Plot):
What kind of scale to use for the y-axis.
""")

title_text_font_size = Override(default={ 'value' : '14pt' })

responsive = Override(default=False)

_defaults = defaults

__deprecated_attributes__ = ('filename', 'server', 'notebook', 'width', 'height', 'xgrid', 'ygrid', 'legend')
__deprecated_attributes__ = (
'filename', 'server', 'notebook', 'width', 'height', 'xgrid', 'ygrid', 'legend'
'background_fill', 'border_fill', 'logo', 'tools',
'title_text_baseline', 'title_text_align', 'title_text_alpha', 'title_text_color',
'title_text_font_style', 'title_text_font_size', 'title_text_font', 'title_standoff'
)

_xgrid = True
_ygrid = True
Expand Down Expand Up @@ -133,10 +134,6 @@ def __init__(self, *args, **kwargs):
if k in kwargs:
setattr(self, k, kwargs[k])

# TODO (bev) have to force serialization of overriden defaults on subtypes for now
self.title_text_font_size = "10pt"
self.title_text_font_size = "14pt"

self._glyphs = []
self._built = False

Expand All @@ -147,7 +144,8 @@ def __init__(self, *args, **kwargs):
self._scales = defaultdict(list)
self._tooltips = []

self.create_tools(self._tools)
if hasattr(self, '_tools'):
self.create_tools(self._tools)

def add_renderers(self, builder, renderers):
self.renderers += renderers
Expand Down Expand Up @@ -198,7 +196,7 @@ def create_tools(self, tools):
# in case tools == False just exit
return

if len(self.tools) == 0:
if len(self.toolbar.tools) == 0:
# if no tools customization let's create the default tools
tool_objs = _process_tools_arg(self, tools)
self.add_tools(*tool_objs)
Expand All @@ -209,9 +207,8 @@ def start_plot(self):
self.create_axes()
self.create_grids(self._xgrid, self._ygrid)

# Add tools if supposed to
if self.tools:
self.create_tools(self.tools)
if self.toolbar.tools:
self.create_tools(self._tools)

if len(self._tooltips) > 0:
self.add_tools(HoverTool(tooltips=self._tooltips))
Expand Down
5 changes: 3 additions & 2 deletions bokeh/charts/tests/test_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def setUp(self):

def test_title(self):
self.chart.title = "new_title"
self.assertEqual(self.chart.title, "new_title")
self.assertEqual(self.chart.title.text, "new_title")

def test_responsive(self):
self.assertEqual(self.chart.responsive, True)
self.assertEqual(self.chart.responsive, 'width_ar')

def check_chart_elements(self, expected_tools):
self.assertIsInstance(self.chart.left[0], LinearAxis)
Expand Down Expand Up @@ -162,6 +162,7 @@ def test_defaults():
assert c1.tools
assert c2.tools == c3.tools == []


def test_charts_theme_validation():
from bokeh.plotting import figure
p = figure()
Expand Down
9 changes: 7 additions & 2 deletions bokeh/client/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,14 @@ def push(self, document=None):
if self._document is None:
self._attach_document(doc)


def show(self, browser=None, new="tab"):
def show(self, obj=None, browser=None, new="tab"):
""" Open a browser displaying this session.

Args:
obj (LayoutDOM object, optional) : a Layout (Row/Column),
Plot or Widget object to display. The object will be added
to the session's document.

browser (str, optional) : browser to show with (default: None)
For systems that support it, the **browser** argument allows
specifying which browser to display in, e.g. "safari", "firefox",
Expand All @@ -288,6 +291,8 @@ def show(self, browser=None, new="tab"):
opens a new tab. If **new** is 'window', then opens a new window.

"""
if obj and obj not in self.document.roots:
self.document.add_root(obj)
show_session(session=self)

@classmethod
Expand Down
11 changes: 11 additions & 0 deletions bokeh/core/_templates/file.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
<title>{{ title if title else "Bokeh Plot" }}</title>
{{ bokeh_css }}
{{ bokeh_js }}
<style>
html {
width: 100%;
height: 100%;
}
body {
width: 90%;
height: 100%;
margin: auto;
}
</style>
</head>
<body>
{{ plot_div|indent(8) }}
Expand Down
2 changes: 2 additions & 0 deletions bokeh/core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,5 @@ def enumeration(*values, **kwargs):
#: Specify sorting directions
SortDirection = enumeration("ascending", "descending")

#: Responsive types
Responsive = enumeration("box", "width_ar", "height_ar", "box_ar", "fixed")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "ar" stand for or signify?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It signifies that aspect_ratio is preserved during responsiveness.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw below, maybe just width_aspect is more self-evident in isolation, though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me width_aspect sounds like width-aspect. Something like width_fixed_aspect_ratio would be clear but way too long. width_far or width_ar is a bit cryptic imo.

What about just 'width', 'height', 'both' for the fixed ar ones? Then 'fixed' can stay, and for what is now 'box' we can use 'free' or 'full', or keep it 'box'.

37 changes: 35 additions & 2 deletions bokeh/core/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ def _get_default(self, obj):
return default

def _real_set(self, obj, old, value, hint=None):
# Currently as of Bokeh 0.11.1, all hinted events modify in place. However this may
# need refining later if this assumption changes.
# Currently as of Bokeh 0.11.1, all hinted events modify in place. However this may
# need refining later if this assumption changes.
unchanged = self.descriptor.matches(value, old) and (hint is None)
if unchanged:
return
Expand Down Expand Up @@ -1855,3 +1855,36 @@ def transform(self, value):
value = tuple(int(v) if i < 3 else v for i, v in enumerate(value))

return value

class Responsive(Either):

def __init__(self, default=None, help=None):
types = (Enum(enums.Responsive), Bool)
super(Responsive, self).__init__(*types, default=default, help=help)

def transform(self, value):
""" Transform True to width_ar mode and False to fixed
"""
if value is True:
responsive = 'width_ar'
elif value is False:
responsive = 'fixed'
else:
responsive = value
return responsive


class TitleProp(Either):

def __init__(self, default=None, help=None):
types = (Instance('bokeh.models.annotations.Title'), String)
super(TitleProp, self).__init__(*types, default=default, help=help)

def transform(self, value):
if isinstance(value, str):
if value == "":
return None
else:
from bokeh.models.annotations import Title
value = Title(text=value)
return value
37 changes: 33 additions & 4 deletions bokeh/core/tests/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
HasProps, NumberSpec, ColorSpec, Bool, Int, Float, Complex, String,
Regex, List, Dict, Tuple, Array, Instance, Any, Interval, Either,
Enum, Color, Align, DashPattern, Size, Percent, Angle, AngleSpec,
DistanceSpec, Override, Include, MinMaxBounds)
DistanceSpec, Override, Include, MinMaxBounds, Responsive, TitleProp)

from bokeh.models import Plot
from bokeh.models.annotations import Title

class Basictest(unittest.TestCase):

Expand Down Expand Up @@ -1445,13 +1448,39 @@ def test_MinMaxBounds_with_datetime(self):
# Invalid values
self.assertFalse(prop.is_valid((datetime.date(2012, 10, 1), 22)))


def test_HasProps_clone():
from bokeh.models import Plot
p1 = Plot(plot_width=1000)
c1 = p1.properties_with_values(include_defaults=False)
p2 = p1._clone()
c2 = p2.properties_with_values(include_defaults=False)
assert c1 == c2

if __name__ == "__main__":
unittest.main()

def test_responsive_transforms_true_into_width():
class Foo(HasProps):
responsive = Responsive
f = Foo(responsive=True)
assert f.responsive == 'width_ar'


def test_responsive_transforms_false_into_fixed():
class Foo(HasProps):
responsive = Responsive
f = Foo(responsive=False)
assert f.responsive == 'fixed'


def test_titleprop_transforms_string_into_title_object():
class Foo(HasProps):
title = TitleProp
f = Foo(title="hello")
assert isinstance(f.title, Title)
assert f.title.text == "hello"


def test_titleprop_transforms_empty_string_into_None():
class Foo(HasProps):
title = TitleProp
f = Foo(title="")
assert f.title is None
5 changes: 5 additions & 0 deletions bokeh/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@ def add_root(self, model):
if model in self._roots:
return
self._push_all_models_freeze()
# TODO(bird) Should we do some kind of reporting of how many LayoutDOM
# items are in the document roots. In vanilla bokeh cases e.g.
# output_file, output_server more than one LayoutDOM is probably not
# going to go well. But in embedded cases, you may well want more than
# one.
try:
self._roots.append(model)
finally:
Expand Down
Loading