Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 |
"""
|
|
2 |
Spacer components to add horizontal or vertical space to a layout.
|
|
3 |
"""
|
|
4 |
|
|
5 | 2 |
import param |
6 |
|
|
7 | 2 |
from bokeh.models import Div as BkDiv, Spacer as BkSpacer |
8 |
|
|
9 | 2 |
from ..reactive import Reactive |
10 |
|
|
11 |
|
|
12 | 2 |
class Spacer(Reactive): |
13 |
"""Empty object used to control formatting (using positive or negative space)"""
|
|
14 |
|
|
15 | 2 |
_bokeh_model = BkSpacer |
16 |
|
|
17 | 2 |
def _get_model(self, doc, root=None, parent=None, comm=None): |
18 | 2 |
properties = self._process_param_change(self._init_properties()) |
19 | 2 |
model = self._bokeh_model(**properties) |
20 | 2 |
if root is None: |
21 | 2 |
root = model |
22 | 2 |
self._models[root.ref['id']] = (model, parent) |
23 | 2 |
return model |
24 |
|
|
25 |
|
|
26 | 2 |
class VSpacer(Spacer): |
27 |
"""
|
|
28 |
Spacer which automatically fills all available vertical space.
|
|
29 |
"""
|
|
30 |
|
|
31 | 2 |
sizing_mode = param.Parameter(default='stretch_height', readonly=True) |
32 |
|
|
33 |
|
|
34 | 2 |
class HSpacer(Spacer): |
35 |
"""
|
|
36 |
Spacer which automatically fills all available horizontal space.
|
|
37 |
"""
|
|
38 |
|
|
39 | 2 |
sizing_mode = param.Parameter(default='stretch_width', readonly=True) |
40 |
|
|
41 |
|
|
42 | 2 |
class Divider(Reactive): |
43 |
"""A Divider line"""
|
|
44 |
|
|
45 | 2 |
width_policy = param.ObjectSelector(default="fit", readonly=True) |
46 |
|
|
47 | 2 |
_bokeh_model = BkDiv |
48 |
|
|
49 | 2 |
def _get_model(self, doc, root=None, parent=None, comm=None): |
50 |
properties = self._process_param_change(self._init_properties()) |
|
51 |
properties['style'] = {'width': '100%', 'height': '100%'} |
|
52 |
model = self._bokeh_model(text='<hr style="margin: 0px">', **properties) |
|
53 |
if root is None: |
|
54 |
root = model |
|
55 |
self._models[root.ref['id']] = (model, parent) |
|
56 |
return model |
Read our documentation on viewing source code .