src/eric7/UI/UserInterface.py

branch
eric7-maintenance
changeset 9832
3885b9d7bd31
parent 9725
b9a29a7aa820
parent 9823
31eeccd92f86
child 9940
a57c188857e9
--- a/src/eric7/UI/UserInterface.py	Tue Jan 24 10:16:03 2023 +0100
+++ b/src/eric7/UI/UserInterface.py	Wed Mar 01 09:05:47 2023 +0100
@@ -433,6 +433,7 @@
         self.projectBrowser.svgFile.connect(self.__showSvg)
         self.projectBrowser.umlFile.connect(self.__showUml)
         self.projectBrowser.binaryFile.connect(self.__openHexEditor)
+        self.projectBrowser.pdfFile.connect(self.__openPdfViewer)
 
         self.project.sourceFile.connect(self.viewmanager.openSourceFile)
         self.project.designerFile.connect(self.__designer)
@@ -517,6 +518,7 @@
             self.browser.svgFile.connect(self.__showSvg)
             self.browser.umlFile.connect(self.__showUml)
             self.browser.binaryFile.connect(self.__openHexEditor)
+            self.browser.pdfFile.connect(self.__openPdfViewer)
             self.browser.testFile.connect(self.__startTestScript)
             self.browser.trpreview.connect(self.__TRPreviewer)
 
@@ -3141,6 +3143,25 @@
         self.snapshotAct.triggered.connect(self.__snapshot)
         self.actions.append(self.snapshotAct)
 
+        self.pdfViewerAct = EricAction(
+            self.tr("eric PDF Viewer"),
+            EricPixmapCache.getIcon("ericPdf"),
+            self.tr("eric PDF &Viewer..."),
+            0,
+            0,
+            self,
+            "pdf_viewer",
+        )
+        self.pdfViewerAct.setStatusTip(self.tr("Start the eric PDF Viewer"))
+        self.pdfViewerAct.setWhatsThis(
+            self.tr(
+                """<b>eric PDF Viewer</b>"""
+                """<p>Starts the eric PDF Viewer for viewing PDF files.</p>"""
+            )
+        )
+        self.pdfViewerAct.triggered.connect(self.__openPdfViewer)
+        self.actions.append(self.pdfViewerAct)
+
         self.prefAct = EricAction(
             self.tr("Preferences"),
             EricPixmapCache.getIcon("configure"),
@@ -4142,6 +4163,7 @@
         toolstb.addAction(self.hexEditorAct)
         toolstb.addAction(self.iconEditorAct)
         toolstb.addAction(self.snapshotAct)
+        toolstb.addAction(self.pdfViewerAct)
         if self.webBrowserAct:
             toolstb.addSeparator()
             toolstb.addAction(self.webBrowserAct)
@@ -5085,6 +5107,7 @@
         btMenu.addAction(self.hexEditorAct)
         btMenu.addAction(self.iconEditorAct)
         btMenu.addAction(self.snapshotAct)
+        btMenu.addAction(self.pdfViewerAct)
         if self.webBrowserAct:
             btMenu.addAction(self.webBrowserAct)
 
@@ -6323,7 +6346,8 @@
         """
         Private slot to open the hex editor window.
 
-        @param fn filename of the file to show (string)
+        @param fn path of the file to show (defaults to "")
+        @type str (optional)
         """
         from eric7.HexEdit.HexEditMainWindow import HexEditMainWindow
 
@@ -6332,11 +6356,26 @@
 
     @pyqtSlot()
     @pyqtSlot(str)
+    def __openPdfViewer(self, fn=""):
+        """
+        Private slot to open the PDF viewer window.
+
+        @param fn path of the file to show (defaults to "")
+        @type str (optional)
+        """
+        from eric7.PdfViewer.PdfViewerWindow import PdfViewerWindow
+
+        dlg = PdfViewerWindow(fn, self, fromEric=True, project=self.project)
+        dlg.show()
+
+    @pyqtSlot()
+    @pyqtSlot(str)
     def __editPixmap(self, fn=""):
         """
         Private slot to show a pixmap in a dialog.
 
-        @param fn filename of the file to show (string)
+        @param fn path of the file to show (defaults to "")
+        @type str (optional)
         """
         from eric7.IconEditor.IconEditorWindow import IconEditorWindow
 
@@ -6349,7 +6388,8 @@
         """
         Private slot to show a pixmap in a dialog.
 
-        @param fn filename of the file to show (string)
+        @param fn path of the file to show (defaults to "")
+        @type str (optional)
         """
         from eric7.Graphics.PixmapDiagram import PixmapDiagram
 
@@ -8153,6 +8193,9 @@
         if self.__helpViewerWidget is not None:
             self.__helpViewerWidget.shutdown()
 
+        if self.microPythonWidget is not None:
+            self.microPythonWidget.shutdown()
+
         self.pluginManager.doShutdown()
 
         if self.SAServer is not None:

eric ide

mercurial