mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-25 08:34:43 +00:00
Close application on Ctrl-C.
This commit is contained in:
parent
d99be8aa86
commit
e3b6bfad09
2 changed files with 10 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
Changes:
|
||||
- gui: Print detected module information in about dialog.
|
||||
- gui: Close application on Ctrl-C.
|
||||
|
||||
|
||||
6.7 "Friendship" (released 12.4.2011)
|
||||
|
|
|
|||
|
|
@ -19,10 +19,12 @@
|
|||
Check HTML pages for broken links. This is the GUI client.
|
||||
"""
|
||||
import sys
|
||||
import signal
|
||||
from PyQt4.QtGui import QApplication
|
||||
from linkcheck.gui import LinkCheckerMain, get_app_style
|
||||
from linkcheck import configuration, drop_privileges, i18n
|
||||
|
||||
|
||||
def excepthook (window, etype, evalue, tb):
|
||||
"""Catch unhandled exceptions."""
|
||||
from cStringIO import StringIO
|
||||
|
|
@ -33,6 +35,12 @@ def excepthook (window, etype, evalue, tb):
|
|||
window.error_signal.emit(out.getvalue())
|
||||
|
||||
|
||||
def sigint_handler(*args):
|
||||
"""Handler for the SIGINT signal."""
|
||||
sys.stderr.write('\r')
|
||||
QApplication.quit()
|
||||
|
||||
|
||||
def main (argv=None):
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
|
|
@ -46,6 +54,7 @@ def main (argv=None):
|
|||
url = app.argv()[1]
|
||||
else:
|
||||
url = u""
|
||||
signal.signal(signal.SIGINT, sigint_handler)
|
||||
# use local variable here to avoid garbage collection of the main
|
||||
# window before app.exec_() finishes
|
||||
window = LinkCheckerMain(url=url)
|
||||
|
|
|
|||
Loading…
Reference in a new issue