mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-09 23:24:44 +00:00
Set GUI exception handler.
This commit is contained in:
parent
48c3343e8b
commit
91bfcef252
1 changed files with 13 additions and 1 deletions
|
|
@ -19,10 +19,19 @@
|
||||||
Check HTML pages for broken links. This is the GUI client.
|
Check HTML pages for broken links. This is the GUI client.
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
from PyQt4.QtGui import QApplication, QStyleFactory
|
from PyQt4.QtGui import QApplication, QStyleFactory, QErrorMessage
|
||||||
from linkcheck.gui import LinkCheckerMain
|
from linkcheck.gui import LinkCheckerMain
|
||||||
from linkcheck import configuration, drop_privileges
|
from linkcheck import configuration, drop_privileges
|
||||||
|
|
||||||
|
def excepthook (etype, evalue, tb):
|
||||||
|
"""Catch unhandled exceptions."""
|
||||||
|
from cStringIO import StringIO
|
||||||
|
from PyQt4.QtCore import qWarning
|
||||||
|
from linkcheck.director.console import internal_error
|
||||||
|
out = StringIO()
|
||||||
|
internal_error(out=out, etype=etype, evalue=evalue, tb=tb)
|
||||||
|
qWarning(out.getvalue())
|
||||||
|
|
||||||
## Look and feel with stylesheets
|
## Look and feel with stylesheets
|
||||||
# In Cleanlooks the progress bar text is outside the bar.
|
# In Cleanlooks the progress bar text is outside the bar.
|
||||||
# Use Plastique instead.
|
# Use Plastique instead.
|
||||||
|
|
@ -32,6 +41,7 @@ Style = "Plastique"
|
||||||
def main (argv=None):
|
def main (argv=None):
|
||||||
if argv is None:
|
if argv is None:
|
||||||
argv = sys.argv
|
argv = sys.argv
|
||||||
|
sys.excepthook = excepthook
|
||||||
app = QApplication(argv)
|
app = QApplication(argv)
|
||||||
app.setApplicationName(configuration.AppName)
|
app.setApplicationName(configuration.AppName)
|
||||||
app.setApplicationVersion(configuration.Version)
|
app.setApplicationVersion(configuration.Version)
|
||||||
|
|
@ -45,6 +55,8 @@ def main (argv=None):
|
||||||
window = LinkCheckerMain(url=url)
|
window = LinkCheckerMain(url=url)
|
||||||
window.show()
|
window.show()
|
||||||
drop_privileges()
|
drop_privileges()
|
||||||
|
handler = QErrorMessage.qtHandler()
|
||||||
|
handler.setMinimumSize(600, 400)
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue