Merge branch 'master' of ssh://tonks/qutebrowser
This commit is contained in:
commit
891c07f7e3
@ -341,6 +341,7 @@ class DownloadItem(QObject):
|
|||||||
return utils.interpolate_color(
|
return utils.interpolate_color(
|
||||||
start, stop, self.stats.percentage(), system)
|
start, stop, self.stats.percentage(), system)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
def cancel(self, remove_data=True):
|
def cancel(self, remove_data=True):
|
||||||
"""Cancel the download.
|
"""Cancel the download.
|
||||||
|
|
||||||
@ -363,6 +364,7 @@ class DownloadItem(QObject):
|
|||||||
self.finished.emit()
|
self.finished.emit()
|
||||||
self.data_changed.emit()
|
self.data_changed.emit()
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
def delete(self):
|
def delete(self):
|
||||||
"""Delete the downloaded file"""
|
"""Delete the downloaded file"""
|
||||||
try:
|
try:
|
||||||
@ -371,12 +373,14 @@ class DownloadItem(QObject):
|
|||||||
except OSError:
|
except OSError:
|
||||||
log.downloads.exception("Failed to remove partial file")
|
log.downloads.exception("Failed to remove partial file")
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
def retry(self):
|
def retry(self):
|
||||||
"""Retry a failed download."""
|
"""Retry a failed download."""
|
||||||
self.cancel()
|
self.cancel()
|
||||||
new_reply = self.retry_info.manager.get(self.retry_info.request)
|
new_reply = self.retry_info.manager.get(self.retry_info.request)
|
||||||
self.do_retry.emit(new_reply)
|
self.do_retry.emit(new_reply)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
def open_file(self):
|
def open_file(self):
|
||||||
"""Open the downloaded file."""
|
"""Open the downloaded file."""
|
||||||
assert self.successful
|
assert self.successful
|
||||||
|
@ -70,21 +70,22 @@ def _missing_str(name, debian=None, arch=None, windows=None, pip=None):
|
|||||||
return '<br /><br />'.join(blocks)
|
return '<br /><br />'.join(blocks)
|
||||||
|
|
||||||
|
|
||||||
def _die(message, exception=True):
|
def _die(message, exception=None):
|
||||||
"""Display an error message using Qt and quit.
|
"""Display an error message using Qt and quit.
|
||||||
|
|
||||||
We import the imports here as we want to do other stuff before the imports.
|
We import the imports here as we want to do other stuff before the imports.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
message: The message to display.
|
message: The message to display.
|
||||||
exception: Whether to print an exception with --debug.
|
exception: The exception object if we're handling an exception.
|
||||||
"""
|
"""
|
||||||
from PyQt5.QtWidgets import QApplication, QMessageBox
|
from PyQt5.QtWidgets import QApplication, QMessageBox
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
if '--debug' in sys.argv and exception:
|
if '--debug' in sys.argv and exception is not None:
|
||||||
print(file=sys.stderr)
|
print(file=sys.stderr)
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
message += '<br/><br/><br/><b>Error:</b><br/>{}'.format(exception)
|
||||||
msgbox = QMessageBox(QMessageBox.Critical, "qutebrowser: Fatal error!",
|
msgbox = QMessageBox(QMessageBox.Critical, "qutebrowser: Fatal error!",
|
||||||
message)
|
message)
|
||||||
msgbox.setTextFormat(Qt.RichText)
|
msgbox.setTextFormat(Qt.RichText)
|
||||||
@ -176,7 +177,7 @@ def check_pyqt_core():
|
|||||||
"""Check if PyQt core is installed."""
|
"""Check if PyQt core is installed."""
|
||||||
try:
|
try:
|
||||||
import PyQt5.QtCore # pylint: disable=unused-variable
|
import PyQt5.QtCore # pylint: disable=unused-variable
|
||||||
except ImportError:
|
except ImportError as e:
|
||||||
text = _missing_str('PyQt5',
|
text = _missing_str('PyQt5',
|
||||||
debian="apt-get install python3-pyqt5 "
|
debian="apt-get install python3-pyqt5 "
|
||||||
"python3-pyqt5.qtwebkit",
|
"python3-pyqt5.qtwebkit",
|
||||||
@ -189,6 +190,7 @@ def check_pyqt_core():
|
|||||||
text = text.replace('<b>', '')
|
text = text.replace('<b>', '')
|
||||||
text = text.replace('</b>', '')
|
text = text.replace('</b>', '')
|
||||||
text = text.replace('<br />', '\n')
|
text = text.replace('<br />', '\n')
|
||||||
|
text += '\n\nError: {}'.format(e)
|
||||||
if tkinter:
|
if tkinter:
|
||||||
root = tkinter.Tk()
|
root = tkinter.Tk()
|
||||||
root.withdraw()
|
root.withdraw()
|
||||||
@ -208,7 +210,7 @@ def check_qt_version():
|
|||||||
if qtutils.version_check('5.2.0', operator.lt):
|
if qtutils.version_check('5.2.0', operator.lt):
|
||||||
text = ("Fatal error: Qt and PyQt >= 5.2.0 are required, but {} is "
|
text = ("Fatal error: Qt and PyQt >= 5.2.0 are required, but {} is "
|
||||||
"installed.".format(qVersion()))
|
"installed.".format(qVersion()))
|
||||||
_die(text, exception=False)
|
_die(text)
|
||||||
|
|
||||||
|
|
||||||
def check_libraries():
|
def check_libraries():
|
||||||
@ -257,8 +259,8 @@ def check_libraries():
|
|||||||
for name, text in modules.items():
|
for name, text in modules.items():
|
||||||
try:
|
try:
|
||||||
importlib.import_module(name)
|
importlib.import_module(name)
|
||||||
except ImportError:
|
except ImportError as e:
|
||||||
_die(text)
|
_die(text, e)
|
||||||
|
|
||||||
|
|
||||||
def remove_inputhook():
|
def remove_inputhook():
|
||||||
|
Loading…
Reference in New Issue
Block a user