Remove default values in MHTMLWriter.__init__
This commit is contained in:
parent
e5bfb9884b
commit
d3a21927f2
@ -139,8 +139,7 @@ class MHTMLWriter():
|
|||||||
|
|
||||||
BOUNDARY = "---=_qute-" + str(uuid.uuid4())
|
BOUNDARY = "---=_qute-" + str(uuid.uuid4())
|
||||||
|
|
||||||
def __init__(self, root_content=None, content_location=None,
|
def __init__(self, root_content, content_location, content_type):
|
||||||
content_type=None):
|
|
||||||
self.root_content = root_content
|
self.root_content = root_content
|
||||||
self.content_location = content_location
|
self.content_location = content_location
|
||||||
self.content_type = content_type
|
self.content_type = content_type
|
||||||
@ -227,7 +226,7 @@ class _Downloader():
|
|||||||
def __init__(self, web_view, dest):
|
def __init__(self, web_view, dest):
|
||||||
self.web_view = web_view
|
self.web_view = web_view
|
||||||
self.dest = dest
|
self.dest = dest
|
||||||
self.writer = MHTMLWriter()
|
self.writer = None
|
||||||
self.loaded_urls = {web_view.url()}
|
self.loaded_urls = {web_view.url()}
|
||||||
self.pending_downloads = set()
|
self.pending_downloads = set()
|
||||||
self._finished = False
|
self._finished = False
|
||||||
@ -245,12 +244,14 @@ class _Downloader():
|
|||||||
web_url = self.web_view.url()
|
web_url = self.web_view.url()
|
||||||
web_frame = self.web_view.page().mainFrame()
|
web_frame = self.web_view.page().mainFrame()
|
||||||
|
|
||||||
self.writer.root_content = web_frame.toHtml().encode("utf-8")
|
self.writer = MHTMLWriter(
|
||||||
self.writer.content_location = web_url.toString()
|
web_frame.toHtml().encode("utf-8"),
|
||||||
# I've found no way of getting the content type of a QWebView, but
|
content_location = web_url.toString(),
|
||||||
# since we're using .toHtml, it's probably safe to say that the
|
# I've found no way of getting the content type of a QWebView, but
|
||||||
# content-type is HTML
|
# since we're using .toHtml, it's probably safe to say that the
|
||||||
self.writer.content_type = 'text/html; charset="UTF-8"'
|
# content-type is HTML
|
||||||
|
content_type = 'text/html; charset="UTF-8"',
|
||||||
|
)
|
||||||
# Currently only downloading <link> (stylesheets), <script>
|
# Currently only downloading <link> (stylesheets), <script>
|
||||||
# (javascript) and <img> (image) elements.
|
# (javascript) and <img> (image) elements.
|
||||||
elements = (web_frame.findAllElements("link") +
|
elements = (web_frame.findAllElements("link") +
|
||||||
|
Loading…
Reference in New Issue
Block a user