##// END OF EJS Templates
Updated docstrings, following the convention in kernelmanager.py.
Mark Voorhies -
Show More
@@ -508,14 +508,20 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
508 self._control.print_(printer)
508 self._control.print_(printer)
509
509
510 def export_html_inline(self, parent = None):
510 def export_html_inline(self, parent = None):
511 """ Export the contents of the ConsoleWidget as HTML with inline PNGs.
512 """
511 self.export_html(parent, inline = True)
513 self.export_html(parent, inline = True)
512
514
513 def export_html(self, parent = None, inline = False):
515 def export_html(self, parent = None, inline = False):
514 """ Export the contents of the ConsoleWidget as an HTML file.
516 """ Export the contents of the ConsoleWidget as HTML.
517
518 Parameters:
519 -----------
520 inline : bool, optional [default True]
515
521
516 If inline == True, include images as inline PNGs. Otherwise,
522 If True, include images as inline PNGs. Otherwise,
517 include them as links to external PNG files, mimicking the
523 include them as links to external PNG files, mimicking
518 Firefox's "Web Page, complete" behavior.
524 Firefox's "Web Page, complete" behavior.
519 """
525 """
520 dialog = QtGui.QFileDialog(parent, 'Save HTML Document')
526 dialog = QtGui.QFileDialog(parent, 'Save HTML Document')
521 dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
527 dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
@@ -552,8 +558,7 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
552 return None
558 return None
553
559
554 def export_xhtml(self, parent = None):
560 def export_xhtml(self, parent = None):
555 """ Export the contents of the ConsoleWidget as an XHTML file
561 """ Export the contents of the ConsoleWidget as XHTML with inline SVGs.
556 with figures as inline SVG.
557 """
562 """
558 dialog = QtGui.QFileDialog(parent, 'Save XHTML Document')
563 dialog = QtGui.QFileDialog(parent, 'Save XHTML Document')
559 dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
564 dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
@@ -581,11 +586,26 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
581 return filename
586 return filename
582 return None
587 return None
583
588
584 def image_tag(self, match, path = None):
589 def image_tag(self, match, path = None, format = "png"):
585 """ Given an re.match object matching an image name in an HTML export,
590 """ Return (X)HTML mark-up for the image-tag given by match.
586 return an appropriate substitution string for the image tag
591
587 (e.g., link, embedded image, ...). As a side effect, files may
592 Parameters
588 be generated in the directory given by path."""
593 ----------
594 match : re.SRE_Match
595 A match to an HTML image tag as exported by Qt, with
596 match.group("Name") containing the matched image ID.
597
598 path : string|None, optional [default None]
599 If not None, specifies a path to which supporting files
600 may be written (e.g., for linked images).
601 If None, all images are to be included inline.
602
603 format : "png"|"svg", optional [default "png"]
604 Format for returned or referenced images.
605
606 Subclasses supporting image display should override this
607 method.
608 """
589
609
590 # Default case -- not enough information to generate tag
610 # Default case -- not enough information to generate tag
591 return ""
611 return ""
@@ -126,11 +126,26 b' class RichIPythonWidget(IPythonWidget):'
126 image = self._get_image(name)
126 image = self._get_image(name)
127 image.save(filename, format)
127 image.save(filename, format)
128
128
129 def image_tag(self, match, path = None, format = "PNG"):
129 def image_tag(self, match, path = None, format = "png"):
130 """ Given an re.match object matching an image name in an HTML dump,
130 """ Return (X)HTML mark-up for the image-tag given by match.
131 return an appropriate substitution string for the image tag
131
132 (e.g., link, embedded image, ...). As a side effect, files may
132 Parameters
133 be generated in the directory given by path."""
133 ----------
134 match : re.SRE_Match
135 A match to an HTML image tag as exported by Qt, with
136 match.group("Name") containing the matched image ID.
137
138 path : string|None, optional [default None]
139 If not None, specifies a path to which supporting files
140 may be written (e.g., for linked images).
141 If None, all images are to be included inline.
142
143 format : "png"|"svg", optional [default "png"]
144 Format for returned or referenced images.
145
146 Subclasses supporting image display should override this
147 method.
148 """
134
149
135 if(format == "png"):
150 if(format == "png"):
136 try:
151 try:
General Comments 0
You need to be logged in to leave comments. Login now