def set_signal_handlers(app): gobject = import_gobject() def deadly_signal(signum, frame): print("got deadly signal %s, exiting" % SIGNAMES.get(signum, signum)) app.cleanup() os._exit(128 + signum) def app_signal(signum, frame): print("\ngot signal %s, exiting" % SIGNAMES.get(signum, signum)) signal.signal(signal.SIGINT, deadly_signal) signal.signal(signal.SIGTERM, deadly_signal) gobject.timeout_add(0, app.quit, 128 + signum, priority=gobject.PRIORITY_HIGH) signal.signal(signal.SIGINT, app_signal) signal.signal(signal.SIGTERM, app_signal)
# This file is part of Parti. # Copyright (C) 2011 Serviware (Arthur Huillet, <*****@*****.**>) # Copyright (C) 2010-2012 Antoine Martin <*****@*****.**> # Copyright (C) 2008, 2010 Nathaniel Smith <*****@*****.**> # Parti is released under the terms of the GNU GPL v2, or, at your option, any # later version. See the file COPYING for details. #pygtk3 vs pygtk2 (sigh) from wimpiggy.gobject_compat import import_gobject, import_gtk, import_gdk, is_gtk3 gobject = import_gobject() gtk = import_gtk() gdk = import_gdk() if is_gtk3(): def get_root_size(): return gdk.get_default_root_window().get_geometry()[2:] def set_windows_cursor(gtkwindows, new_cursor): pass #window.override_cursor(cursor, None) else: def get_root_size(): return gdk.get_default_root_window().get_size() def set_windows_cursor(gtkwindows, new_cursor): cursor = None if len(new_cursor) > 0: (_, _, w, h, xhot, yhot, serial, pixels) = new_cursor log.debug(
# This file is part of Parti. # Copyright (C) 2008, 2009 Nathaniel Smith <*****@*****.**> # Parti is released under the terms of the GNU GPL v2, or, at your option, any # later version. See the file COPYING for details. import traceback import sys from wimpiggy.gobject_compat import import_gobject gobject = import_gobject() class AutoPropGObjectMixin(object): """Mixin for automagic property support in GObjects. Make sure this is the first entry on your parent list, so super().__init__ will work right.""" def __init__(self): super(AutoPropGObjectMixin, self).__init__() self._gproperties = {} def _munge_property_name(self, name): return name.replace("-", "_") def do_get_property(self, pspec): getter = "do_get_property_" + self._munge_property_name(pspec.name) if hasattr(self, getter): return getattr(self, getter)(pspec.name) return self._gproperties.get(pspec.name) def do_set_property(self, pspec, value): self._internal_set_property(pspec.name, value)
import socket import time from optparse import OptionParser, OptionGroup import logging from subprocess import Popen, PIPE import signal import xpra from xpra.dotxpra import DotXpra from xpra.platform import (XPRA_LOCAL_SERVERS_SUPPORTED, DEFAULT_SSH_CMD, GOT_PASSWORD_PROMPT_SUGGESTION, add_client_options) from xpra.protocol import TwoFileConnection, SocketConnection from wimpiggy.gobject_compat import import_gobject, is_gtk3 import_gobject() try: import Image assert Image _has_PIL = True except: _has_PIL = False ENCODINGS = [] if is_gtk3(): """ with gtk3, we get png via cairo out of the box but we need PIL for the others: """ ENCODINGS.append("png") if _has_PIL: ENCODINGS.append("jpeg") ENCODINGS.append("rgb24")
from optparse import OptionParser, OptionGroup import logging from subprocess import Popen, PIPE import signal import shlex import xpra from xpra.dotxpra import DotXpra from xpra.platform import (XPRA_LOCAL_SERVERS_SUPPORTED, DEFAULT_SSH_CMD, GOT_PASSWORD_PROMPT_SUGGESTION, add_client_options) from xpra.bytestreams import TwoFileConnection, SocketConnection from wimpiggy.gobject_compat import import_gobject, is_gtk3 import_gobject() try: import Image assert Image _has_PIL = True except: _has_PIL = False ENCODINGS = [] if is_gtk3(): """ with gtk3, we get png via cairo out of the box but we need PIL for the others: """ ENCODINGS.append("png") if _has_PIL: ENCODINGS.append("jpeg") ENCODINGS.append("rgb24")