Package Camelot :: Package camelot :: Package view :: Package export :: Module desktop_service |
[frames] | no frames]

# Source Code for Module Camelot.camelot.view.export.desktop_service

     1  import logging
     2  logger = logging.getLogger('camelot.view.export.html')
     3

     4 -def open_html_in_desktop_service(html):
     5      import os
     6      import tempfile
     7      html_fd, html_fn = tempfile.mkstemp(suffix='.html')
     8      html_file = os.fdopen(html_fd, 'wb')
     9      html_file.write(html.encode('utf-8'))
    10      html_file.close()
    11      from PyQt4 import QtGui, QtCore
    12      QtGui.QDesktopServices.openUrl(QtCore.QUrl('file://%s' % html_fn))
    13