comparison 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
comparison
equal deleted inserted replaced
285:3f7e227aab00 286:4772ba26623f
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16
17 #:set common_height 30 17 #:set common_height 30
18 #:set button_height 50 18 #:set button_height 50
19 19
20 <Title>:
21 color: 1, 1, 1, 1
22 20
23 <EmptyWidget,StringWidget,PasswordWidget,JidInputWidget>: 21 <EmptyWidget,StringWidget,PasswordWidget,JidInputWidget>:
24 size_hint: 1, None 22 size_hint: 1, None
25 height: dp(common_height) 23 height: dp(common_height)
26 color: 1, 1, 1, 1
27 24
28 25
29 <TextWidget,LabelWidget,JidWidget>: 26 <TextWidget,LabelWidget,JidWidget>:
30 size_hint: 1, 1 27 size_hint: 1, 1
31 size_hint_min_y: max(dp(common_height), self.texture_size[1]) 28 size_hint_min_y: max(dp(common_height), self.texture_size[1])
32 text_size: self.width, None 29 text_size: self.width, None
33 color: 1, 1, 1, 1
34 30
35 31
36 <StringWidget,PasswordWidget,IntWidget>: 32 <StringWidget,PasswordWidget,IntWidget>:
37 multiline: False 33 multiline: False
38 background_normal: app.expand('atlas://data/images/defaulttheme/textinput') 34 background_normal: app.expand('atlas://data/images/defaulttheme/textinput')
52 size_hint: 1, 1 48 size_hint: 1, 1
53 49
54 50
55 <DividerWidget>: 51 <DividerWidget>:
56 size_hint: 1, None 52 size_hint: 1, None
57 height: dp(20) 53 height: dp(12)
58 canvas.before: 54 canvas.before:
59 Color: 55 Color:
60 rgba: 1, 1, 1, 0.8 56 rgba: 0, 0, 0, 1
61 Line 57 Line
62 points: 0, self.y + dp(10), self.width, self.y + dp(10) 58 points: self.x, self.y + dp(5), self.x + self.width, self.y + dp(5)
63 width: dp(3) 59 width: dp(2)
64 60
65 61
66 <ListWidgetItem>: 62 <ListWidgetItem>:
67 size_hint_y: None 63 size_hint_y: None
68 height: dp(button_height) 64 height: dp(button_height)
82 orientation: "vertical" 78 orientation: "vertical"
83 padding: dp(10) 79 padding: dp(10)
84 80
85 81
86 <AdvancedListRow>: 82 <AdvancedListRow>:
83 orientation: "horizontal"
84 size_hint: 1, None
85 height: self.minimum_height
87 canvas.before: 86 canvas.before:
88 Color: 87 Color:
89 rgba: 1, 1, 1, 0.2 if self.global_index%2 else 0.1 88 rgba: app.c_prim_light if self.global_index%2 else app.c_prim_dark
90 Rectangle: 89 Rectangle:
91 pos: self.pos 90 pos: self.pos
92 size: self.size 91 size: self.size
93 size_hint: 1, None
94 height: self.minimum_height
95 rows: 1
96 canvas.after: 92 canvas.after:
97 Color: 93 Color:
98 rgba: 0, 0, 1, 0.5 if self.selected else 0 94 rgba: 0, 0, 1, 0.5 if self.selected else 0
99 Rectangle: 95 Rectangle:
100 pos: self.pos 96 pos: self.pos
101 size: self.size 97 size: self.size
102 98
103 99
104 <AdvancedListContainer>: 100 <AdvancedListContainer>:
105 cols: 1 101 size_hint: 1, None
106 size_hint: 1, None 102 height: self.minimum_height
107 height: self.minimum_height 103 orientation: "vertical"
108 104
109 105
110 <VerticalContainer>: 106 <VerticalContainer>:
107 orientation: "vertical"
108 size_hint: 1, None
109 height: self.minimum_height
110
111 <PairsContainer>:
112 cols: 2
113 size_hint: 1, None
114 height: self.minimum_height
115 padding: dp(10)
116
117
118 <TabsContainer>:
119 size_hint: 1, None
120 height: dp(200)
121
122 <TabsPanelContainer>:
123 layout: layout
124 ScrollView:
125 do_scroll_x: False
126 scroll_type: ['bars', 'content']
127 bar_width: dp(6)
128 canvas.before:
129 Color:
130 rgba: 1, 1, 1, 1
131 Rectangle:
132 pos: self.pos
133 size: self.size
134 BoxLayout:
135 id: layout
136 orientation: "vertical"
137 size_hint: 1, None
138 height: self.minimum_height
139 canvas.before:
140 Color:
141 rgba: 1, 1, 1, 1
142 Rectangle:
143 pos: self.pos
144 size: self.size
145
146
147 <FormButton>:
148 size_hint: 1, None
149 height: dp(button_height)
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
170
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
195 <XMLUIPanel>:
111 size_hint: 1, 1 196 size_hint: 1, 1
112 layout: layout 197 layout: layout
113 do_scroll_x: False 198 do_scroll_x: False
114 scroll_type: ['bars', 'content'] 199 scroll_type: ['bars', 'content']
115 bar_width: dp(6) 200 bar_width: dp(6)
116 BoxLayout: 201 BoxLayout:
117 id: layout 202 id: layout
118 orientation: "vertical" 203 orientation: "vertical"
119 size_hint: 1, None 204 size_hint: 1, None
205 padding: app.MARGIN_LEFT, 0, app.MARGIN_RIGHT, 0
120 height: self.minimum_height 206 height: self.minimum_height
121
122
123 <PairsContainer>:
124 cols: 2
125 size_hint: 1, None
126 height: self.minimum_height
127 padding: dp(10)
128
129
130 <TabsContainer>:
131 size_hint: 1, 1
132
133 <TabsPanelContainer>:
134 layout: layout
135 ScrollView:
136 do_scroll_x: False
137 scroll_type: ['bars', 'content']
138 bar_width: dp(6)
139 BoxLayout:
140 id: layout
141 orientation: "vertical"
142 size_hint: 1, None
143 height: self.minimum_height
144
145 <FormButton>:
146 size_hint: 1, None
147 height: dp(button_height)
148
149
150 <FileDialog>:
151 orientation: "vertical"
152 message: message
153 file_chooser: file_chooser
154 Label:
155 id: message
156 size_hint: 1, None
157 text_size: root.width, None
158 size: self.texture_size
159 FileChooserListView:
160 id: file_chooser
161 Button:
162 size_hint: 1, None
163 height: dp(50)
164 text: "choose"
165 on_release: root.onSelect(file_chooser.selection)
166 Button:
167 size_hint: 1, None
168 height: dp(50)
169 text: "cancel"
170 on_release: root.onCancel()
171
172
173 <XMLUIPanel>:
174 orientation: "vertical"
175 size_hint: 1, 1
176 canvas.before:
177 Color:
178 rgba: 0, 0, 0, 1
179 Rectangle:
180 pos: self.pos
181 size: self.size