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 PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QTime, QUrl, \ |
14 from PyQt5.QtCore import pyqtSlot, pyqtSignal, PYQT_VERSION, Qt, QTime, QUrl, \ |
15 QStandardPaths, QFileInfo |
15 QStandardPaths, QFileInfo |
16 from PyQt5.QtGui import QPalette, QDesktopServices |
16 from PyQt5.QtGui import QPalette, QDesktopServices |
17 from PyQt5.QtWidgets import QWidget, QStyle, QDialog |
17 from PyQt5.QtWidgets import QWidget, QStyle, QDialog |
18 from PyQt5.QtWebEngineWidgets import QWebEngineDownloadItem |
18 from PyQt5.QtWebEngineWidgets import QWebEngineDownloadItem |
19 |
19 |
128 Private method to get the file name to save to from the user. |
128 Private method to get the file name to save to from the user. |
129 """ |
129 """ |
130 if self.__gettingFileName: |
130 if self.__gettingFileName: |
131 return |
131 return |
132 |
132 |
133 if qVersionTuple() >= (5, 8, 0): |
133 if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800: |
134 savePage = self.__downloadItem.type() == \ |
134 savePage = self.__downloadItem.type() == \ |
135 QWebEngineDownloadItem.SavePage |
135 QWebEngineDownloadItem.SavePage |
136 elif qVersionTuple() >= (5, 7, 0): |
136 elif qVersionTuple() >= (5, 7, 0) and PYQT_VERSION >= 0x50700: |
137 savePage = self.__downloadItem.savePageFormat() != \ |
137 savePage = self.__downloadItem.savePageFormat() != \ |
138 QWebEngineDownloadItem.UnknownSaveFormat |
138 QWebEngineDownloadItem.UnknownSaveFormat |
139 else: |
139 else: |
140 savePage = self.__downloadItem.path().lower().endswith( |
140 savePage = self.__downloadItem.path().lower().endswith( |
141 (".mhtml", ".mht")) |
141 (".mhtml", ".mht")) |