re: A fix for issue #29.

Rewrote save_file and made a new function (save_html) to accommodate the 
new asnyc toHtml function.
This commit is contained in:
Gitea
2021-02-24 17:43:00 -05:00
parent 20b3f89f2e
commit 3bba4447bb

View File

@@ -153,15 +153,19 @@ class MainWindow(QMainWindow):
self.browser.setHtml(html)
self.urlbar.setText(filename)
def save_html(self, html):
with open(self.save_file, 'w') as f:
f.write(html)
def save_file(self):
filename, _ = QFileDialog.getSaveFileName(self, "Save Page As", "",
"Hypertext Markup Language (*.htm *html);;"
"All files (*.*)")
if filename:
html = self.browser.page().toHtml()
with open(filename, 'w') as f:
f.write(html)
self.save_file = filename
self.browser.page().toHtml(self.save_html)
def print_page(self):
dlg = QPrintPreviewDialog()