diff -r 669dabfa1319 -r cdaa3cc805f7 src/eric7/UI/UserInterface.py --- a/src/eric7/UI/UserInterface.py Thu Jan 12 14:01:40 2023 +0100 +++ b/src/eric7/UI/UserInterface.py Thu Jan 12 18:08:12 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