WebBrowser/Download/DownloadItem.py

branch
maintenance
changeset 5752
1860eca908e4
parent 5576
c866ec38662d
parent 5736
000ea446ff4b
child 5948
6f958d5765f4
equal deleted inserted replaced
5731:54829a44cea5 5752:1860eca908e4
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, qVersion, Qt, QTime, QUrl, \ 14 from PyQt5.QtCore import pyqtSlot, pyqtSignal, 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
25 from WebBrowser.WebBrowserWindow import WebBrowserWindow 25 from WebBrowser.WebBrowserWindow import WebBrowserWindow
26 26
27 import UI.PixmapCache 27 import UI.PixmapCache
28 import Utilities.MimeTypes 28 import Utilities.MimeTypes
29 import Globals 29 import Globals
30 from Globals import qVersionTuple
30 31
31 32
32 class DownloadItem(QWidget, Ui_DownloadItem): 33 class DownloadItem(QWidget, Ui_DownloadItem):
33 """ 34 """
34 Class implementing a widget controlling a download. 35 Class implementing a widget controlling a download.
127 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.
128 """ 129 """
129 if self.__gettingFileName: 130 if self.__gettingFileName:
130 return 131 return
131 132
132 if qVersion() >= "5.8.0": 133 if qVersionTuple() >= (5, 8, 0):
133 savePage = self.__downloadItem.type() == \ 134 savePage = self.__downloadItem.type() == \
134 QWebEngineDownloadItem.SavePage 135 QWebEngineDownloadItem.SavePage
135 elif qVersion() >= "5.7.0": 136 elif qVersionTuple() >= (5, 7, 0):
136 savePage = self.__downloadItem.savePageFormat() != \ 137 savePage = self.__downloadItem.savePageFormat() != \
137 QWebEngineDownloadItem.UnknownSaveFormat 138 QWebEngineDownloadItem.UnknownSaveFormat
138 else: 139 else:
139 savePage = self.__downloadItem.path().lower().endswith( 140 savePage = self.__downloadItem.path().lower().endswith(
140 (".mhtml", ".mht")) 141 (".mhtml", ".mht"))

eric ide

mercurial