Coverage for /home/antoine/projects/xpra-git/dist/python3/lib64/python/xpra/server/source/stub_source_mixin.py : 100%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# -*- coding: utf-8 -*-
2# This file is part of Xpra.
3# Copyright (C) 2018-2020 Antoine Martin <antoine@xpra.org>
4# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
5# later version. See the file COPYING for details.
7from xpra.util import typedict
9"""
10Base class for client-connection mixins.
11Defines the default interface methods that each mixin may override.
12"""
13class StubSourceMixin:
15 """
16 Is this mixin needed for the caps given?
17 """
18 @classmethod
19 def is_needed(cls, caps : typedict) -> bool:
20 return True
22 def __init__(self, *_args):
23 pass
25 def init_state(self):
26 """
27 Initialize state attributes.
28 """
30 def init_from(self, _protocol, _server):
31 """
32 Initialize setting inherited from the server or connection.
33 """
35 def cleanup(self):
36 """
37 Free up any resources.
38 """
40 def is_closed(self) -> bool:
41 """
42 When the connection is closed or closing, this method returns True.
43 """
44 return False
46 def parse_client_caps(self, c : typedict):
47 """
48 Parse client attributes specified in the hello capabilities.
49 """
51 def get_caps(self) -> dict:
52 """
53 Return the capabilities provided by this mixin.
54 """
55 return {}
57 def get_info(self) -> dict:
58 """
59 Runtime information on this mixin, includes state and settings.
60 Somewhat overlaps with the capabilities,
61 but the data is returned in a structured format. (ie: nested dictionaries)
62 """
63 return {}
65 def user_event(self):
66 """
67 This method is called every time a user action (keyboard, mouse, etc) is being handled.
68 """
70 def may_notify(self, *args, **kwargs):
71 """
72 The actual source implementation will handle these notification requests
73 by forwarding them to the client.
74 This dummy implementation makes it easier to test without a network connection.
75 """
77 def queue_encode(self, item):
78 pass
80 def send_more(self, *parts, **kwargs):
81 pass
83 def send_async(self, *parts, **kwargs):
84 pass