annotate cagou/kv/dialog.kv @ 365:9c6fe392d623

core (widgets_handler): use a StencilView + BoxLayout instead of ScrollView as wrapper: The default wrapping when no Carousel or ScreenManager was used was a ScrollView. This was causing bugs as the touch event is not propagated correctly when a ScrollView is in children of ScrollView (notably causing trouble with ModernMenu on ContactList and FileSharing widgets). To avoid that, a simple StencilView with BoxLayout is now used instead. If a ScrollView is needed, it can be added inside the widget (this is the case for WidgetSelector).
author Goffi <goffi@goffi.org>
date Mon, 27 Jan 2020 21:17:08 +0100
parents 1b835bcfa663
children 3c9ba4a694ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
203
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
1 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
282
1b835bcfa663 date update
Goffi <goffi@goffi.org>
parents: 243
diff changeset
2 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
203
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
3
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # This program is free software: you can redistribute it and/or modify
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
5 # it under the terms of the GNU Affero General Public License as published by
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # the Free Software Foundation, either version 3 of the License, or
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # (at your option) any later version.
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
8
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # This program is distributed in the hope that it will be useful,
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # GNU Affero General Public License for more details.
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
13
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # You should have received a copy of the GNU Affero General Public License
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
16
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
17 #:import _ sat.core.i18n._
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
18
243
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
19
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
20 <MessageDialog>:
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
21 orientation: "vertical"
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
22 spacing: dp(5)
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
23 canvas.before:
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
24 Color:
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
25 rgba: 0, 0, 0, 1
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
26 Rectangle:
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
27 pos: self.pos
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
28 size: self.size
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
29 Label:
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
30 size_hint: 1, None
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
31 text_size: root.width, None
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
32 size: self.texture_size
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
33 font_size: sp(20)
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
34 padding: dp(5), dp(10)
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
35 color: 1, 1, 1, 1
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
36 text: root.title
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
37 halign: "center"
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
38 italic: True
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
39 bold: True
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
40 Label:
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
41 text: root.message
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
42 text_size: root.width, None
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
43 size: self.texture_size
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
44 padding: dp(25), 0
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
45 font_size: sp(20)
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
46 color: 1, 1, 1, 1
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
47 Button:
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
48 size_hint: 1, None
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
49 height: dp(50)
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
50 background_color: 0.33, 1.0, 0.0, 1
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
51 text: _("Close")
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
52 bold: True
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
53 on_release: root.close_cb()
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
54
50f7c000b4ae xmlui: implemented MessageDialog
Goffi <goffi@goffi.org>
parents: 226
diff changeset
55
203
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
56 <ConfirmDialog>:
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
57 orientation: "vertical"
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
58 spacing: dp(5)
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
59 canvas.before:
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
60 Color:
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
61 rgba: 0, 0, 0, 1
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
62 Rectangle:
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
63 pos: self.pos
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
64 size: self.size
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
65 Label:
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
66 size_hint: 1, None
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
67 text_size: root.width, None
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
68 size: self.texture_size
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
69 font_size: sp(20)
226
1abd9d694e67 dialog: added some padding in ConfirmDialog
Goffi <goffi@goffi.org>
parents: 203
diff changeset
70 padding: dp(5), dp(10)
203
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
71 color: 1, 1, 1, 1
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
72 text: root.title
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
73 halign: "center"
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
74 italic: True
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
75 bold: True
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
76 Label:
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
77 text: root.message
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
78 text_size: root.width, None
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
79 size: self.texture_size
226
1abd9d694e67 dialog: added some padding in ConfirmDialog
Goffi <goffi@goffi.org>
parents: 203
diff changeset
80 padding: dp(25), 0
203
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
81 font_size: sp(20)
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
82 color: 1, 1, 1, 1
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
83 Button:
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
84 size_hint: 1, None
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
85 height: dp(50)
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
86 background_color: 0.33, 1.0, 0.0, 1
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
87 text: _("Yes")
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
88 bold: True
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
89 on_release: root.yes_cb() if root.yes_cb is not None else None
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
90 Button:
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
91 size_hint: 1, None
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
92 height: dp(50)
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
93 text: _("No")
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
94 bold: True
dbd2274fc78b core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff changeset
95 on_release: root.no_cb() if root.no_cb is not None else None