annotate cagou/core/menu.py @ 327:b77792cc6d12

use Kivy garden's new infrastructure for modernmenu and contextmenu: dependencies are updated, the legacy kivy-garden tool is not needed anymore, thus installation is simplified.
author Goffi <goffi@goffi.org>
date Wed, 11 Dec 2019 18:26:42 +0100
parents e2b51663d8b8
children 9c6fe392d623
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/python
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
282
1b835bcfa663 date update
Goffi <goffi@goffi.org>
parents: 246
diff changeset
5 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # (at your option) any later version.
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
19
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
20
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
21 from sat.core.i18n import _
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 from sat.core import log as logging
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
23 from cagou.core.constants import Const as C
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
24 from cagou.core.common import JidToggle
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
25 from kivy.uix.boxlayout import BoxLayout
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
26 from kivy.uix.label import Label
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
27 from kivy.uix.popup import Popup
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
28 from cagou.core.utils import FilterBehavior
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
29 from kivy import properties
327
b77792cc6d12 use Kivy garden's new infrastructure for modernmenu and contextmenu:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
30 from kivy_garden import contextmenu, modernmenu
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
31 from sat_frontends.quick_frontend import quick_menus
168
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
32 from kivy.core.window import Window
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
33 from kivy.animation import Animation
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
34 from kivy.metrics import dp
222
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
35 from kivy.clock import Clock
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
36 from cagou import G
222
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
37 from functools import partial
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
38 import webbrowser
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
39
302
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
40 log = logging.getLogger(__name__)
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
41
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
42 ABOUT_TITLE = _("About {}".format(C.APP_NAME))
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
43 ABOUT_CONTENT = _("""[b]Cagou (Salut à Toi)[/b]
302
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
44
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
45 [u]cagou version[/u]:
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
46 {version}
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
47
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
48 [u]backend version[/u]:
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
49 {backend_version}
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
50
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
51 Cagou is a libre communication tool based on libre standard XMPP.
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
52
302
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
53 Cagou is part of the "Salut à Toi" project (desktop/mobile frontend)
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
54 more informations at [color=5500ff][ref=website]salut-a-toi.org[/ref][/color]
246
15e47bbb192c about: show full version of SàT
Goffi <goffi@goffi.org>
parents: 222
diff changeset
55 """)
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
56
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
57
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
58 class AboutContent(Label):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
59
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
60 def on_ref_press(self, value):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
61 if value == "website":
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
62 webbrowser.open("https://salut-a-toi.org")
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
63
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
64
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
65 class AboutPopup(Popup):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
66
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
67 def on_touch_down(self, touch):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
68 if self.collide_point(*touch.pos):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
69 self.dismiss()
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
70 return super(AboutPopup, self).on_touch_down(touch)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
71
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
72
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
73 class MainMenu(contextmenu.AppMenu):
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
74 pass
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
75
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
76
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
77 class MenuItem(contextmenu.ContextMenuTextItem):
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
78 item = properties.ObjectProperty()
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
79
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
80 def on_item(self, instance, item):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
81 self.text = item.name
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
82
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
83 def on_release(self):
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
84 super(MenuItem, self).on_release()
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
85 self.parent.hide()
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
86 selected = G.host.selected_widget
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
87 profile = None
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
88 if selected is not None:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
89 try:
222
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
90 # FIXME: handle multi-profiles
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
91 profile = next(iter(selected.profiles))
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
92 except AttributeError:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
93 pass
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
94
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
95 if profile is None:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
96 try:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
97 profile = list(selected.profiles)[0]
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
98 except (AttributeError, IndexError):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
99 try:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
100 profile = list(G.host.profiles)[0]
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
101 except IndexError:
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
102 log.warning("Can't find profile")
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
103 self.item.call(selected, profile)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
104
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
105
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
106 class MenuSeparator(contextmenu.ContextMenuDivider):
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
107 pass
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
108
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
109
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
110 class RootMenuContainer(contextmenu.AppMenuTextItem):
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
111 pass
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
112
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
113
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
114 class MenuContainer(contextmenu.ContextMenuTextItem):
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
115 pass
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
116
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
117
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
118 class MenusWidget(BoxLayout):
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
119
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
120 def update(self, type_, caller=None):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
121 """Method to call when menus have changed
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
122
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
123 @param type_(unicode): menu type like in sat.core.sat_main.importMenu
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
124 @param caller(Widget): instance linked to the menus
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
125 """
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
126 self.menus_container = G.host.menus.getMainContainer(type_)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
127 self.createMenus(caller)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
128
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
129 def _buildMenus(self, container, caller=None):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
130 """Recursively build menus of the container
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
131
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
132 @param container(quick_menus.MenuContainer): menu container
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
133 @param caller(Widget): instance linked to the menus
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
134 """
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
135 if caller is None:
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
136 main_menu = MainMenu()
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
137 self.add_widget(main_menu)
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
138 caller = main_menu
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
139 else:
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
140 context_menu = contextmenu.ContextMenu()
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
141 caller.add_widget(context_menu)
222
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
142 # FIXME: next line is needed after parent is set to avoid
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
143 # a display bug in contextmenu
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
144 # TODO: fix this upstream
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
145 context_menu._on_visible(False)
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
146
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
147 caller = context_menu
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
148
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
149 for child in container.getActiveMenus():
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
150 if isinstance(child, quick_menus.MenuContainer):
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
151 if isinstance(caller, MainMenu):
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
152 menu_container = RootMenuContainer()
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
153 else:
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
154 menu_container = MenuContainer()
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
155 menu_container.text = child.name
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
156 caller.add_widget(menu_container)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
157 self._buildMenus(child, caller=menu_container)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
158 elif isinstance(child, quick_menus.MenuSeparator):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
159 wid = MenuSeparator()
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
160 caller.add_widget(wid)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
161 elif isinstance(child, quick_menus.MenuItem):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
162 wid = MenuItem(item=child)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
163 caller.add_widget(wid)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
164 else:
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
165 log.error("Unknown child type: {}".format(child))
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
166
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
167 def createMenus(self, caller):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
168 self.clear_widgets()
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
169 self._buildMenus(self.menus_container, caller)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
170
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
171 def onAbout(self):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
172 about = AboutPopup()
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
173 about.title = ABOUT_TITLE
302
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
174 about.content = AboutContent(
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
175 text=ABOUT_CONTENT.format(
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
176 backend_version = G.host.backend_version,
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
177 version=G.host.version),
f55b60659ec1 core (about): improved "about" popup:
Goffi <goffi@goffi.org>
parents: 282
diff changeset
178 markup=True)
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
179 about.open()
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
180
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
181
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
182 class TransferItem(BoxLayout):
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
183 plug_info = properties.DictProperty()
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
184
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
185 def on_touch_up(self, touch):
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
186 if not self.collide_point(*touch.pos):
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
187 return super(TransferItem, self).on_touch_up(touch)
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
188 else:
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
189 transfer_menu = self.parent
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
190 while not isinstance(transfer_menu, TransferMenu):
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
191 transfer_menu = transfer_menu.parent
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
192 transfer_menu.do_callback(self.plug_info)
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
193 return True
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
194
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
195
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
196 class SideMenu(BoxLayout):
216
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
197 size_hint_close = (0, 1)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
198 size_hint_open = (0.4, 1)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
199 size_close = (100, 100)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
200 size_open = (0, 0)
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
201 bg_color = properties.ListProperty([0, 0, 0, 1])
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
202 # callback will be called with arguments relevant to menu
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
203 callback = properties.ObjectProperty()
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
204 # call do_callback even when menu is cancelled
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
205 callback_on_close = properties.BooleanProperty(False)
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
206 # cancel callback need to remove the widget for UI
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
207 # will be called with the widget to remove as argument
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
208 cancel_cb = properties.ObjectProperty()
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
209
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
210 def __init__(self, **kwargs):
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
211 super(SideMenu, self).__init__(**kwargs)
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
212 if self.cancel_cb is None:
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
213 self.cancel_cb = self.onMenuCancelled
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
214
216
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
215 def _set_anim_kw(self, kw, size_hint, size):
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
216 """Set animation keywords
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
217
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
218 for each value of size_hint it is used if not None,
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
219 else size is used.
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
220 If one value of size is bigger than the respective one of Window
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
221 the one of Window is used
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
222 """
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
223 size_hint_x, size_hint_y = size_hint
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
224 width, height = size
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
225 if size_hint_x is not None:
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
226 kw['size_hint_x'] = size_hint_x
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
227 elif width is not None:
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
228 kw['width'] = min(width, Window.width)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
229
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
230 if size_hint_y is not None:
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
231 kw['size_hint_y'] = size_hint_y
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
232 elif height is not None:
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
233 kw['height'] = min(height, Window.height)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
234
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
235 def show(self, caller_wid=None):
168
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
236 Window.bind(on_keyboard=self.key_input)
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
237 G.host.app.root.add_widget(self)
216
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
238 kw = {'d': 0.3, 't': 'out_back'}
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
239 self._set_anim_kw(kw, self.size_hint_open, self.size_open)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
240 Animation(**kw).start(self)
168
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
241
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
242 def hide(self):
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
243 Window.unbind(on_keyboard=self.key_input)
216
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
244 kw = {'d': 0.2}
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
245 self._set_anim_kw(kw, self.size_hint_close, self.size_close)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
246 anim = Animation(**kw)
168
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
247 anim.bind(on_complete=lambda anim, menu: self.parent.remove_widget(self))
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
248 anim.start(self)
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
249 if self.callback_on_close:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
250 self.do_callback()
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
251
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
252 def on_touch_down(self, touch):
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
253 # we remove the menu if we click outside
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
254 # else we want to handle the event, but not
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
255 # transmit it to parents
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
256 if not self.collide_point(*touch.pos):
168
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
257 self.hide()
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
258 else:
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
259 return super(SideMenu, self).on_touch_down(touch)
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
260 return True
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
261
168
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
262 def key_input(self, window, key, scancode, codepoint, modifier):
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
263 if key == 27:
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
264 self.hide()
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
265 return True
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
266
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
267 def onMenuCancelled(self, wid, cleaning_cb=None):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
268 self._closeUI(wid)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
269 if cleaning_cb is not None:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
270 cleaning_cb()
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
271
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
272 def _closeUI(self, wid):
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
273 G.host.closeUI()
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
274
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
275 def do_callback(self, *args, **kwargs):
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
276 log.warning("callback not implemented")
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
277
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
278
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
279 class TransferMenu(SideMenu):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
280 """transfer menu which handle display and callbacks"""
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
281 # callback will be called with path to file to transfer
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
282 # profiles if set will be sent to transfer widget, may be used to get specific files
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
283 profiles = properties.ObjectProperty()
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
284 transfer_txt = _("Beware! The file will be sent to your server and stay unencrypted "
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
285 "there\nServer admin(s) can see the file, and they choose how, "
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
286 "when and if it will be deleted")
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
287 send_txt = _("The file will be sent unencrypted directly to your contact "
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
288 "(without transiting by the server), except in some cases")
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
289 items_layout = properties.ObjectProperty()
216
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
290 size_hint_close = (1, 0)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
291 size_hint_open = (1, 0.5)
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
292
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
293 def __init__(self, **kwargs):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
294 super(TransferMenu, self).__init__(**kwargs)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
295 if self.profiles is None:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
296 self.profiles = iter(G.host.profiles)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
297 for plug_info in G.host.getPluggedWidgets(type_=C.PLUG_TYPE_TRANSFER):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
298 item = TransferItem(
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
299 plug_info = plug_info
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
300 )
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
301 self.items_layout.add_widget(item)
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
302
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
303 def do_callback(self, plug_info):
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
304 self.parent.remove_widget(self)
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
305 if self.callback is None:
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
306 log.warning("TransferMenu callback is not set")
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
307 else:
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
308 wid = None
88
3dc526bb4a5a upload: plugin android gallery, first draft:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
309 external = plug_info.get('external', False)
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
310 def onTransferCb(file_path, cleaning_cb=None):
88
3dc526bb4a5a upload: plugin android gallery, first draft:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
311 if not external:
3dc526bb4a5a upload: plugin android gallery, first draft:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
312 self._closeUI(wid)
98
4d8c122b86a6 menu (upload): send transfer (i.e. P2P transfer) is now working
Goffi <goffi@goffi.org>
parents: 97
diff changeset
313 self.callback(
4d8c122b86a6 menu (upload): send transfer (i.e. P2P transfer) is now working
Goffi <goffi@goffi.org>
parents: 97
diff changeset
314 file_path,
222
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
315 transfer_type = (C.TRANSFER_UPLOAD
322
e2b51663d8b8 core, android: new share widget + added Cagou to "share" menu:
Goffi <goffi@goffi.org>
parents: 312
diff changeset
316 if self.ids['upload_btn'].state == "down" else C.TRANSFER_SEND),
e2b51663d8b8 core, android: new share widget + added Cagou to "share" menu:
Goffi <goffi@goffi.org>
parents: 312
diff changeset
317 cleaning_cb=cleaning_cb,
e2b51663d8b8 core, android: new share widget + added Cagou to "share" menu:
Goffi <goffi@goffi.org>
parents: 312
diff changeset
318 )
222
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
319 wid = plug_info['factory'](plug_info,
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
320 onTransferCb,
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
321 self.cancel_cb,
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
322 self.profiles)
88
3dc526bb4a5a upload: plugin android gallery, first draft:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
323 if not external:
3dc526bb4a5a upload: plugin android gallery, first draft:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
324 G.host.showExtraUI(wid)
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
325
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
326
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
327 class EntitiesSelectorMenu(SideMenu, FilterBehavior):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
328 """allow to select entities from roster"""
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
329 profiles = properties.ObjectProperty()
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
330 layout = properties.ObjectProperty()
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 302
diff changeset
331 instructions = properties.StringProperty(_("Please select entities"))
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
332 filter_input = properties.ObjectProperty()
216
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
333 size_hint_close = (None, 1)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
334 size_hint_open = (None, 1)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
335 size_open = (dp(250), 100)
e42e0c45d384 core (menu): allow to specify size in SideMenu:
Goffi <goffi@goffi.org>
parents: 197
diff changeset
336 size_close = (0, 100)
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
337
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
338 def __init__(self, **kwargs):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
339 super(EntitiesSelectorMenu, self).__init__(**kwargs)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
340 self.filter_input.bind(text=self.do_filter_input)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
341 if self.profiles is None:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
342 self.profiles = iter(G.host.profiles)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
343 for profile in self.profiles:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
344 for jid_, jid_data in G.host.contact_lists[profile].all_iter:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
345 jid_wid = JidToggle(
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
346 jid=jid_,
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
347 profile=profile)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
348 self.layout.add_widget(jid_wid)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
349
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
350 def do_callback(self):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
351 if self.callback is not None:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
352 jids = [c.jid for c in self.layout.children if c.state == 'down']
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
353 self.callback(jids)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
354
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
355 def do_filter_input(self, filter_input, text):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
356 self.layout.spacing = 0 if text else dp(5)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
357 self.do_filter(self.layout.children,
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
358 text,
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
359 lambda c: c.jid,
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
360 width_cb=lambda c: c.width,
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
361 height_cb=lambda c: dp(70))
222
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
362
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
363
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
364 class TouchMenu(modernmenu.ModernMenu):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
365 pass
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
366
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
367
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
368 class TouchMenuItemBehaviour(object):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
369 """Class to use on every item where a menu may appear
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
370
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
371 main_wid attribute must be set to the class inheriting from TouchMenuBehaviour
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
372 do_item_action is the method called on simple click
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
373 getMenuChoices must return a list of menus for long press
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
374 menus there are dict as expected by ModernMenu
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
375 (translated text, index and callback)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
376 """
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
377 main_wid = properties.ObjectProperty()
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
378 click_timeout = properties.NumericProperty(0.4)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
379
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
380 def on_touch_down(self, touch):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
381 if not self.collide_point(*touch.pos):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
382 return
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
383 t = partial(self.open_menu, touch)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
384 touch.ud['menu_timeout'] = t
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
385 Clock.schedule_once(t, self.click_timeout)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
386 return super(TouchMenuItemBehaviour, self).on_touch_down(touch)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
387
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
388 def do_item_action(self, touch):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
389 pass
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
390
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
391 def on_touch_up(self, touch):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
392 if touch.ud.get('menu_timeout'):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
393 Clock.unschedule(touch.ud['menu_timeout'])
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
394 if self.collide_point(*touch.pos) and self.main_wid.menu is None:
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
395 self.do_item_action(touch)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
396 return super(TouchMenuItemBehaviour, self).on_touch_up(touch)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
397
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
398 def open_menu(self, touch, dt):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
399 self.main_wid.open_menu(self, touch)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
400 del touch.ud['menu_timeout']
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
401
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
402 def getMenuChoices(self):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
403 """return choice adapted to selected item
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
404
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
405 @return (list[dict]): choices ad expected by ModernMenu
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
406 """
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
407 return []
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
408
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
409
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
410 class TouchMenuBehaviour(object):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
411 """Class to handle a menu appearing on long press on items
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
412
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
413 classes using this behaviour need to have a float_layout property
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
414 pointing the main FloatLayout.
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
415 """
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
416 float_layout = properties.ObjectProperty()
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
417
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
418 def __init__(self, *args, **kwargs):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
419 super(TouchMenuBehaviour, self).__init__(*args, **kwargs)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
420 self.menu = None
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
421 self.menu_item = None
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
422
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
423 ## menu methods ##
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
424
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
425 def clean_fl_children(self, layout, children):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
426 """insure that self.menu and self.menu_item are None when menu is dimissed"""
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
427 if self.menu is not None and self.menu not in children:
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
428 self.menu = self.menu_item = None
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
429
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
430 def clear_menu(self):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
431 """remove menu if there is one"""
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
432 if self.menu is not None:
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
433 self.menu.dismiss()
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
434 self.menu = None
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
435 self.menu_item = None
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
436
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
437 def open_menu(self, item, touch):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
438 """open menu for item
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
439
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
440 @param item(PathWidget): item when the menu has been requested
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
441 @param touch(kivy.input.MotionEvent): touch data
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
442 """
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
443 if self.menu_item == item:
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
444 return
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
445 self.clear_menu()
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
446 pos = self.to_widget(*touch.pos)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
447 choices = item.getMenuChoices()
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
448 if not choices:
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
449 return
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
450 self.menu = TouchMenu(choices=choices,
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
451 center=pos,
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
452 size_hint=(None, None))
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
453 self.float_layout.add_widget(self.menu)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
454 self.menu.start_display(touch)
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
455 self.menu_item = item
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
456
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
457 def on_float_layout(self, wid, float_layout):
a676cb07c1cb core (menu): TouchMenuBehaviour:
Goffi <goffi@goffi.org>
parents: 216
diff changeset
458 float_layout.bind(children=self.clean_fl_children)