xpra icon
Bug tracker and wiki

Ticket #1838: bases.patch

File bases.patch, 4.1 KB (added by Antoine Martin, 2 years ago)

dynamic list of base classes

  • xpra/server/server_base.py

     
    5555to a specific backend (X11 or otherwise).
    5656See GTKServerBase/X11ServerBase and other platform specific subclasses.
    5757"""
    58 class ServerBase(ServerCore, ServerBaseControlCommands, NotificationForwarder, WebcamServer, ClipboardServer, AudioServer, FilePrintServer, MMAP_Server, InputServer, ChildCommandServer, DBUS_RPC_Server, EncodingServer, LoggingServer, NetworkStateServer, DisplayManager, WindowServer):
     58server_bases = (ServerCore, ServerBaseControlCommands, NotificationForwarder, WebcamServer, ClipboardServer, AudioServer, FilePrintServer, MMAP_Server, InputServer, ChildCommandServer, DBUS_RPC_Server, EncodingServer, LoggingServer, NetworkStateServer, DisplayManager, WindowServer)
     59ServerBaseClass = type('ServerBaseClass', server_bases, {})
    5960
     61class ServerBase(ServerBaseClass):
     62
    6063    def __init__(self):
    61         for c in ServerBase.__bases__:
     64        for c in server_bases:
    6265            c.__init__(self)
    6366        log("ServerBase.__init__()")
    6467        self.init_uuid()
     
    103106        #from now on, use the logger for parsing errors:
    104107        from xpra.scripts import config
    105108        config.warn = log.warn
    106         for c in ServerBase.__bases__:
     109        for c in server_bases:
    107110            c.init(self, opts)
    108111        log("ServerBase.init(%s)", opts)
    109112
     
    115118
    116119    def setup(self):
    117120        log("starting component init")
    118         for c in ServerBase.__bases__:
     121        for c in server_bases:
    119122            c.setup(self)
    120123        thread.start_new_thread(self.threaded_init, ())
    121124
     
    122125    def threaded_init(self):
    123126        log("threaded_init() start")
    124127        sleep(0.1)
    125         for c in ServerBase.__bases__:
     128        for c in server_bases:
    126129            if c!=ServerCore:
    127130                c.threaded_setup(self)
    128131        log("threaded_init() end")
     
    136139    def do_cleanup(self):
    137140        self.server_event("exit")
    138141        self.cancel_mp3_stream_check_timer()
    139         for c in ServerBase.__bases__:
     142        for c in server_bases:
    140143            if c!=ServerCore:
    141144                c.cleanup(self)
    142145
     
    425428                #newer flags:
    426429                "av-sync",
    427430                ))
    428         for c in ServerBase.__bases__:
     431        for c in server_bases:
    429432            if c!=ServerCore:
    430433                merge_dicts(f, c.get_server_features(self, server_source))
    431434        return f
     
    432435
    433436    def make_hello(self, source):
    434437        capabilities = ServerCore.make_hello(self, source)
    435         for c in ServerBase.__bases__:
     438        for c in server_bases:
    436439            if c!=ServerCore:
    437440                merge_dicts(capabilities, c.get_caps(self))
    438441        capabilities["server_type"] = "base"
     
    583586        def up(prefix, d):
    584587            merge_dicts(info, {prefix : d})
    585588
    586         for c in ServerBase.__bases__:
     589        for c in server_bases:
    587590            try:
    588591                merge_dicts(info, c.get_info(self, proto))
    589592            except Exception as e:
     
    788791    ######################################################################
    789792    # client connections:
    790793    def init_sockets(self, sockets):
    791         for c in ServerBase.__bases__:
     794        for c in server_bases:
    792795            c.init_sockets(self, sockets)
    793796
    794797    def cleanup_protocol(self, protocol):
     
    806809                del self._server_sources[protocol]
    807810            except:
    808811                pass
    809         for c in ServerBase.__bases__:
     812        for c in server_bases:
    810813            c.cleanup_protocol(self, protocol)
    811814        return source
    812815
     
    869872    ######################################################################
    870873    # packets:
    871874    def init_packet_handlers(self):
    872         for c in ServerBase.__bases__:
     875        for c in server_bases:
    873876            c.init_packet_handlers(self)
    874877        self._authenticated_packet_handlers.update({
    875878            "set-cursors":                          self._process_set_cursors,