Permalink
Browse files

Applied lowercase_with_underscores naming convention

  • Loading branch information...
1 parent badeab1 commit 35277cbbb99e40db21207b0b83a252e3e4f473af @markvoorhies committed Oct 12, 2010
Showing with 14 additions and 14 deletions.
  1. +10 −10 IPython/frontend/qt/console/console_widget.py
  2. +4 −4 IPython/frontend/qt/console/rich_ipython_widget.py
@@ -507,10 +507,10 @@ def print_(self, printer = None):
return
self._control.print_(printer)
- def exportHtmlInline(self, parent = None):
- self.exportHtml(parent, inline = True)
+ def export_html_inline(self, parent = None):
+ self.export_html(parent, inline = True)
- def exportHtml(self, parent = None, inline = False):
+ def export_html(self, parent = None, inline = False):
""" Export the contents of the ConsoleWidget as an HTML file.
If inline == True, include images as inline PNGs. Otherwise,
@@ -544,14 +544,14 @@ def exportHtml(self, parent = None, inline = False):
# predictable...
img_re = re.compile(r'<img src="(?P<name>[\d]+)" />')
f.write(img_re.sub(
- lambda x: self.imagetag(x, path = path, format = "PNG"),
+ lambda x: self.image_tag(x, path = path, format = "PNG"),
str(self._control.toHtml().toUtf8())))
finally:
f.close()
return filename
return None
- def exportXhtml(self, parent = None):
+ def export_xhtml(self, parent = None):
""" Export the contents of the ConsoleWidget as an XHTML file
with figures as inline SVG.
"""
@@ -574,14 +574,14 @@ def exportXhtml(self, parent = None):
html = ('<html xmlns="http://www.w3.org/1999/xhtml">\n'+
html[offset+6:])
f.write(img_re.sub(
- lambda x: self.imagetag(x, path = None, format = "SVG"),
+ lambda x: self.image_tag(x, path = None, format = "SVG"),
html))
finally:
f.close()
return filename
return None
- def imagetag(self, match, path = None):
+ def image_tag(self, match, path = None):
""" Given an re.match object matching an image name in an HTML export,
return an appropriate substitution string for the image tag
(e.g., link, embedded image, ...). As a side effect, files may
@@ -828,13 +828,13 @@ def _context_menu_make(self, pos):
print_action = menu.addAction('Print', self.print_)
print_action.setEnabled(True)
html_action = menu.addAction('Export HTML (external PNGs)',
- self.exportHtml)
+ self.export_html)
html_action.setEnabled(True)
html_inline_action = menu.addAction('Export HTML (inline PNGs)',
- self.exportHtmlInline)
+ self.export_html_inline)
html_inline_action.setEnabled(True)
xhtml_action = menu.addAction('Export XHTML (inline SVGs)',
- self.exportXhtml)
+ self.export_xhtml)
xhtml_action.setEnabled(True)
return menu
@@ -27,7 +27,7 @@ def __init__(self, *args, **kw):
super(RichIPythonWidget, self).__init__(*args, **kw)
# Dictionary for resolving Qt names to images when
# generating XHTML output
- self._name2svg = {}
+ self._name_to_svg = {}
#---------------------------------------------------------------------------
# 'ConsoleWidget' protected interface
@@ -71,7 +71,7 @@ def _process_execute_payload(self, item):
self._append_plain_text('Received invalid plot data.')
else:
format = self._add_image(image)
- self._name2svg[str(format.name())] = svg
+ self._name_to_svg[str(format.name())] = svg
format.setProperty(self._svg_text_format_property, svg)
cursor = self._get_end_cursor()
cursor.insertBlock()
@@ -126,7 +126,7 @@ def _save_image(self, name, format='PNG'):
image = self._get_image(name)
image.save(filename, format)
- def imagetag(self, match, path = None, format = "PNG"):
+ def image_tag(self, match, path = None, format = "PNG"):
""" Given an re.match object matching an image name in an HTML dump,
return an appropriate substitution string for the image tag
(e.g., link, embedded image, ...). As a side effect, files may
@@ -158,7 +158,7 @@ def imagetag(self, match, path = None, format = "PNG"):
elif(format == "SVG"):
try:
- svg = str(self._name2svg[match.group("name")])
+ svg = str(self._name_to_svg[match.group("name")])
except KeyError:
return "<b>Couldn't find image %s</b>" % match.group("name")

0 comments on commit 35277cb

Please sign in to comment.