Mercurial > libervia-backend
annotate sat/bridge/bridge_constructor/constructors/pb/pb_core_template.py @ 3078:95c94d94872d
quick frontend(chat): store filters used with initial historyGet
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 18 Nov 2019 22:34:13 +0100 |
parents | a1bc34f90fa5 |
children | 9d0df638c8b4 |
rev | line source |
---|---|
3028 | 1 #!/usr/bin/env python3 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
2 # -*- coding: utf-8 -*- |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # SAT: a jabber client |
2771 | 5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org) |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 |
3039
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
21 import dataclasses |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 from sat.core.log import getLogger |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 from twisted.spread import jelly, pb |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 from twisted.internet import reactor |
3039
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
25 |
2818
9a7cb32836c6
bridge (pb): minor import order change
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
26 log = getLogger(__name__) |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 ## jelly hack |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 # we monkey patch jelly to handle namedtuple |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 ori_jelly = jelly._Jellier.jelly |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
33 |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 def fixed_jelly(self, obj): |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 """this method fix handling of namedtuple""" |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 if isinstance(obj, tuple) and not obj is tuple: |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 obj = tuple(obj) |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 return ori_jelly(self, obj) |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
40 |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 jelly._Jellier.jelly = fixed_jelly |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 |
3039
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
44 @dataclasses.dataclass(eq=False) |
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
45 class HandlerWrapper: |
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
46 # we use a wrapper to keep signals handlers because RemoteReference doesn't support |
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
47 # comparison (other than equality), making it unusable with a list |
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
48 handler: pb.RemoteReference |
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
49 |
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
50 |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 class PBRoot(pb.Root): |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 def __init__(self): |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 self.signals_handlers = [] |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 def remote_initBridge(self, signals_handler): |
3039
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
56 self.signals_handlers.append(HandlerWrapper(signals_handler)) |
3028 | 57 log.info("registered signal handler") |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 |
3039
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
59 def sendSignalEb(self, failure_, signal_name): |
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
60 if not failure_.check(pb.PBConnectionLost): |
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
61 log.error( |
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
62 f"Error while sending signal {signal_name}: {failure_}", |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
63 ) |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 def sendSignal(self, name, args, kwargs): |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 to_remove = [] |
3039
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
67 for wrapper in self.signals_handlers: |
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
68 handler = wrapper.handler |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 try: |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 d = handler.callRemote(name, *args, **kwargs) |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 except pb.DeadReferenceError: |
3039
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
72 to_remove.append(wrapper) |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 else: |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 d.addErrback(self.sendSignalEb, name) |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 if to_remove: |
3039
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
76 for wrapper in to_remove: |
3028 | 77 log.debug("Removing signal handler for dead frontend") |
3039
a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
78 self.signals_handlers.remove(wrapper) |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 |
2840
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
80 def _bridgeDeactivateSignals(self): |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
81 if hasattr(self, "signals_paused"): |
3028 | 82 log.warning("bridge signals already deactivated") |
2840
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
83 if self.signals_handler: |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
84 self.signals_paused.extend(self.signals_handler) |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
85 else: |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
86 self.signals_paused = self.signals_handlers |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
87 self.signals_handlers = [] |
3028 | 88 log.debug("bridge signals have been deactivated") |
2840
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
89 |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
90 def _bridgeReactivateSignals(self): |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
91 try: |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
92 self.signals_handlers = self.signals_paused |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
93 except AttributeError: |
3028 | 94 log.debug("signals were already activated") |
2840
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
95 else: |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
96 del self.signals_paused |
3028 | 97 log.debug("bridge signals have been reactivated") |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
98 |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 ##METHODS_PART## |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 class Bridge(object): |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 def __init__(self): |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 log.info("Init Perspective Broker...") |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 self.root = PBRoot() |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 reactor.listenTCP(8789, pb.PBServerFactory(self.root)) |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 def sendSignal(self, name, *args, **kwargs): |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 self.root.sendSignal(name, args, kwargs) |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 def remote_initBridge(self, signals_handler): |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 self.signals_handlers.append(signals_handler) |
3028 | 113 log.info("registered signal handler") |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 def register_method(self, name, callback): |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 log.debug("registering PB bridge method [%s]" % name) |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
117 setattr(self.root, "remote_" + name, callback) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
118 # self.root.register_method(name, callback) |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 |
3028 | 120 def addMethod(self, name, int_suffix, in_sign, out_sign, method, async_=False, doc={}): |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 """Dynamically add a method to PB Bridge""" |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
122 # FIXME: doc parameter is kept only temporary, the time to remove it from calls |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 log.debug("Adding method {name} to PB bridge".format(name=name)) |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 self.register_method(name, method) |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 def addSignal(self, name, int_suffix, signature, doc={}): |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 log.debug("Adding signal {name} to PB bridge".format(name=name)) |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
128 setattr( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
129 self, name, lambda *args, **kwargs: self.sendSignal(name, *args, **kwargs) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
130 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
131 |
2840
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
132 def bridgeDeactivateSignals(self): |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
133 """Stop sending signals to bridge |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
134 |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
135 Mainly used for mobile frontends, when the frontend is paused |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
136 """ |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
137 self.root._bridgeDeactivateSignals() |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
138 |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
139 def bridgeReactivateSignals(self): |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
140 """Send again signals to bridge |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
141 |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
142 Should only be used after bridgeDeactivateSignals has been called |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
143 """ |
0f277708e2ae
bridge (pb): added bridgeDeactivateSignals and bridgeReactivateSignals methods:
Goffi <goffi@goffi.org>
parents:
2818
diff
changeset
|
144 self.root._bridgeReactivateSignals() |
2092
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
145 |
5e79ba00c1e2
bridbe(pb): Perspective Broker bridge, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
146 ##SIGNALS_PART## |