annotate cagou/core/platform_/__init__.py @ 425:13884aac1220

chat: show images in attachments: - if an image is received from somebody in roster, it is automatically displayed (we display only for people in roster to avoid IP address leak) - encrypted files are decrypted and stored in cache before being displayed - GIFs image are shown as attachment because they are badly handle in Kivy (images frequencies is not handled correctly, and memory consumption explode). Instead, a click on it will open the GIF in the appropriate software of the platform. - a click on an attachment image will open it in the gallery
author Goffi <goffi@goffi.org>
date Wed, 26 Feb 2020 16:47:39 +0100
parents 4d660b252487
children 3c9ba4a694ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
342
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
1 #!/usr/bin/env python3
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
2
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
3 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
378
4d660b252487 dates update
Goffi <goffi@goffi.org>
parents: 342
diff changeset
4 # Copyright (C) 2016-2020 Jérôme Poisson (goffi@goffi.org)
342
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
5
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
6 # This program is free software: you can redistribute it and/or modify
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
7 # it under the terms of the GNU Affero General Public License as published by
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
8 # the Free Software Foundation, either version 3 of the License, or
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
9 # (at your option) any later version.
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
10
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
11 # This program is distributed in the hope that it will be useful,
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
14 # GNU Affero General Public License for more details.
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
15
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
16 # You should have received a copy of the GNU Affero General Public License
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
18
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
19 from kivy import utils as kivy_utils
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
20
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
21
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
22 def create():
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
23 """Factory method to create the platform instance adapted to running one"""
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
24 if kivy_utils.platform == "android":
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
25 from .android import Platform
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
26 return Platform()
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
27 else:
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
28 from .base import Platform
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
29 return Platform()