WebBrowser/PageScreenDialog.py

changeset 6155
ae44225e7e7c
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
--- a/WebBrowser/PageScreenDialog.py	Sat Feb 17 14:59:26 2018 +0100
+++ b/WebBrowser/PageScreenDialog.py	Sat Feb 17 17:29:03 2018 +0100
@@ -22,14 +22,12 @@
     """
     Class implementing a dialog to save a screenshot of a web page.
     """
-    def __init__(self, view, visibleOnly=False, parent=None):
+    def __init__(self, view, parent=None):
         """
         Constructor
         
         @param view reference to the web view containing the page to be saved
             (WebBrowserView)
-        @param visibleOnly flag indicating to just save the visible part
-            of the page (boolean)
         @param parent reference to the parent widget (QWidget)
         """
         super(PageScreenDialog, self).__init__(parent)
@@ -37,15 +35,12 @@
         self.setWindowFlags(Qt.Window)
         
         self.__view = view
-        self.__createPixmap(visibleOnly)
+        self.__createPixmap()
         self.pageScreenLabel.setPixmap(self.__pagePixmap)
     
-    def __createPixmap(self, visibleOnly):
+    def __createPixmap(self):
         """
         Private slot to create a pixmap of the associated view's page.
-        
-        @param visibleOnly flag indicating to just save the visible part
-            of the page (boolean)
         """
         res = self.__view.page().execJavaScript(
             "(function() {"
@@ -59,19 +54,11 @@
             "})()"
         )
         if res is not None:
-            if visibleOnly:
-                image = QImage(QSize(res["width"], self.__view.height()),
-                               QImage.Format_ARGB32)
-                painter = QPainter(image)
-                self.__view.render(painter)
-                painter.end()
-            else:
-                # TODO: once QWebEngineView supports this
-                image = QImage(QSize(res["width"], self.__view.height()),
-                               QImage.Format_ARGB32)
-                painter = QPainter(image)
-                self.__view.render(painter)
-                painter.end()
+            image = QImage(QSize(res["width"], self.__view.height()),
+                           QImage.Format_ARGB32)
+            painter = QPainter(image)
+            self.__view.render(painter)
+            painter.end()
             
             self.__pagePixmap = QPixmap.fromImage(image)
     

eric ide

mercurial