9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 import os |
12 import os |
13 |
13 |
14 from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl |
14 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl |
15 from PyQt4.QtGui import QWidget, QHBoxLayout, QMenu, QToolButton, QPrinter, \ |
15 from PyQt5.QtGui import QIcon |
16 QPrintDialog, QDialog, QIcon |
16 from PyQt5.QtWidgets import QWidget, QHBoxLayout, QMenu, QToolButton, QDialog |
17 from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest |
17 from PyQt5.QtPrintSupport import QPrinter, QPrintDialog |
|
18 from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest |
18 |
19 |
19 from E5Gui.E5TabWidget import E5TabWidget |
20 from E5Gui.E5TabWidget import E5TabWidget |
20 from E5Gui import E5MessageBox |
21 from E5Gui import E5MessageBox |
21 from E5Gui.E5Application import e5App |
22 from E5Gui.E5Application import e5App |
22 |
23 |
543 E5MessageBox.critical( |
544 E5MessageBox.critical( |
544 self, |
545 self, |
545 self.tr("eric5 Web Browser"), |
546 self.tr("eric5 Web Browser"), |
546 self.tr( |
547 self.tr( |
547 """<p>Printing is not available due to a bug in""" |
548 """<p>Printing is not available due to a bug in""" |
548 """ PyQt4. Please upgrade.</p>""")) |
549 """ PyQt5. Please upgrade.</p>""")) |
549 return |
550 return |
550 |
551 |
551 @pyqtSlot() |
552 @pyqtSlot() |
552 def printBrowserPdf(self, browser=None): |
553 def printBrowserPdf(self, browser=None): |
553 """ |
554 """ |
589 E5MessageBox.critical( |
590 E5MessageBox.critical( |
590 self, |
591 self, |
591 self.tr("eric5 Web Browser"), |
592 self.tr("eric5 Web Browser"), |
592 self.tr( |
593 self.tr( |
593 """<p>Printing is not available due to a bug in""" |
594 """<p>Printing is not available due to a bug in""" |
594 """ PyQt4. Please upgrade.</p>""")) |
595 """ PyQt5. Please upgrade.</p>""")) |
595 return |
596 return |
596 |
597 |
597 @pyqtSlot() |
598 @pyqtSlot() |
598 def printPreviewBrowser(self, browser=None): |
599 def printPreviewBrowser(self, browser=None): |
599 """ |
600 """ |
600 Public slot called to show a print preview of the displayed file. |
601 Public slot called to show a print preview of the displayed file. |
601 |
602 |
602 @param browser reference to the browser to be printed (HelpBrowserWV) |
603 @param browser reference to the browser to be printed (HelpBrowserWV) |
603 """ |
604 """ |
604 from PyQt4.QtGui import QPrintPreviewDialog |
605 from PyQt5.QtPrintSupport import QPrintPreviewDialog |
605 |
606 |
606 if browser is None: |
607 if browser is None: |
607 browser = self.currentBrowser() |
608 browser = self.currentBrowser() |
608 |
609 |
609 printer = QPrinter(mode=QPrinter.HighResolution) |
610 printer = QPrinter(mode=QPrinter.HighResolution) |
642 except AttributeError: |
643 except AttributeError: |
643 E5MessageBox.critical( |
644 E5MessageBox.critical( |
644 self, |
645 self, |
645 self.tr("eric5 Web Browser"), |
646 self.tr("eric5 Web Browser"), |
646 self.tr( |
647 self.tr( |
647 """<p>Printing is not available due to a bug in PyQt4.""" |
648 """<p>Printing is not available due to a bug in PyQt5.""" |
648 """Please upgrade.</p>""")) |
649 """Please upgrade.</p>""")) |
649 return |
650 return |
650 |
651 |
651 def __sourceChanged(self, url): |
652 def __sourceChanged(self, url): |
652 """ |
653 """ |