mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Smoothly quit when Ctrl-C is pressed
This commit is contained in:
parent
dbae501689
commit
5bc8e0a5e5
@ -18,7 +18,11 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
import os, sys, platform, argparse
|
import os
|
||||||
|
import sys
|
||||||
|
import platform
|
||||||
|
import argparse
|
||||||
|
import signal
|
||||||
from .widgets import Alert
|
from .widgets import Alert
|
||||||
from PyQt5 import QtCore, QtWidgets
|
from PyQt5 import QtCore, QtWidgets
|
||||||
|
|
||||||
@ -58,6 +62,10 @@ def main():
|
|||||||
strings.load_strings(common)
|
strings.load_strings(common)
|
||||||
print(strings._('version_string').format(common.version))
|
print(strings._('version_string').format(common.version))
|
||||||
|
|
||||||
|
# Allow Ctrl-C to smoothly quit the program instead of throwing an exception
|
||||||
|
# https://stackoverflow.com/questions/42814093/how-to-handle-ctrlc-in-python-app-with-pyqt
|
||||||
|
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||||
|
|
||||||
# Start the Qt app
|
# Start the Qt app
|
||||||
global qtapp
|
global qtapp
|
||||||
qtapp = Application(common)
|
qtapp = Application(common)
|
||||||
|
Loading…
Reference in New Issue
Block a user