Mercurial > libervia-web
annotate libervia/web/pages/calendar/page_meta.py @ 1553:83c2a6faa2ae
browser (calls): screen sharing implementation:
- the new screen sharing button toggle screen sharing state
- the button reflect the screen sharing state (green crossed when not sharing, red
uncrossed otherwise)
- the screen sharing stream replaces the camera one, and vice versa. No re-negociation is
needed.
- stopping the sharing through browser's dialog is supported
- the screen sharing button is only visibile if supported by the platform
rel 432
| author | Goffi <goffi@goffi.org> |
|---|---|
| date | Mon, 14 Aug 2023 16:49:02 +0200 |
| parents | eb00d593801d |
| children | 08342aca8c1e |
| rev | line source |
|---|---|
|
1508
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
|
1518
eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
4 from libervia.backend.core.i18n import _ |
|
eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
5 from libervia.backend.core.log import getLogger |
|
eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
6 from libervia.backend.tools.common import data_format |
|
1508
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 from twisted.internet import defer |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 import datetime |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 import time |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 from dateutil import tz |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
|
1518
eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
12 from libervia.web.server.constants import Const as C |
|
1508
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 log = getLogger(__name__) |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 name = "calendar" |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 access = C.PAGES_ACCESS_PROFILE |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 template = "calendar/daily.html" |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 async def prepare_render(self, request): |
|
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1508
diff
changeset
|
23 profile = self.get_profile(request) |
|
1508
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 template_data = request.template_data |
|
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1508
diff
changeset
|
25 # template_data["url_event_new"] = self.get_sub_page_url(request, "event_new") |
|
1508
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 if profile is not None: |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 try: |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 events = data_format.deserialise( |
|
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1508
diff
changeset
|
29 await self.host.bridge_call("events_get", "", "", [], "", profile), |
|
1508
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 type_check=list |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 ) |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 except Exception as e: |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 log.warning(_("Can't get events list for {profile}: {reason}").format( |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 profile=profile, reason=e)) |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 else: |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 template_data["events"] = events |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 tz_name = template_data["tz_name"] = time.tzname[0] |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 local_tz = tz.tzlocal() |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 today_local = datetime.datetime.now(local_tz).date() |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 calendar_start = template_data["calendar_start"] = datetime.datetime.combine( |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 today_local, datetime.time.min, tzinfo=local_tz |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 ).timestamp() |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 calendar_end = template_data["calendar_end"] = datetime.datetime.combine( |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 today_local, datetime.time.max, tzinfo=local_tz |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 ).timestamp() |
|
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1508
diff
changeset
|
47 self.expose_to_scripts( |
|
1508
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 request, |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 calendar_start=calendar_start, |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 calendar_end=calendar_end, |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 tz_name=tz_name, |
|
ec3ad9abf9f9
pages (calendar): calendar page, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 ) |
