annotate cagou/core/menu.py @ 210:f1ee7a8cf77c

install (setup.py): added missing ".kv" files to package_data
author Goffi <goffi@goffi.org>
date Fri, 25 May 2018 13:29:28 +0200
parents c7d15ef4bfa8
children e42e0c45d384
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
126
cd99f70ea592 global file reorganisation:
Goffi <goffi@goffi.org>
parents: 98
diff changeset
5 # Copyright (C) 2016-2018 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 log = logging.getLogger(__name__)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
24 from cagou.core.constants import Const as C
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
25 from cagou.core.common import JidToggle
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
26 from kivy.uix.boxlayout import BoxLayout
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
27 from kivy.uix.label import Label
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 from kivy.uix.popup import Popup
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
29 from cagou.core.utils import FilterBehavior
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
30 from kivy import properties
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
31 from kivy.garden import contextmenu
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
32 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
33 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
34 from kivy.animation import Animation
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
35 from kivy.metrics import dp
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
36 from cagou import G
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
37 import webbrowser
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
38
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
39 ABOUT_TITLE = _(u"About {}".format(C.APP_NAME))
184
c63922860f80 chat: show desktop notification and/or note when suitable
Goffi <goffi@goffi.org>
parents: 173
diff changeset
40 ABOUT_CONTENT = _(u"""Cagou (Salut à Toi) v{version}
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
41
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
42 Cagou is a libre communication tool based on libre standard XMPP.
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
43
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
44 Cagou is part of the "Salut à Toi" project
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
45 more informations at [color=5500ff][ref=website]salut-a-toi.org[/ref][/color]
184
c63922860f80 chat: show desktop notification and/or note when suitable
Goffi <goffi@goffi.org>
parents: 173
diff changeset
46 """).format(version=C.APP_VERSION)
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
47
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
48
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
49 class AboutContent(Label):
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 def on_ref_press(self, value):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
52 if value == "website":
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
53 webbrowser.open("https://salut-a-toi.org")
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
54
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
55
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
56 class AboutPopup(Popup):
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 def on_touch_down(self, touch):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
59 if self.collide_point(*touch.pos):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
60 self.dismiss()
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
61 return super(AboutPopup, self).on_touch_down(touch)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
62
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
63
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
64 class MainMenu(contextmenu.AppMenu):
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
65 pass
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
66
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
67
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
68 class MenuItem(contextmenu.ContextMenuTextItem):
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
69 item = properties.ObjectProperty()
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
70
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
71 def on_item(self, instance, item):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
72 self.text = item.name
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
73
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
74 def on_release(self):
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
75 super(MenuItem, self).on_release()
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
76 self.parent.hide()
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
77 selected = G.host.selected_widget
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
78 profile = None
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
79 if selected is not None:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
80 try:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
81 profile = selected.profile
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
82 except AttributeError:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
83 pass
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
84
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
85 if profile is None:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
86 try:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
87 profile = list(selected.profiles)[0]
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
88 except (AttributeError, IndexError):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
89 try:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
90 profile = list(G.host.profiles)[0]
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
91 except IndexError:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
92 log.warning(u"Can't find profile")
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
93 self.item.call(selected, profile)
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
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
96 class MenuSeparator(contextmenu.ContextMenuDivider):
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
97 pass
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
98
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
99
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
100 class RootMenuContainer(contextmenu.AppMenuTextItem):
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
101 pass
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
102
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
103
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
104 class MenuContainer(contextmenu.ContextMenuTextItem):
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
105 pass
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
106
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
107
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
108 class MenusWidget(BoxLayout):
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
109
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
110 def update(self, type_, caller=None):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
111 """Method to call when menus have changed
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 @param type_(unicode): menu type like in sat.core.sat_main.importMenu
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
114 @param caller(Widget): instance linked to the menus
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
115 """
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
116 self.menus_container = G.host.menus.getMainContainer(type_)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
117 self.createMenus(caller)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
118
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
119 def _buildMenus(self, container, caller=None):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
120 """Recursively build menus of the container
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
121
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
122 @param container(quick_menus.MenuContainer): menu container
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
123 @param caller(Widget): instance linked to the menus
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
124 """
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
125 if caller is None:
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
126 main_menu = MainMenu()
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
127 self.add_widget(main_menu)
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
128 caller = main_menu
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
129 else:
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
130 context_menu = contextmenu.ContextMenu()
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
131 caller.add_widget(context_menu)
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
132 # FIXME: next line is needed after parent is set to avoid a display bug in contextmenu
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
133 # TODO: fix this upstream
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
134 context_menu._on_visible(False)
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
135
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
136 caller = context_menu
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
137
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
138 for child in container.getActiveMenus():
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
139 if isinstance(child, quick_menus.MenuContainer):
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
140 if isinstance(caller, MainMenu):
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
141 menu_container = RootMenuContainer()
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
142 else:
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 53
diff changeset
143 menu_container = MenuContainer()
51
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
144 menu_container.text = child.name
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
145 caller.add_widget(menu_container)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
146 self._buildMenus(child, caller=menu_container)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
147 elif isinstance(child, quick_menus.MenuSeparator):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
148 wid = MenuSeparator()
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
149 caller.add_widget(wid)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
150 elif isinstance(child, quick_menus.MenuItem):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
151 wid = MenuItem(item=child)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
152 caller.add_widget(wid)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
153 else:
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
154 log.error(u"Unknown child type: {}".format(child))
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
155
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
156 def createMenus(self, caller):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
157 self.clear_widgets()
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
158 self._buildMenus(self.menus_container, caller)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
159
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
160 def onAbout(self):
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
161 about = AboutPopup()
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
162 about.title = ABOUT_TITLE
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
163 about.content = AboutContent(text=ABOUT_CONTENT, markup=True)
3f8599d9a766 core: menus first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
164 about.open()
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
165
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
166
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
167 class TransferItem(BoxLayout):
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
168 plug_info = properties.DictProperty()
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
169
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
170 def on_touch_up(self, touch):
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
171 if not self.collide_point(*touch.pos):
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
172 return super(TransferItem, self).on_touch_up(touch)
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
173 else:
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
174 transfer_menu = self.parent
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
175 while not isinstance(transfer_menu, TransferMenu):
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
176 transfer_menu = transfer_menu.parent
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
177 transfer_menu.do_callback(self.plug_info)
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
178 return True
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
179
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
180
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
181 class SideMenu(BoxLayout):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
182 base_size_hint_close = (0, 1)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
183 base_size_hint_open = (0.4, 1)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
184 bg_color = properties.ListProperty([0, 0, 0, 1])
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
185 # callback will be called with arguments relevant to menu
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
186 callback = properties.ObjectProperty()
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
187 # call do_callback even when menu is cancelled
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
188 callback_on_close = properties.BooleanProperty(False)
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
189 # cancel callback need to remove the widget for UI
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
190 # will be called with the widget to remove as argument
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
191 cancel_cb = properties.ObjectProperty()
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
192
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
193 def __init__(self, **kwargs):
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
194 super(SideMenu, self).__init__(**kwargs)
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
195 if self.cancel_cb is None:
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
196 self.cancel_cb = self.onMenuCancelled
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
197
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
198 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
199 Window.bind(on_keyboard=self.key_input)
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
200 G.host.app.root.add_widget(self)
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
201 Animation(size_hint=self.base_size_hint_open, d=0.3, t='out_back').start(self)
168
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
202
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
203 def hide(self):
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
204 Window.unbind(on_keyboard=self.key_input)
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
205 anim = Animation(size_hint=self.base_size_hint_close, d=0.2)
168
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
206 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
207 anim.start(self)
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
208 if self.callback_on_close:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
209 self.do_callback()
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
210
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
211 def on_touch_down(self, touch):
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
212 # we remove the menu if we click outside
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
213 # 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
214 # transmit it to parents
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
215 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
216 self.hide()
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
217 else:
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
218 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
219 return True
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
220
168
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
221 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
222 if key == 27:
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
223 self.hide()
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
224 return True
397f2fb67aab core (menu): animate transfer menu opening/closing + close it on [ESC]/back
Goffi <goffi@goffi.org>
parents: 126
diff changeset
225
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
226 def onMenuCancelled(self, wid, cleaning_cb=None):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
227 self._closeUI(wid)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
228 if cleaning_cb is not None:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
229 cleaning_cb()
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
230
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
231 def _closeUI(self, wid):
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
232 G.host.closeUI()
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
233
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
234 def do_callback(self, *args, **kwargs):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
235 log.warning(u"callback not implemented")
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
236
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
237
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
238 class TransferMenu(SideMenu):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
239 """transfer menu which handle display and callbacks"""
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
240 # callback will be called with path to file to transfer
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
241 # 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
242 profiles = properties.ObjectProperty()
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
243 transfer_txt = _(u"Beware! The file will be sent to your server and stay unencrypted there\nServer admin(s) can see the file, and they choose how, when and if it will be deleted")
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
244 send_txt = _(u"The file will be sent unencrypted directly to your contact (without transiting by the server), except in some cases")
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
245 items_layout = properties.ObjectProperty()
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
246 base_size_hint_close = (1, 0)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
247 base_size_hint_open = (1, 0.5)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
248
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
249 def __init__(self, **kwargs):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
250 super(TransferMenu, self).__init__(**kwargs)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
251 if self.profiles is None:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
252 self.profiles = iter(G.host.profiles)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
253 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
254 item = TransferItem(
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
255 plug_info = plug_info
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
256 )
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
257 self.items_layout.add_widget(item)
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
258
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
259 def do_callback(self, plug_info):
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
260 self.parent.remove_widget(self)
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
261 if self.callback is None:
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
262 log.warning(u"TransferMenu callback is not set")
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
263 else:
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 85
diff changeset
264 wid = None
88
3dc526bb4a5a upload: plugin android gallery, first draft:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
265 external = plug_info.get('external', False)
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
266 def onTransferCb(file_path, cleaning_cb=None):
88
3dc526bb4a5a upload: plugin android gallery, first draft:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
267 if not external:
3dc526bb4a5a upload: plugin android gallery, first draft:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
268 self._closeUI(wid)
98
4d8c122b86a6 menu (upload): send transfer (i.e. P2P transfer) is now working
Goffi <goffi@goffi.org>
parents: 97
diff changeset
269 self.callback(
4d8c122b86a6 menu (upload): send transfer (i.e. P2P transfer) is now working
Goffi <goffi@goffi.org>
parents: 97
diff changeset
270 file_path,
4d8c122b86a6 menu (upload): send transfer (i.e. P2P transfer) is now working
Goffi <goffi@goffi.org>
parents: 97
diff changeset
271 cleaning_cb,
4d8c122b86a6 menu (upload): send transfer (i.e. P2P transfer) is now working
Goffi <goffi@goffi.org>
parents: 97
diff changeset
272 transfer_type = C.TRANSFER_UPLOAD if self.ids['upload_btn'].state == "down" else C.TRANSFER_SEND)
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 88
diff changeset
273 wid = plug_info['factory'](plug_info, onTransferCb, self.cancel_cb, self.profiles)
88
3dc526bb4a5a upload: plugin android gallery, first draft:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
274 if not external:
3dc526bb4a5a upload: plugin android gallery, first draft:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
275 G.host.showExtraUI(wid)
197
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
276
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 class EntitiesSelectorMenu(SideMenu, FilterBehavior):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
279 """allow to select entities from roster"""
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
280 profiles = properties.ObjectProperty()
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
281 layout = properties.ObjectProperty()
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
282 instructions = properties.StringProperty(_(u"Please select entities"))
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
283 filter_input = properties.ObjectProperty()
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
284
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
285 def __init__(self, **kwargs):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
286 super(EntitiesSelectorMenu, self).__init__(**kwargs)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
287 self.filter_input.bind(text=self.do_filter_input)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
288 if self.profiles is None:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
289 self.profiles = iter(G.host.profiles)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
290 for profile in self.profiles:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
291 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
292 jid_wid = JidToggle(
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
293 jid=jid_,
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
294 profile=profile)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
295 self.layout.add_widget(jid_wid)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
296
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
297 def do_callback(self):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
298 if self.callback is not None:
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
299 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
300 self.callback(jids)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
301
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
302 def do_filter_input(self, filter_input, text):
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
303 self.layout.spacing = 0 if text else dp(5)
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
304 self.do_filter(self.layout.children,
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
305 text,
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
306 lambda c: c.jid,
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
307 width_cb=lambda c: c.width,
c7d15ef4bfa8 core (menu): new EntitiesSelectorMenu:
Goffi <goffi@goffi.org>
parents: 184
diff changeset
308 height_cb=lambda c: dp(70))