Mercurial > libervia-desktop-kivy
annotate cagou/core/platform_/__init__.py @ 353:19422bbd9c8e
core (widgets handler): refactoring:
- CagouWidget now has class properties (to be overridden when needed) which indicate how
if the widget handle must add a wrapping ScreenManager (global_screen_manager) or show
all instances of the class in a Carousel (collection_carousel). If none of those
options is used, a ScrollView will be wrapping the widget, to be sure that the widget
will be resized correctly when necessary (without it, the widget could still be
drawn in the backround when the size is too small and overflow on the WidgetWrapper,
this would be the case with WidgetSelector)
- some helper methods/properties have been added to CagouWidget. Check docstrings for
details
- better handling of (in)visible widget in WidgetsHandler
- thanks to the new wrapping ScrollView, WidgetSelect will show scroll bars if the
available space is too small.
- bugs fixes
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 17 Jan 2020 18:44:35 +0100 |
parents | 89799148f894 |
children | 4d660b252487 |
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() |