Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup signal handlers for SIGINT/TERM exit #46

Merged
merged 1 commit into from
Oct 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion securedrop_client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
import logging
import pathlib
import os
import signal
import sys
from sqlalchemy.orm import sessionmaker
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import Qt
from PyQt5.QtCore import Qt, QTimer
from logging.handlers import TimedRotatingFileHandler
from securedrop_client import __version__
from securedrop_client.logic import Client
Expand Down Expand Up @@ -91,11 +92,24 @@ def run():
app.setDesktopFileName('org.freedomofthepress.securedrop.client')
app.setApplicationVersion(__version__)
app.setAttribute(Qt.AA_UseHighDpiPixmaps)

gui = Window()
app.setWindowIcon(load_icon(gui.icon))
app.setStyleSheet(load_css('sdclient.css'))

Session = sessionmaker(bind=engine)
session = Session()

client = Client("http://localhost:8081/", gui, session)
client.setup()

def signal_handler(*nargs) -> None:
app.quit()

for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, signal_handler)
timer = QTimer()
timer.start(500)
timer.timeout.connect(lambda: None)

sys.exit(app.exec_())