Skip to content

Commit

Permalink
hv.output now saves while respecting all settings (#1548)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlstevens authored and philippjfr committed Jun 15, 2017
1 parent 3259d4b commit 768b83a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion holoviews/ipython/magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def output(self, line, cell=None):
print("\nFor help with the %output magic, call %output?")
return

def cell_runner(cell):
def cell_runner(cell,renderer):
self.shell.run_cell(cell, store_history=STORE_HISTORY)

def warnfn(msg):
Expand Down
7 changes: 6 additions & 1 deletion holoviews/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,13 @@ def __call__(self, *args, **options):
if isinstance(obj, Dimensioned):
if line:
options = Store.output_settings.extract_keywords(line, {})
for k in options.keys():
if k not in Store.output_settings.allowed:
raise KeyError('Invalid keyword: %s' % k)
if 'filename' in options:
Store.renderers[Store.current_backend].save(obj, options['filename'])
def save_fn(obj, renderer): renderer.save(obj, options['filename'])
Store.output_settings.output(line=line, cell=obj, cell_runner=save_fn,
help_prompt=help_prompt, **options)
return obj
elif obj is not None:
return obj
Expand Down
2 changes: 1 addition & 1 deletion holoviews/util/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def output(cls, line=None, cell=None, cell_runner=None,
return

if cell is not None:
if cell_runner: cell_runner(cell)
if cell_runner: cell_runner(cell,renderer)
# After cell restore previous options and restore
# temporarily selected renderer
OutputSettings.options = prev_restore
Expand Down

0 comments on commit 768b83a

Please sign in to comment.