comparison cagou/kv/profile_manager.kv @ 270:89ba66464329

profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
author Goffi <goffi@goffi.org>
date Wed, 20 Mar 2019 09:29:44 +0100
parents d1408a98c505
children 1b835bcfa663
comparison
equal deleted inserted replaced
269:a5dfc789eeaf 270:89ba66464329
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 17
18 <ProfileManager>: 18 <ProfileManager>:
19 Label: 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)
20 text: "Profile Manager" 24 text: "Profile Manager"
21 size_hint: 1,0.05 25 halign: "center"
26 bold: True
22 27
23 <PMLabel@Label>: 28 <PMLabel@Label>:
24 size_hint: 1, None 29 size_hint: 1, None
25 height: sp(30) 30 height: sp(30)
26 31
29 size_hint: 1, None 34 size_hint: 1, None
30 height: sp(30) 35 height: sp(30)
31 write_tab: False 36 write_tab: False
32 37
33 <PMButton@Button>: 38 <PMButton@Button>:
34 size_hint: 1, 0.2 39 size_hint: 1, None
40 height: dp(40)
35 41
36 42
37 <NewProfileScreen>: 43 <NewProfileScreen>:
38 profile_name: profile_name 44 profile_name: profile_name
39 jid: jid 45 jid: jid
41 47
42 BoxLayout: 48 BoxLayout:
43 orientation: "vertical" 49 orientation: "vertical"
44 50
45 Label: 51 Label:
52 size_hint: 1, None
53 text_size: root.width, None
54 size: self.texture_size
46 text: "Creation of a new profile" 55 text: "Creation of a new profile"
47 bold: True 56 halign: "center"
48 size_hint: 1, 0.1
49 Label: 57 Label:
50 text: root.error_msg 58 text: root.error_msg
51 bold: True 59 bold: True
52 size_hint: 1, 0.1 60 size_hint: 1, None
61 height: dp(40)
53 color: 1,0,0,1 62 color: 1,0,0,1
54 GridLayout: 63 GridLayout:
55 cols: 2 64 cols: 2
56 65
57 PMLabel: 66 PMLabel:
69 PMInput: 78 PMInput:
70 id: password 79 id: password
71 password: True 80 password: True
72 81
73 Widget: 82 Widget:
74 size_hint: 1, 0.2 83 size_hint: 1, None
84 height: dp(50)
75 85
76 Widget: 86 Widget:
77 size_hint: 1, 0.2 87 size_hint: 1, None
88 height: dp(50)
78 89
79 PMButton: 90 PMButton:
80 text: "OK" 91 text: "OK"
81 on_press: root.doCreate() 92 on_press: root.doCreate()
82 93
92 <DeleteProfilesScreen>: 103 <DeleteProfilesScreen>:
93 BoxLayout: 104 BoxLayout:
94 orientation: "vertical" 105 orientation: "vertical"
95 106
96 Label: 107 Label:
108 size_hint: 1, None
109 text_size: root.width, None
110 size: self.texture_size
97 text: "Are you sure you want to delete the following profiles?" 111 text: "Are you sure you want to delete the following profiles?"
98 size_hint: 1, 0.1 112 halign: "center"
99 113
100 Label: 114 Label:
101 text: u'\n'.join([i.text for i in root.pm.profiles_screen.list_adapter.selection]) 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''
102 bold: True 122 bold: True
103 123
104 Label: 124 Label:
125 size_hint: 1, None
126 text_size: root.width, dp(30)
127 height: self.texture_size[1]
105 text: u'/!\\ WARNING: this operation is irreversible' 128 text: u'/!\\ WARNING: this operation is irreversible'
106 color: 1,0,0,1 129 color: 1,0,0,1
107 bold: True 130 bold: True
108 size_hint: 1, 0.2 131 halign: "center"
109 132 valign: "top"
110 GridLayout: 133 GridLayout:
111 cols: 2 134 cols: 2
112 135 PMButton:
113 Button:
114 text: "Delete" 136 text: "Delete"
115 size_hint: 1, 0.2
116 on_press: root.doDelete() 137 on_press: root.doDelete()
117 138
118 Button: 139 PMButton:
119 text: "Cancel" 140 text: "Cancel"
120 size_hint: 1, 0.2
121 on_press: 141 on_press:
122 root.pm.screen_manager.transition.direction = 'right' 142 root.pm.screen_manager.transition.direction = 'right'
123 root.pm.screen_manager.current = 'profiles' 143 root.pm.screen_manager.current = 'profiles'
124
125 Widget:
126 144
127 145
128 <ProfilesScreen>: 146 <ProfilesScreen>:
129 layout: layout 147 layout: layout
130 BoxLayout: 148 BoxLayout:
131 id: layout
132 orientation: 'vertical' 149 orientation: 'vertical'
133 150
134 Label: 151 Label:
152 size_hint: 1, None
153 text_size: root.width, None
154 size: self.texture_size
135 text: "Select a profile or create a new one" 155 text: "Select a profile or create a new one"
136 size_hint: 1,0.05 156 halign: "center"
137 157
138 GridLayout: 158 GridLayout:
139 cols: 2 159 cols: 2
140 size_hint: 1, 0.1 160 size_hint: 1, None
161 height: dp(40)
141 Button: 162 Button:
142 size_hint: 1, 0.1
143 text: "New" 163 text: "New"
144 on_press: 164 on_press:
145 root.pm.screen_manager.transition.direction = 'left' 165 root.pm.screen_manager.transition.direction = 'left'
146 root.pm.screen_manager.current = 'new_profile' 166 root.pm.screen_manager.current = 'new_profile'
147 Button: 167 Button:
148 disabled: not root.list_adapter.selection 168 disabled: not root.pm.selected
149 text: "Delete" 169 text: "Delete"
150 size_hint: 1, 0.1
151 on_press: 170 on_press:
152 root.pm.screen_manager.transition.direction = 'left' 171 root.pm.screen_manager.transition.direction = 'left'
153 root.pm.screen_manager.current = 'delete_profiles' 172 root.pm.screen_manager.current = 'delete_profiles'
154 173 ScrollView
155 174 BoxLayout:
156 <ConnectButton>: 175 size_hint: 1, None
157 text: "Connect" 176 height: self.minimum_height
158 size_hint: 1, 0.1 177 orientation: "vertical"
159 disabled: not self.profile_screen.list_adapter.selection 178 id: layout
160 on_press: self.pm._onConnectProfiles() 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._onConnectProfiles()
161 185
162 186
163 <ProfileItem>: 187 <ProfileItem>:
188 size_hint: 1, None
164 background_normal: "" 189 background_normal: ""
165 background_down: "" 190 background_down: ""
166 deselected_color: (1,1,1,1) if self.index%2 else (0.87,0.87,0.87,1) 191 deselected_color: (1,1,1,1) if self.index%2 else (0.87,0.87,0.87,1)
167 selected_color: 0.67,1.0,1.0,1 192 selected_color: 0.67,1.0,1.0,1
193 selected: self.state == 'down'
168 color: 0,0,0,1 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.selected = self if self.selected else ''
197 height: dp(30)