#17942: save() should download files in the notebook
-------------------------------------+-------------------------------------
       Reporter:  vbraun             |        Owner:
           Type:  defect             |       Status:  new
       Priority:  major              |    Milestone:  sage-6.6
      Component:  user interface     |   Resolution:
       Keywords:                     |    Merged in:
        Authors:                     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vbraun/save_should_download_files|  91830de68726ac8b38ed836b4bc9525beb5cf4bd
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vbraun):

 * commit:   => 91830de68726ac8b38ed836b4bc9525beb5cf4bd


Old description:

> In a browser-based notebook an object's `save()` method should
> automatically download the saved file and not just let it linger on the
> remote server.
>
> I'm proposing to do this by returning, from `save()`, a `SavedFile`
> object instead of nothing. The `SavedFile._rich_repr_` method then
> returns a custom rich representation which gives browser-based display
> backends a hook to do something with the saved file. Also, nothing
> happens if you call save() from within code---only if it hits the
> displayhook:
> {{{
> sage: my_plot.save()        # yes, download
> sage: _ = my_plot.save()    # no automatic download
> sage: for i in range(10):
> ....:     my_plot.save()    # depends
> sage: for i in range(10):
> ....:     my_plot.save()    # no
> ....:     x = x + i
> }}}

New description:

 In a browser-based notebook an object's `save()` method should
 automatically download the saved file and not just let it linger on the
 remote server.

 I'm proposing to do this by returning, from `save()`, a `SavedFile` object
 instead of nothing. The `SavedFile._rich_repr_` method then returns a
 custom rich representation which gives browser-based display backends a
 hook to do something with the saved file. Also, nothing happens if you
 call save() from within code---only if it hits the displayhook:
 {{{
 sage: my_plot.save()        # yes, download
 sage: _ = my_plot.save()    # no automatic download
 sage: for i in range(10):
 ....:     my_plot.save()    # depends
 sage: for i in range(10):
 ....:     my_plot.save()    # no
 ....:     x = x + i
 }}}

 [[Image(http://boxen.math.washington.edu/home/vbraun/www/ipython-download-
 link.png)]]

--

Comment:

 Apparently not so easy in IPython
 (https://github.com/ipython/ipython/issues/8053), I implemented a
 moderately hackish workaround.

--
Ticket URL: <http://trac.sagemath.org/ticket/17942#comment:7>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to