Mercurial > libervia-desktop-kivy
annotate cagou/kv/xmlui.kv @ 286:4772ba26623f
xmlui: many improvments:
- use a white background to be coherent with the rest of the UI
- cancel button is added on "window" XMLUIs
- use color for submit/save buttons
- VerticalContainer is not a ScrollView anymore, XMLUIPanel now has the main ScrollView
- when a TabsContainer is used as main container, main XMLUIPanel ScrollView touch events are disabled, to improve user experience (Kivy doesn't support well ScrollView inside an other ScrollView)
- use BoxLayout instead of GridLayout in AdvancedList*, as they use one row/col only
- fixed DividerWidget line location
- added margins in XMLUI panels
- renamed Settings main class to CagouSettings, to avoid conflict with Kivy's Settings class (which is causing troubles with kv)
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 27 Mar 2019 22:22:51 +0100 |
parents | 1b835bcfa663 |
children | 3c9ba4a694ef |
rev | line source |
---|---|
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client |
282 | 2 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org) |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # This program is free software: you can redistribute it and/or modify |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 # it under the terms of the GNU Affero General Public License as published by |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 # the Free Software Foundation, either version 3 of the License, or |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # (at your option) any later version. |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # This program is distributed in the hope that it will be useful, |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # GNU Affero General Public License for more details. |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # You should have received a copy of the GNU Affero General Public License |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 #:set common_height 30 |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 #:set button_height 50 |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
200 | 20 |
241 | 21 <EmptyWidget,StringWidget,PasswordWidget,JidInputWidget>: |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 size_hint: 1, None |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 height: dp(common_height) |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 |
99 | 25 |
241 | 26 <TextWidget,LabelWidget,JidWidget>: |
251
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
27 size_hint: 1, 1 |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
28 size_hint_min_y: max(dp(common_height), self.texture_size[1]) |
241 | 29 text_size: self.width, None |
30 | |
31 | |
175
d65a51fa00b9
core: use hollow borders for TextInput (except for XMLUI, for now)
Goffi <goffi@goffi.org>
parents:
159
diff
changeset
|
32 <StringWidget,PasswordWidget,IntWidget>: |
236
ca86954b3788
xmlui: implemented TextBoxWidget + set height for XMLUIPanel
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
33 multiline: False |
ca86954b3788
xmlui: implemented TextBoxWidget + set height for XMLUIPanel
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
34 background_normal: app.expand('atlas://data/images/defaulttheme/textinput') |
175
d65a51fa00b9
core: use hollow borders for TextInput (except for XMLUI, for now)
Goffi <goffi@goffi.org>
parents:
159
diff
changeset
|
35 |
236
ca86954b3788
xmlui: implemented TextBoxWidget + set height for XMLUIPanel
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
36 |
ca86954b3788
xmlui: implemented TextBoxWidget + set height for XMLUIPanel
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
37 <TextBoxWidget>: |
ca86954b3788
xmlui: implemented TextBoxWidget + set height for XMLUIPanel
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
38 multiline: True |
ca86954b3788
xmlui: implemented TextBoxWidget + set height for XMLUIPanel
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
39 height: dp(common_height) * 5 |
175
d65a51fa00b9
core: use hollow borders for TextInput (except for XMLUI, for now)
Goffi <goffi@goffi.org>
parents:
159
diff
changeset
|
40 |
d65a51fa00b9
core: use hollow borders for TextInput (except for XMLUI, for now)
Goffi <goffi@goffi.org>
parents:
159
diff
changeset
|
41 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 <ButtonWidget>: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 size_hint: 1, None |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 height: dp(button_height) |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 |
99 | 46 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 <BoolWidget>: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 size_hint: 1, 1 |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 |
99 | 50 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 <DividerWidget>: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 size_hint: 1, None |
286 | 53 height: dp(12) |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 canvas.before: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 Color: |
286 | 56 rgba: 0, 0, 0, 1 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 Line |
286 | 58 points: self.x, self.y + dp(5), self.x + self.width, self.y + dp(5) |
59 width: dp(2) | |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 |
99 | 61 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 <ListWidgetItem>: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 size_hint_y: None |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 height: dp(button_height) |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 |
99 | 66 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 <ListWidget>: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 size_hint: 1, None |
251
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
69 layout: layout |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
70 height: min(layout.minimum_height, dp(250)) |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
71 do_scroll_x: False |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
72 scroll_type: ['bars', 'content'] |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
73 bar_width: dp(6) |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
74 BoxLayout: |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
75 id: layout |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
76 size_hint: 1, None |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
77 height: self.minimum_height |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
78 orientation: "vertical" |
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
79 padding: dp(10) |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 |
99 | 81 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 <AdvancedListRow>: |
286 | 83 orientation: "horizontal" |
84 size_hint: 1, None | |
85 height: self.minimum_height | |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 canvas.before: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 Color: |
286 | 88 rgba: app.c_prim_light if self.global_index%2 else app.c_prim_dark |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 Rectangle: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 pos: self.pos |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 size: self.size |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 canvas.after: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 Color: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 rgba: 0, 0, 1, 0.5 if self.selected else 0 |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 Rectangle: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 pos: self.pos |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 size: self.size |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 |
99 | 99 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 <AdvancedListContainer>: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 size_hint: 1, None |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 height: self.minimum_height |
286 | 103 orientation: "vertical" |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 |
99 | 105 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 <VerticalContainer>: |
286 | 107 orientation: "vertical" |
108 size_hint: 1, None | |
109 height: self.minimum_height | |
99 | 110 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 <PairsContainer>: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 cols: 2 |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 size_hint: 1, None |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 height: self.minimum_height |
251
1f579baf787a
xmlui: some design improvments + use ScrollView + BoxLayout instead of DropDown for ListWidget:
Goffi <goffi@goffi.org>
parents:
245
diff
changeset
|
115 padding: dp(10) |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 |
99 | 117 |
69
a9c6b089070d
xmlui: improvments to prepare parameters:
Goffi <goffi@goffi.org>
parents:
62
diff
changeset
|
118 <TabsContainer>: |
286 | 119 size_hint: 1, None |
120 height: dp(200) | |
241 | 121 |
122 <TabsPanelContainer>: | |
123 layout: layout | |
124 ScrollView: | |
125 do_scroll_x: False | |
126 scroll_type: ['bars', 'content'] | |
127 bar_width: dp(6) | |
286 | 128 canvas.before: |
129 Color: | |
130 rgba: 1, 1, 1, 1 | |
131 Rectangle: | |
132 pos: self.pos | |
133 size: self.size | |
241 | 134 BoxLayout: |
135 id: layout | |
136 orientation: "vertical" | |
137 size_hint: 1, None | |
138 height: self.minimum_height | |
286 | 139 canvas.before: |
140 Color: | |
141 rgba: 1, 1, 1, 1 | |
142 Rectangle: | |
143 pos: self.pos | |
144 size: self.size | |
145 | |
99 | 146 |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
147 <FormButton>: |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
148 size_hint: 1, None |
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
149 height: dp(button_height) |
286 | 150 color: 0, 0, 0, 1 |
151 bold: True | |
152 | |
153 | |
154 <SubmitButton>: | |
155 text: _(u"Submit") | |
156 background_normal: '' | |
157 background_color: 0.33, 0.67, 0.0, 1 | |
158 | |
159 | |
160 <CancelButton>: | |
161 text: _(u"Cancel") | |
162 color: 1, 1, 1, 1 | |
163 bold: False | |
164 | |
165 | |
166 <SaveButton>: | |
167 text: _(u"Save") | |
168 background_normal: '' | |
169 background_color: 0.33, 0.67, 0.0, 1 | |
53
65775152aac1
xmlui: implemented most of XMLUI, not finished yet
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
170 |
99 | 171 |
172 <FileDialog>: | |
173 orientation: "vertical" | |
174 message: message | |
175 file_chooser: file_chooser | |
176 Label: | |
177 id: message | |
178 size_hint: 1, None | |
179 text_size: root.width, None | |
180 size: self.texture_size | |
181 FileChooserListView: | |
182 id: file_chooser | |
183 Button: | |
184 size_hint: 1, None | |
185 height: dp(50) | |
186 text: "choose" | |
187 on_release: root.onSelect(file_chooser.selection) | |
188 Button: | |
189 size_hint: 1, None | |
190 height: dp(50) | |
191 text: "cancel" | |
192 on_release: root.onCancel() | |
193 | |
194 | |
146 | 195 <XMLUIPanel>: |
241 | 196 size_hint: 1, 1 |
286 | 197 layout: layout |
198 do_scroll_x: False | |
199 scroll_type: ['bars', 'content'] | |
200 bar_width: dp(6) | |
201 BoxLayout: | |
202 id: layout | |
203 orientation: "vertical" | |
204 size_hint: 1, None | |
205 padding: app.MARGIN_LEFT, 0, app.MARGIN_RIGHT, 0 | |
206 height: self.minimum_height |