camelot.camelot.view.export.desktop_service

Package camelot :: Package camelot :: Package view :: Package export :: Module desktop_service |
[hide private]
[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 tempfile
     6    import os
     7    from camelot.view import art
     8    html_fd, html_fn = tempfile.mkstemp(suffix='.html')
     9    html_file = os.fdopen(html_fd, 'wb')
    10    html_file.write(html.encode('utf-8'))
    11    html_file.close()
    12    from PyQt4 import QtGui, QtCore
    13    QtGui.QDesktopServices.openUrl(QtCore.QUrl('file://%s'%html_fn))
    14