src/eric7/Preferences/ConfigurationPages/PdfViewerPage.py

branch
pdf_viewer
changeset 9712
24bdc37413dd
child 9722
63135ab601e7
diff -r 614bb8b0d175 -r 24bdc37413dd src/eric7/Preferences/ConfigurationPages/PdfViewerPage.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eric7/Preferences/ConfigurationPages/PdfViewerPage.py	Fri Jan 20 17:05:46 2023 +0100
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2023 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing the PDF Viewer configuration page.
+"""
+
+from eric7 import Preferences
+
+from .ConfigurationPageBase import ConfigurationPageBase
+from .Ui_PdfViewerPage import Ui_PdfViewerPage
+
+
+class PdfViewerPage(ConfigurationPageBase, Ui_PdfViewerPage):
+    """
+    Class implementing the PDF Viewer configuration page.
+    """
+
+    def __init__(self):
+        """
+        Constructor
+
+        @param parent reference to the parent widget (defaults to None)
+        @type QWidget (optional)
+        """
+        super().__init__()
+        self.setupUi(self)
+        self.setObjectName("PdfViewerPage")
+
+        # set initial values
+        self.contextLengthSpinBox.setValue(
+            Preferences.getPdfViewer("PdfSearchContextLength")
+        )
+        self.highlightCheckBox.setChecked(
+            Preferences.getPdfViewer("PdfSearchHighlightAll")
+        )
+        self.recentFilesSpinBox.setValue(Preferences.getPdfViewer("RecentNumber"))
+
+    def save(self):
+        """
+        Public slot to save the IRC configuration.
+        """
+        Preferences.setPdfViewer(
+            "PdfSearchContextLength", self.contextLengthSpinBox.value()
+        )
+        Preferences.setPdfViewer(
+            "PdfSearchHighlightAll", self.highlightCheckBox.isChecked()
+        )
+        Preferences.setPdfViewer("RecentNumber", self.recentFilesSpinBox.value())
+
+
+def create(dlg):
+    """
+    Module function to create the configuration page.
+
+    @param dlg reference to the configuration dialog
+    @return reference to the instantiated page
+    @rtype ConfigurationPageBase
+    """
+    page = PdfViewerPage()
+    return page

eric ide

mercurial