comparison cagou/backport/__init__.py @ 323:5bd583d00594

backport: added a new "backport" module for using unreleased code from Kivy: Carousel has been backported from Kivy 2.0, because a couple of bugs hitting Cagou are fixed there (notably https://github.com/kivy/kivy/issues/6370). The issue was specially visible when sliding chat widgets. If a version >= 2.0 of kivy is used, a warning will be displayed to indicated that the backport can be removed.
author Goffi <goffi@goffi.org>
date Fri, 06 Dec 2019 13:23:03 +0100
parents
children 4d660b252487
comparison
equal deleted inserted replaced
322:e2b51663d8b8 323:5bd583d00594
1 #!/usr/bin/env python3
2
3 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
4 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
15
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 import kivy
20 from sat.core import log as logging
21
22
23 log = logging.getLogger(__name__)
24
25
26 def do_backport():
27 version = tuple(kivy.parse_kivy_version(kivy.__version__)[0])
28 if version < (2, 0, 0):
29 log.info("installing backport for Carousel")
30 import sys
31 from kivy.uix import carousel # NOQA
32 from . import carousel as carousel_backport
33 sys.modules['kivy.uix.carousel'] = carousel_backport
34 else:
35 log.info("Kivy >= 2.0.0 is used, Carousel backport is not needed anymore")