import sys
import argparse

from PyQt4.QtGui import QApplication

from billboard.billboard import Billboard
from billboard.display import BillboardDisplay
from billboard.sources.reddit import RedditSource


def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('-p', '--period', type=int, default=60*15,
                        help='''
                        Period for switching billboard display in seconds.
                        Defaults to 15 minutes.
                        ''')
    return parser.parse_args(sys.argv[1:])


def main():
    args = parse_args()
    app = QApplication(sys.argv)

    display = BillboardDisplay()
    sources = [RedditSource()]

    billboard = Billboard(display, sources, args.period)

    billboard.start()
    display.show()
    app.exec_()


if __name__ == '__main__':
    main()


@@ -20,16 +20,31 @@
 rgparse%0A
+import signal%0A%0A
 %0Afrom Py
@@ -577,24 +577,73 @@
 def main():%0A
+    signal.signal(signal.SIGINT, signal.SIG_DFL)%0A
     args = p

enable CTRL-C