[yt-svn] commit/yt-3.0: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Wed Oct 3 22:29:23 PDT 2012


2 new commits in yt-3.0:


https://bitbucket.org/yt_analysis/yt-3.0/changeset/8918fa31b722/
changeset:   8918fa31b722
branch:      yt-3.0
user:        scopatz
date:        2012-09-27 22:58:51
summary:     Added show_or_save() method to plots.
affected #:  1 file

diff -r 24de0bfbca7012c7ce3a9b23a50abefa76c453ac -r 8918fa31b7221ed8037b181f26d69625ded8a27f yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -795,6 +795,14 @@
         else:
             raise YTNotInsideNotebook
 
+    def show_or_save(self, name=None):
+        """Will attempt to show the plot in in an IPython notebook.  Failing that, the 
+        plot will be saved to disk."""
+        try:
+            self.show()
+        except YTNotInsideNotebook:
+            self.save(name=name)
+
 class SlicePlot(PWViewerMPL):
     def __init__(self, pf, axis, fields, center='c', width=None, origin='center-window'):
         r"""Creates a slice plot from a parameter file



https://bitbucket.org/yt_analysis/yt-3.0/changeset/28d77cb4f4ee/
changeset:   28d77cb4f4ee
branch:      yt-3.0
user:        MatthewTurk
date:        2012-10-04 07:29:21
summary:     Merged in scopatz/yt-3.0 (pull request #7)
affected #:  1 file

diff -r 24087b9826d1e115436cedb19f6544859e957c07 -r 28d77cb4f4ee34835a9366386a68e3f8a63789c7 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -900,6 +900,14 @@
         else:
             raise YTNotInsideNotebook
 
+    def show_or_save(self, name=None):
+        """Will attempt to show the plot in in an IPython notebook.  Failing that, the 
+        plot will be saved to disk."""
+        try:
+            self.show()
+        except YTNotInsideNotebook:
+            self.save(name=name)
+
 class SlicePlot(PWViewerMPL):
     _plot_type = 'Slice'
     _frb_generator = FixedResolutionBuffer

Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list