mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-26 17:14:42 +00:00
Fix internal error handling in non-main threads.
This commit is contained in:
parent
ccc3039278
commit
e3fb40f753
3 changed files with 10 additions and 3 deletions
|
|
@ -10,6 +10,8 @@ Fixes:
|
|||
- logging: Correctly encode CSV output.
|
||||
Closes: SF bug #3263848
|
||||
- logging: Don't print empty country information.
|
||||
- gui: Don't crash while handling internal error in threads other than
|
||||
the main thread.
|
||||
|
||||
Changes:
|
||||
- gui: Improved display of internal errors.
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class LinkCheckerMain (QtGui.QMainWindow, Ui_MainWindow):
|
|||
|
||||
log_url_signal = QtCore.pyqtSignal(object)
|
||||
log_stats_signal = QtCore.pyqtSignal(object)
|
||||
error_signal = QtCore.pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent=None, url=None):
|
||||
"""Initialize UI."""
|
||||
|
|
@ -119,6 +120,7 @@ class LinkCheckerMain (QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.checker.terminated.connect(set_idle)
|
||||
self.log_url_signal.connect(self.model.log_url)
|
||||
self.log_stats_signal.connect(self.log_stats)
|
||||
self.error_signal.connect(self.internal_error)
|
||||
|
||||
def init_treeview (self):
|
||||
"""Set treeview model and layout."""
|
||||
|
|
@ -376,3 +378,7 @@ Version 2 or later.
|
|||
def log_stats (self, statistics):
|
||||
"""Set statistic information for selected URL."""
|
||||
set_statistics(self, statistics)
|
||||
|
||||
def internal_error (self, msg):
|
||||
"""Display internal error message. Triggered by sys.excepthook()."""
|
||||
QtGui.QMessageBox.warning(self, _(u"LinkChecker internal error"), msg)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
Check HTML pages for broken links. This is the GUI client.
|
||||
"""
|
||||
import sys
|
||||
from PyQt4.QtGui import QApplication, QStyleFactory, QMessageBox
|
||||
from PyQt4.QtGui import QApplication, QStyleFactory
|
||||
from linkcheck.gui import LinkCheckerMain
|
||||
from linkcheck import configuration, drop_privileges, i18n
|
||||
|
||||
|
|
@ -29,8 +29,7 @@ def excepthook (parent, etype, evalue, tb):
|
|||
from linkcheck.director.console import internal_error
|
||||
out = i18n.get_encoded_writer(out=StringIO(), encoding="utf-8")
|
||||
internal_error(out=out, etype=etype, evalue=evalue, tb=tb)
|
||||
QMessageBox.warning(parent, _(u"LinkChecker internal error"),
|
||||
out.getvalue())
|
||||
parent.error_signal.emit(out.getvalue())
|
||||
|
||||
## Look and feel with stylesheets
|
||||
# In Cleanlooks the progress bar text is outside the bar.
|
||||
|
|
|
|||
Loading…
Reference in a new issue