#! /usr/bin/python3 # coding: utf-8 # Asynchronous Music Player Daemon client library for Python # Copyright (C) 2015 Itaï BEN YAACOV # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . from gi.repository import GLib, Gio import signal import sys class App(Gio.Application): def __init__(self): super(App, self).__init__() self.connect('activate', lambda *args: None) self.register(None) def __del__(self): print("Deleting {}".format(self)) for sig in sys.argv[1:]: print("Adding phoney {} source".format(sig)) handle = GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, getattr(signal, sig), lambda: True) GLib.source_remove(handle) App().run()