From 35277cbbb99e40db21207b0b83a252e3e4f473af 2010-10-12 01:04:46 From: Mark Voorhies Date: 2010-10-12 01:04:46 Subject: [PATCH] Applied lowercase_with_underscores naming convention --- diff --git a/IPython/frontend/qt/console/console_widget.py b/IPython/frontend/qt/console/console_widget.py index 7993ca8..60f6052 100644 --- a/IPython/frontend/qt/console/console_widget.py +++ b/IPython/frontend/qt/console/console_widget.py @@ -507,10 +507,10 @@ class ConsoleWidget(Configurable, QtGui.QWidget): 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 @@ class ConsoleWidget(Configurable, QtGui.QWidget): # predictable... img_re = re.compile(r'') 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 @@ class ConsoleWidget(Configurable, QtGui.QWidget): html = ('\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 @@ class ConsoleWidget(Configurable, QtGui.QWidget): 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 diff --git a/IPython/frontend/qt/console/rich_ipython_widget.py b/IPython/frontend/qt/console/rich_ipython_widget.py index 7b18733..076118e 100644 --- a/IPython/frontend/qt/console/rich_ipython_widget.py +++ b/IPython/frontend/qt/console/rich_ipython_widget.py @@ -27,7 +27,7 @@ class RichIPythonWidget(IPythonWidget): 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 @@ class RichIPythonWidget(IPythonWidget): 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 @@ class RichIPythonWidget(IPythonWidget): 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 @@ class RichIPythonWidget(IPythonWidget): elif(format == "SVG"): try: - svg = str(self._name2svg[match.group("name")]) + svg = str(self._name_to_svg[match.group("name")]) except KeyError: return "Couldn't find image %s" % match.group("name")