Mercurial > libervia-desktop-kivy
annotate src/cagou/kv/profile_manager.kv @ 38:9f45098289cc
widgets handler, core: hidden widgets can now be shown with swipes:
- a couple of methods have been added to handle visible and hidden widgets
- a new getOrClone method allow to recreate a widget if it already has a parent (can happen even if the widget is not shown, e.g. in a carousel)
- handler now display hidden widgets of the same class as the displayed one when swiping. For instance, if a chat widget is displayed, and header input is used to show an other one, it's now possible to go back to the former by swiping. QuickWidget.onDelete method can be used to handle if a widget must be really deleted (return True) or just hidden (any other value).
- handler use a subclass of Carousel for this new feature, with some adjustement so event can be passed to children without too much delay (and frustration). This may need to be adjusted again in the future.
- handler.cagou_widget now give the main displayed widget in the handler
- handler.changeWidget must be used when widget need to be changed (it's better to use host.switchWidget which will call it itself)
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 28 Aug 2016 15:27:48 +0200 |
parents | 56838ad5c84b |
children | 1922506846be |
rev | line source |
---|---|
0 | 1 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client |
2 # Copyright (C) 2016 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 | |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
17 |
0 | 18 <ProfileManager>: |
19 Label: | |
20 text: "Profile Manager" | |
21 size_hint: 1,0.05 | |
22 | |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
23 <PMLabel@Label>: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
24 size_hint: 1, 0.1 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
25 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
26 <PMInput@TextInput>: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
27 multiline: False |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
28 size_hint: 1, 0.1 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
29 write_tab: False |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
30 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
31 <PMButton@Button>: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
32 size_hint: 1, 0.2 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
33 |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
34 |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
35 <NewProfileScreen>: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
36 profile_name: profile_name |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
37 jid: jid |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
38 password: password |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
39 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
40 BoxLayout: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
41 orientation: "vertical" |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
42 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
43 Label: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
44 text: "Creation of a new profile" |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
45 bold: True |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
46 size_hint: 1, 0.1 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
47 Label: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
48 text: root.error_msg |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
49 bold: True |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
50 size_hint: 1, 0.1 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
51 color: 1,0,0,1 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
52 GridLayout: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
53 cols: 2 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
54 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
55 PMLabel: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
56 text: "Profile name" |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
57 PMInput: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
58 id: profile_name |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
59 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
60 PMLabel: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
61 text: "JID" |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
62 PMInput: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
63 id: jid |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
64 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
65 PMLabel: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
66 text: "Password" |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
67 PMInput: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
68 id: password |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
69 password: True |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
70 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
71 Widget: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
72 size_hint: 1, 0.2 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
73 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
74 Widget: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
75 size_hint: 1, 0.2 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
76 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
77 PMButton: |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
78 text: "OK" |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
79 on_press: root.doCreate() |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
80 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
81 PMButton: |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
82 text: "Cancel" |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
83 on_press: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
84 root.pm.screen_manager.transition.direction = 'right' |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
85 root.pm.screen_manager.current = 'profiles' |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
86 |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
87 Widget: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
88 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
89 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
90 <DeleteProfilesScreen>: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
91 BoxLayout: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
92 orientation: "vertical" |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
93 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
94 Label: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
95 text: "Are you sure you want to delete the following profiles?" |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
96 size_hint: 1, 0.1 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
97 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
98 Label: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
99 text: u'\n'.join([i.text for i in root.pm.profiles_screen.list_adapter.selection]) |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
100 bold: True |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
101 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
102 Label: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
103 text: u'/!\\ WARNING: this operation is irreversible' |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
104 color: 1,0,0,1 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
105 bold: True |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
106 size_hint: 1, 0.2 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
107 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
108 GridLayout: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
109 cols: 2 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
110 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
111 Button: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
112 text: "Delete" |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
113 size_hint: 1, 0.2 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
114 on_press: root.doDelete() |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
115 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
116 Button: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
117 text: "Cancel" |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
118 size_hint: 1, 0.2 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
119 on_press: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
120 root.pm.screen_manager.transition.direction = 'right' |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
121 root.pm.screen_manager.current = 'profiles' |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
122 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
123 Widget: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
124 |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
125 |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
126 <ProfilesScreen>: |
0 | 127 layout: layout |
128 BoxLayout: | |
129 id: layout | |
130 orientation: 'vertical' | |
131 | |
132 Label: | |
133 text: "Select a profile to connect with, or create a new one" | |
134 size_hint: 1,0.05 | |
135 | |
136 GridLayout: | |
137 cols: 2 | |
138 size_hint: 1, 0.1 | |
139 Button: | |
140 size_hint: 1, 0.1 | |
141 text: "New" | |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
142 on_press: |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
143 root.pm.screen_manager.transition.direction = 'left' |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
144 root.pm.screen_manager.current = 'new_profile' |
0 | 145 Button: |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
146 disabled: not root.list_adapter.selection |
0 | 147 text: "Delete" |
148 size_hint: 1, 0.1 | |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
149 on_press: |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
150 root.pm.screen_manager.transition.direction = 'left' |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
151 root.pm.screen_manager.current = 'delete_profiles' |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
152 |
0 | 153 |
154 <ConnectButton>: | |
155 text: "Connect" | |
156 size_hint: 1, 0.1 | |
5
33b619506832
profile manger: launch plug process when "Connect" button is pressed (full plugging is not working yet)
Goffi <goffi@goffi.org>
parents:
4
diff
changeset
|
157 disabled: not self.profile_screen.list_adapter.selection |
33b619506832
profile manger: launch plug process when "Connect" button is pressed (full plugging is not working yet)
Goffi <goffi@goffi.org>
parents:
4
diff
changeset
|
158 on_press: self.pm._onConnectProfiles() |
0 | 159 |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
160 |
0 | 161 <ProfileItem>: |
15
56838ad5c84b
files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents:
5
diff
changeset
|
162 # FIXME: using cagou/images path for now, will use atlas later |
56838ad5c84b
files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents:
5
diff
changeset
|
163 background_normal: "cagou/images/button_selected.png" if self.is_selected else "cagou/images/button.png" |
0 | 164 deselected_color: 1,1,1,1 |
165 selected_color: 1,1,1,1 | |
166 color: 0,0,0,1 |