Show More
@@ -74,6 +74,7 b' class DisplayFormatter(Configurable):' | |||||
74 | MarkdownFormatter, |
|
74 | MarkdownFormatter, | |
75 | SVGFormatter, |
|
75 | SVGFormatter, | |
76 | PNGFormatter, |
|
76 | PNGFormatter, | |
|
77 | GIFFormatter, | |||
77 | PDFFormatter, |
|
78 | PDFFormatter, | |
78 | JPEGFormatter, |
|
79 | JPEGFormatter, | |
79 | LatexFormatter, |
|
80 | LatexFormatter, | |
@@ -779,6 +780,24 b' class JPEGFormatter(BaseFormatter):' | |||||
779 | _return_type = (bytes, str) |
|
780 | _return_type = (bytes, str) | |
780 |
|
781 | |||
781 |
|
782 | |||
|
783 | class GIFFormatter(BaseFormatter): | |||
|
784 | """A PNG formatter. | |||
|
785 | ||||
|
786 | To define the callables that compute the GIF representation of your | |||
|
787 | objects, define a :meth:`_repr_gif_` method or use the :meth:`for_type` | |||
|
788 | or :meth:`for_type_by_name` methods to register functions that handle | |||
|
789 | this. | |||
|
790 | ||||
|
791 | The return value of this formatter should be raw GIF data, *not* | |||
|
792 | base64 encoded. | |||
|
793 | """ | |||
|
794 | format_type = Unicode('image/gif') | |||
|
795 | ||||
|
796 | print_method = ObjectName('_repr_gif_') | |||
|
797 | ||||
|
798 | _return_type = (bytes, str) | |||
|
799 | ||||
|
800 | ||||
782 | class LatexFormatter(BaseFormatter): |
|
801 | class LatexFormatter(BaseFormatter): | |
783 | """A LaTeX formatter. |
|
802 | """A LaTeX formatter. | |
784 |
|
803 | |||
@@ -973,6 +992,7 b' FormatterABC.register(HTMLFormatter)' | |||||
973 | FormatterABC.register(MarkdownFormatter) |
|
992 | FormatterABC.register(MarkdownFormatter) | |
974 | FormatterABC.register(SVGFormatter) |
|
993 | FormatterABC.register(SVGFormatter) | |
975 | FormatterABC.register(PNGFormatter) |
|
994 | FormatterABC.register(PNGFormatter) | |
|
995 | FormatterABC.register(GIFFormatter) | |||
976 | FormatterABC.register(PDFFormatter) |
|
996 | FormatterABC.register(PDFFormatter) | |
977 | FormatterABC.register(JPEGFormatter) |
|
997 | FormatterABC.register(JPEGFormatter) | |
978 | FormatterABC.register(LatexFormatter) |
|
998 | FormatterABC.register(LatexFormatter) |
@@ -48,6 +48,9 b' class RichOutput(object):' | |||||
48 |
|
48 | |||
49 | def _repr_jpeg_(self): |
|
49 | def _repr_jpeg_(self): | |
50 | return self._repr_mime_("image/jpeg") |
|
50 | return self._repr_mime_("image/jpeg") | |
|
51 | ||||
|
52 | def _repr_gif_(self): | |||
|
53 | return self._repr_mime_("image/gif") | |||
51 |
|
54 | |||
52 | def _repr_svg_(self): |
|
55 | def _repr_svg_(self): | |
53 | return self._repr_mime_("image/svg+xml") |
|
56 | return self._repr_mime_("image/svg+xml") | |
@@ -162,5 +165,3 b' class capture_output(object):' | |||||
162 | if self.display and self.shell: |
|
165 | if self.display and self.shell: | |
163 | self.shell.display_pub = self.save_display_pub |
|
166 | self.shell.display_pub = self.save_display_pub | |
164 | sys.displayhook = self.save_display_hook |
|
167 | sys.displayhook = self.save_display_hook | |
165 |
|
||||
166 |
|
General Comments 0
You need to be logged in to leave comments.
Login now