Skip to content

Commit 2442b4b

Browse files
authored
Merge pull request #179 from martinRenou/add_footer_visible_attr
Add footer_visible option
2 parents 35b5330 + 253b5ab commit 2442b4b

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

examples/ipympl.ipynb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@
4848
"fig.canvas.header_visible = False"
4949
]
5050
},
51+
{
52+
"cell_type": "code",
53+
"execution_count": null,
54+
"metadata": {},
55+
"outputs": [],
56+
"source": [
57+
"fig.canvas.footer_visible = False"
58+
]
59+
},
60+
{
61+
"cell_type": "code",
62+
"execution_count": null,
63+
"metadata": {},
64+
"outputs": [],
65+
"source": [
66+
"fig.canvas"
67+
]
68+
},
5169
{
5270
"cell_type": "code",
5371
"execution_count": null,

ipympl/backend_nbagg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ class Canvas(DOMWidget, FigureCanvasWebAggCore):
151151
toolbar_position = Enum(['top', 'bottom', 'left', 'right'], default_value='left').tag(sync=True)
152152

153153
header_visible = Bool(True).tag(sync=True)
154+
footer_visible = Bool(True).tag(sync=True)
154155

155156
_width = CInt().tag(sync=True)
156157
_height = CInt().tag(sync=True)

js/src/mpl_widget.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var MPLCanvasModel = widgets.DOMWidgetModel.extend({
1717
_model_module_version: '^'+ version,
1818
_view_module_version: '^' + version,
1919
header_visible: true,
20+
footer_visible: true,
2021
toolbar: null,
2122
toolbar_visible: true,
2223
toolbar_position: 'horizontal',
@@ -219,6 +220,7 @@ var MPLCanvasView = widgets.DOMWidgetView.extend({
219220
that._update_toolbar_position();
220221

221222
that._update_header_visible();
223+
that._update_footer_visible();
222224
that._update_toolbar_visible();
223225

224226
that.model_events();
@@ -227,6 +229,7 @@ var MPLCanvasView = widgets.DOMWidgetView.extend({
227229

228230
model_events: function() {
229231
this.model.on('change:header_visible', this._update_header_visible.bind(this));
232+
this.model.on('change:footer_visible', this._update_footer_visible.bind(this));
230233
this.model.on('change:toolbar_visible', this._update_toolbar_visible.bind(this));
231234
this.model.on('change:toolbar_position', this._update_toolbar_position.bind(this));
232235
this.model.on('change:_figure_label', this._update_figure_label.bind(this));
@@ -238,6 +241,10 @@ var MPLCanvasView = widgets.DOMWidgetView.extend({
238241
this.header.style.display = this.model.get('header_visible') ? '': 'none';
239242
},
240243

244+
_update_footer_visible: function() {
245+
this.footer.style.display = this.model.get('footer_visible') ? '': 'none';
246+
},
247+
241248
_update_toolbar_visible: function() {
242249
this.toolbar_view.el.style.display = this.model.get('toolbar_visible') ? '' : 'none';
243250
},

0 commit comments

Comments
 (0)