Ejemplo n.º 1
0
 def dumpToFile(self, filename):
     """ dumpToFile(filename) -> None
     It will generate a screenshot of the cell contents and dump to filename.
     It will also create a copy of the original text file used with
     filename's basename and the original extension.
     """
     if self.html is not None:
         basename, ext = os.path.splitext(filename)
         with open(basename + '.html', 'wb') as fp:
             fp.write(self.html.encode('utf-8'))
     QCellWidget.dumpToFile(self,filename)
Ejemplo n.º 2
0
 def dumpToFile(self, filename):
     """ dumpToFile(filename) -> None
     It will generate a screenshot of the cell contents and dump to filename.
     It will also create a copy of the original text file used with
     filename's basename and the original extension.
     """
     if self.html is not None:
         basename, ext = os.path.splitext(filename)
         with open(basename + '.html', 'wb') as fp:
             if isinstance(self.html, bytes):
                 fp.write(self.html)
             else:
                 codec = QtCore.QTextCodec.codecForHtml(
                         self.html.encode('utf-8'),
                         QtCore.QTextCodec.codecForName('UTF-8'))
                 fp.write(codec.fromUnicode(self.html))
     QCellWidget.dumpToFile(self,filename)