eric6/Helpviewer/HelpSnap.py

branch
maintenance
changeset 7286
7eb04391adf7
parent 7226
babe80d84a3e
parent 7285
1ff497f33f31
child 7287
1c17f2191bdd
--- a/eric6/Helpviewer/HelpSnap.py	Mon Sep 09 18:52:08 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
-#
-
-"""
-Module implementing functions to generate page previews.
-"""
-
-from __future__ import unicode_literals
-
-from PyQt5.QtCore import QSize, Qt
-from PyQt5.QtGui import QPixmap, QPainter
-from PyQt5.QtWebKitWidgets import QWebFrame
-
-
-def renderTabPreview(page, w, h):
-    """
-    Public function to render a pixmap of a page.
-    
-    @param page reference to the page to be previewed (QWebPage)
-    @param w width of the preview pixmap (integer)
-    @param h height of the preview pixmap (integer)
-    @return preview pixmap (QPixmap)
-    """
-    oldSize = page.viewportSize()
-    width = page.mainFrame().contentsSize().width()
-    page.setViewportSize(QSize(width, int(width * h / w)))
-    pageImage = __render(page, page.viewportSize().width(),
-                         page.viewportSize().height())
-    page.setViewportSize(oldSize)
-    return pageImage.scaled(
-        w, h, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
-
-
-def __render(page, w, h):
-    """
-    Private function to render a pixmap of given size for a web page.
-    
-    @param page reference to the page to be rendered (QWebPage)
-    @param w width of the pixmap (integer)
-    @param h height of the pixmap (integer)
-    @return rendered pixmap (QPixmap)
-    """
-    # create the page image
-    pageImage = QPixmap(w, h)
-    pageImage.fill(Qt.transparent)
-    
-    # render it
-    p = QPainter(pageImage)
-    page.mainFrame().render(p, QWebFrame.ContentsLayer)
-    p.end()
-    
-    return pageImage

eric ide

mercurial