annotate cagou/core/platform_/__init__.py @ 356:307c2501d8b2

chat: keep as many instances of opened chat as there are active WHWrapper, instead of just one: Chat instances can be shown on any WHWrapper, even in all at the same time, so we keep as many instances as active wrapper to avoid unnecessary widget (re)creation
author Goffi <goffi@goffi.org>
date Fri, 17 Jan 2020 20:35:57 +0100
parents 89799148f894
children 4d660b252487
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
89799148f894 core: use classes and factory to handle platform specific behaviours in a generic way
Goffi <goffi@goffi.org>
parents: 322
diff changeset
4 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
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()