Fixed a few bugs in the PDF Viewer. pdf_viewer

Wed, 18 Jan 2023 16:37:08 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 18 Jan 2023 16:37:08 +0100
branch
pdf_viewer
changeset 9705
7629a6f23b2e
parent 9704
6e1650b9b3b5
child 9706
c0ff0b4d5657

Fixed a few bugs in the PDF Viewer.

src/eric7/PdfViewer/PdfInfoWidget.py file | annotate | diff | comparison | revisions
src/eric7/PdfViewer/PdfZoomSelector.py file | annotate | diff | comparison | revisions
--- a/src/eric7/PdfViewer/PdfInfoWidget.py	Wed Jan 18 14:31:55 2023 +0100
+++ b/src/eric7/PdfViewer/PdfInfoWidget.py	Wed Jan 18 16:37:08 2023 +0100
@@ -30,7 +30,7 @@
         """
         super().__init__(parent)
 
-        self.__document = document
+        self.__document = None
 
         self.__layout = QFormLayout(self)
         self.__layout.setRowWrapPolicy(QFormLayout.RowWrapPolicy.WrapLongRows)
@@ -75,9 +75,26 @@
 
         self.setLayout(self.__layout)
 
-        self.__document.statusChanged.connect(self.__populateInfoLabels)
-        self.__document.pageCountChanged.connect(self.__handlePageCountChanged)
-        self.__document.passwordChanged.connect(self.__handlePasswordChanged)
+        self.setDocument(document)
+
+    def setDocument(self, document):
+        """
+        Public method to set the reference to the PDF document.
+
+        @param document reference to the document
+        @type QPdfDocument
+        """
+        if self.__document is not None:
+            self.__document.statusChanged.disconnect(self.__populateInfoLabels)
+            self.__document.pageCountChanged.disconnect(self.__handlePageCountChanged)
+            self.__document.passwordChanged.disconnect(self.__handlePasswordChanged)
+
+        self.__document = document
+
+        if document is not None:
+            self.__document.statusChanged.connect(self.__populateInfoLabels)
+            self.__document.pageCountChanged.connect(self.__handlePageCountChanged)
+            self.__document.passwordChanged.connect(self.__handlePasswordChanged)
 
     @pyqtSlot(QPdfDocument.Status)
     def __populateInfoLabels(self, status):
--- a/src/eric7/PdfViewer/PdfZoomSelector.py	Wed Jan 18 14:31:55 2023 +0100
+++ b/src/eric7/PdfViewer/PdfZoomSelector.py	Wed Jan 18 16:37:08 2023 +0100
@@ -46,7 +46,7 @@
 
         self.lineEdit().setAlignment(Qt.AlignmentFlag.AlignCenter)
 
-        ##self.currentTextChanged.connect(self.__processText)
+        self.currentIndexChanged.connect(self.__editingFinished)
         self.lineEdit().editingFinished.connect(self.__editingFinished)
 
     @pyqtSlot()

eric ide

mercurial