annotate cagou/backport/__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 5bd583d00594
children 4d660b252487
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
323
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/env python3
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
2
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
3 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
5
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # This program is free software: you can redistribute it and/or modify
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # it under the terms of the GNU Affero General Public License as published by
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # the Free Software Foundation, either version 3 of the License, or
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # (at your option) any later version.
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
10
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # This program is distributed in the hope that it will be useful,
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # GNU Affero General Public License for more details.
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
15
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
16 # You should have received a copy of the GNU Affero General Public License
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
18
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
19 import kivy
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
20 from sat.core import log as logging
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
21
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
22
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
23 log = logging.getLogger(__name__)
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
24
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
25
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
26 def do_backport():
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
27 version = tuple(kivy.parse_kivy_version(kivy.__version__)[0])
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 if version < (2, 0, 0):
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
29 log.info("installing backport for Carousel")
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
30 import sys
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
31 from kivy.uix import carousel # NOQA
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
32 from . import carousel as carousel_backport
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
33 sys.modules['kivy.uix.carousel'] = carousel_backport
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
34 else:
5bd583d00594 backport: added a new "backport" module for using unreleased code from Kivy:
Goffi <goffi@goffi.org>
parents:
diff changeset
35 log.info("Kivy >= 2.0.0 is used, Carousel backport is not needed anymore")