本文整理匯總了Python中xpra.os_util.SIGNAMES.get方法的典型用法代碼示例。如果您正苦於以下問題:Python SIGNAMES.get方法的具體用法?Python SIGNAMES.get怎麽用?Python SIGNAMES.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xpra.os_util.SIGNAMES
的用法示例。
在下文中一共展示了SIGNAMES.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: signal_quit
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def signal_quit(self, signum, frame):
log.info("")
log.info("proxy process pid %s got signal %s, exiting", os.getpid(), SIGNAMES.get(signum, signum))
self.exit = True
signal.signal(signal.SIGINT, deadly_signal)
signal.signal(signal.SIGTERM, deadly_signal)
self.stop(SIGNAMES.get(signum, signum))
示例2: app_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def app_signal(signum, frame):
sys.stderr.write("\ngot signal %s, exiting\n" % SIGNAMES.get(signum, signum))
sys.stderr.flush()
signal.signal(signal.SIGINT, deadly_signal)
signal.signal(signal.SIGTERM, deadly_signal)
self.signal_cleanup()
self.timeout_add(0, self.signal_disconnect_and_quit, 128 + signum, "exit on signal %s" % SIGNAMES.get(signum, signum))
示例3: signal_quit
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def signal_quit(self, signum, frame):
log.info("")
log.info("got signal %s, exiting", SIGNAMES.get(signum, signum))
signal.signal(signal.SIGINT, deadly_signal)
signal.signal(signal.SIGTERM, deadly_signal)
self.idle_add(self.clean_quit)
self.idle_add(sys.exit, 128 + signum)
示例4: deadly_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def deadly_signal(sig, frame):
log.warn("got deadly signal %s", SIGNAMES.get(sig, sig))
glib.idle_add(ss.stop)
glib.idle_add(glib_mainloop.quit)
def force_quit(sig, frame):
sys.exit()
signal.signal(signal.SIGINT, force_quit)
signal.signal(signal.SIGTERM, force_quit)
示例5: signal_quit
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def signal_quit(self, signum, frame):
sys.stdout.write("\n")
sys.stdout.flush()
self._closing = True
log.info("got signal %s, exiting", SIGNAMES.get(signum, signum))
signal.signal(signal.SIGINT, deadly_signal)
signal.signal(signal.SIGTERM, deadly_signal)
self.idle_add(self.clean_quit)
self.idle_add(sys.exit, 128+signum)
示例6: app_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def app_signal(signum, frame):
print("")
log("got signal %s" % SIGNAMES.get(signum, signum))
def show_signal():
app.show()
app.client.cleanup()
glib.timeout_add(1000, app.set_info_text, "got signal %s" % SIGNAMES.get(signum, signum))
glib.timeout_add(1000, app.set_info_color, True)
#call from UI thread:
glib.idle_add(show_signal)
示例7: handle_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def handle_signal(self, sig, frame):
""" This is for OS signals SIGINT and SIGTERM """
#next time, just stop:
signal.signal(signal.SIGINT, self.signal_stop)
signal.signal(signal.SIGTERM, self.signal_stop)
signame = SIGNAMES.get(sig, sig)
log("handle_signal(%s, %s) calling stop from main thread", signame, frame)
self.send("signal", signame)
self.cleanup()
#give time for the network layer to send the signal message
gobject.timeout_add(150, self.stop)
示例8: deadly_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def deadly_signal(signum, frame):
sys.stdout.write("got deadly signal %s, exiting\n" % SIGNAMES.get(signum, signum))
sys.stdout.flush()
run_cleanups()
# This works fine in tests, but for some reason if I use it here, then I
# get bizarre behavior where the signal handler runs, and then I get a
# KeyboardException (?!?), and the KeyboardException is handled normally
# and exits the program (causing the cleanup handlers to be run again):
#signal.signal(signum, signal.SIG_DFL)
#kill(os.getpid(), signum)
os._exit(128 + signum)
示例9: handle_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def handle_signal(self, sig, frame):
""" This is for OS signals SIGINT and SIGTERM """
#next time, just stop:
signal.signal(signal.SIGINT, self.signal_stop)
signal.signal(signal.SIGTERM, self.signal_stop)
signame = SIGNAMES.get(sig, sig)
try:
log("handle_signal(%s, %s) calling stop from main thread", signame, frame)
except:
pass #may fail if we were doing IO logging when the signal was received
self.send("signal", signame)
self.timeout_add(0, self.cleanup)
#give time for the network layer to send the signal message
self.timeout_add(150, self.stop)
示例10: deadly_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def deadly_signal(signum, frame):
sys.stderr.write("\ngot deadly signal %s, exiting\n" % SIGNAMES.get(signum, signum))
sys.stderr.flush()
self.cleanup()
os._exit(128 + signum)
示例11: signal_stop
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def signal_stop(self, sig, frame):
""" This time we really want to exit without waiting """
signame = SIGNAMES.get(sig, sig)
log("signal_stop(%s, %s) calling stop", signame, frame)
self.stop()
示例12: show_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def show_signal():
app.show()
app.client.cleanup()
glib.timeout_add(1000, app.set_info_text, "got signal %s" % SIGNAMES.get(signum, signum))
glib.timeout_add(1000, app.set_info_color, True)
示例13: app_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def app_signal(signum, frame):
sys.stderr.write("\ngot signal %s, exiting\n" % SIGNAMES.get(signum, signum))
sys.stderr.flush()
signal.signal(signal.SIGINT, deadly_signal)
signal.signal(signal.SIGTERM, deadly_signal)
self.timeout_add(0, self.quit, 128 + signum)
示例14: app_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def app_signal(signum, frame):
print("")
log.info("got signal %s", SIGNAMES.get(signum, signum))
app.quit()
示例15: deadly_signal
# 需要導入模塊: from xpra.os_util import SIGNAMES [as 別名]
# 或者: from xpra.os_util.SIGNAMES import get [as 別名]
def deadly_signal(sig, frame):
log.warn("got deadly signal %s", SIGNAMES.get(sig, sig))
gobject.idle_add(ss.stop)
gobject.idle_add(gobject_mainloop.quit)