annotate libervia/web/pages/_browser/proxy.py @ 1602:6feac4a25e60

browser: Remote Control implementation: - Add `cbor-x` JS dependency. - In "Call" page, a Remote Control session can now be started. This is done by clicking on a search item 3 dots menu. Libervia Web will act as a controlling device. The call box is then adapted, and mouse/wheel and keyboard events are sent to remote, touch events are converted to mouse one. - Some Brython 3.12* related changes. rel 436
author Goffi <goffi@goffi.org>
date Sat, 11 May 2024 14:02:22 +0200
parents 038d4bfdd967
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1570
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/env python3
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
2
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
3 # Libervia XMPP
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # Copyright (C) 2009-2023 Jérôme Poisson (goffi@goffi.org)
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
5
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # This program is free software: you can redistribute it and/or modify
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # it under the terms of the GNU Affero General Public License as published by
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # the Free Software Foundation, either version 3 of the License, or
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # (at your option) any later version.
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
10
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # This program is distributed in the hope that it will be useful,
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # GNU Affero General Public License for more details.
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
15
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
16 # You should have received a copy of the GNU Affero General Public License
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
18
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
19 class JSProxy:
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
20 def __init__(self):
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
21 self._module = None
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
22
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
23 @property
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
24 def js_module(self):
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
25 return self._module
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
26
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
27 @js_module.setter
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
28 def js_module(self, module):
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
29 if self._module is not None:
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
30 raise Exception("Module is already set!")
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
31 self._module = module
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
32
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
33 def __getattr__(self, name):
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
34 if self._module is None:
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
35 raise RuntimeError("The module has not been loaded yet")
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
36 return getattr(self._module, name)
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
37
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
38 def __call__(self, *args):
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
39 if self._module is None:
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
40 raise RuntimeError("The module has not been loaded yet")
038d4bfdd967 server (tasks/JS modules): add new way to generate modules + support of CSS files
Goffi <goffi@goffi.org>
parents:
diff changeset
41 return self._module(*args)