annotate cagou/core/platform_/__init__.py @ 391:841045d5a937

common: when possible, a more user friendly name is displayed for the contact, instead of the jid.
author Goffi <goffi@goffi.org>
date Thu, 06 Feb 2020 21:16:21 +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()