comparison libervia/desktop_kivy/kv/profile_manager.kv @ 493:b3cedbee561d

refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
author Goffi <goffi@goffi.org>
date Fri, 02 Jun 2023 18:26:16 +0200
parents cagou/kv/profile_manager.kv@203755bbe0fe
children
comparison
equal deleted inserted replaced
492:5114bbb5daa3 493:b3cedbee561d
1 #Libervia Desktop-Kivy
2 # Copyright (C) 2016-2021 Jérôme Poisson (goffi@goffi.org)
3
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Affero General Public License for more details.
13
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
18 <ProfileManager>:
19 Label:
20 size_hint: 1, None
21 text_size: root.width, None
22 width: self.texture_size[0]
23 height: self.texture_size[1] + dp(20)
24 text: "Profile Manager"
25 halign: "center"
26 bold: True
27
28 <PMLabel@Label>:
29 size_hint: 1, None
30 height: sp(30)
31
32 <PMInput@TextInput>:
33 multiline: False
34 size_hint: 1, None
35 height: sp(30)
36 write_tab: False
37
38 <PMButton@Button>:
39 size_hint: 1, None
40 height: dp(40)
41
42
43 <NewProfileScreen>:
44 profile_name: profile_name
45 jid: jid
46 password: password
47
48 BoxLayout:
49 orientation: "vertical"
50
51 Label:
52 size_hint: 1, None
53 text_size: root.width, None
54 size: self.texture_size
55 text: "Creation of a new profile"
56 halign: "center"
57 Label:
58 text: root.error_msg
59 bold: True
60 size_hint: 1, None
61 height: dp(40)
62 color: 1,0,0,1
63 GridLayout:
64 cols: 2
65
66 PMLabel:
67 text: "Profile name"
68 PMInput:
69 id: profile_name
70
71 PMLabel:
72 text: "JID"
73 PMInput:
74 id: jid
75
76 PMLabel:
77 text: "Password"
78 PMInput:
79 id: password
80 password: True
81
82 Widget:
83 size_hint: 1, None
84 height: dp(50)
85
86 Widget:
87 size_hint: 1, None
88 height: dp(50)
89
90 PMButton:
91 text: "OK"
92 on_press: root.doCreate()
93
94 PMButton:
95 text: "Cancel"
96 on_press:
97 root.pm.screen_manager.transition.direction = 'right'
98 root.pm.screen_manager.current = 'profiles'
99
100 Widget:
101
102
103 <DeleteProfilesScreen>:
104 BoxLayout:
105 orientation: "vertical"
106
107 Label:
108 size_hint: 1, None
109 text_size: root.width, None
110 size: self.texture_size
111 text: "Are you sure you want to delete the following profiles?"
112 halign: "center"
113
114 Label:
115 size_hint: 1, None
116 text_size: root.width, None
117 height: self.texture_size[1] + dp(60)
118 width: self.texture_size[0]
119 halign: "center"
120 # for now we only handle single selection
121 text: u'\n'.join([i.text for i in [root.pm.selected]]) if root.pm.selected else u''
122 bold: True
123
124 Label:
125 size_hint: 1, None
126 text_size: root.width, dp(30)
127 height: self.texture_size[1]
128 text: u'/!\\ WARNING: this operation is irreversible'
129 color: 1,0,0,1
130 bold: True
131 halign: "center"
132 valign: "top"
133 GridLayout:
134 cols: 2
135 PMButton:
136 text: "Delete"
137 on_press: root.do_delete()
138
139 PMButton:
140 text: "Cancel"
141 on_press:
142 root.pm.screen_manager.transition.direction = 'right'
143 root.pm.screen_manager.current = 'profiles'
144
145
146 <ProfilesScreen>:
147 layout: layout
148 BoxLayout:
149 orientation: 'vertical'
150
151 Label:
152 size_hint: 1, None
153 text_size: root.width, None
154 size: self.texture_size
155 text: "Select a profile or create a new one"
156 halign: "center"
157
158 GridLayout:
159 cols: 2
160 size_hint: 1, None
161 height: dp(40)
162 Button:
163 text: "New"
164 on_press:
165 root.pm.screen_manager.transition.direction = 'left'
166 root.pm.screen_manager.current = 'new_profile'
167 Button:
168 disabled: not root.pm.selected
169 text: "Delete"
170 on_press:
171 root.pm.screen_manager.transition.direction = 'left'
172 root.pm.screen_manager.current = 'delete_profiles'
173 ScrollView
174 BoxLayout:
175 size_hint: 1, None
176 height: self.minimum_height
177 orientation: "vertical"
178 id: layout
179 Button
180 text: "Connect"
181 size_hint: 1, None
182 height: dp(40)
183 disabled: not root.pm.selected
184 on_press: root.pm._on_connect_profiles()
185
186
187 <ProfileItem>:
188 size_hint: 1, None
189 background_normal: ""
190 background_down: ""
191 deselected_color: (1,1,1,1) if self.index%2 else (0.87,0.87,0.87,1)
192 selected_color: 0.67,1.0,1.0,1
193 selected: self.state == 'down'
194 color: 0,0,0,1
195 background_color: self.selected_color if self.selected else self.deselected_color
196 on_press: self.ps.pm.select_profile(self)
197 height: dp(30)