diff src/profile_manager.kv @ 2:8f9ed634a5eb

Profile manager: profile(s) deletion is handled
author Goffi <goffi@goffi.org>
date Sat, 26 Mar 2016 19:47:09 +0100
parents 189b76859110
children 440a743b58ee
line wrap: on
line diff
--- a/src/profile_manager.kv	Sat Mar 26 18:58:13 2016 +0100
+++ b/src/profile_manager.kv	Sat Mar 26 19:47:09 2016 +0100
@@ -14,6 +14,7 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+
 <ProfileManager>:
     Label:
         text: "Profile Manager"
@@ -30,6 +31,7 @@
 <PMButton@Button>:
     size_hint: 1, 0.2
 
+
 <NewProfileScreen>:
     profile_name: profile_name
     jid: jid
@@ -73,17 +75,54 @@
                 size_hint: 1, 0.2
 
             PMButton:
+                text: "OK"
+                on_press: root.doCreate()
+
+            PMButton:
                 text: "Cancel"
                 on_press:
                     root.pm.screen_manager.transition.direction = 'right'
                     root.pm.screen_manager.current = 'profiles'
 
-            PMButton:
-                text: "OK"
-                on_press: root.doCreate()
+            Widget:
+
+
+<DeleteProfilesScreen>:
+    BoxLayout:
+        orientation: "vertical"
+
+        Label:
+            text: "Are you sure you want to delete the following profiles?"
+            size_hint: 1, 0.1
+
+        Label:
+            text: u'\n'.join([i.text for i in root.pm.profiles_screen.list_adapter.selection])
+            bold: True
+
+        Label:
+            text: u'/!\\ WARNING: this operation is irreversible'
+            color: 1,0,0,1
+            bold: True
+            size_hint: 1, 0.2
+
+        GridLayout:
+            cols: 2
+
+            Button:
+                text: "Delete"
+                size_hint: 1, 0.2
+                on_press: root.doDelete()
+
+            Button:
+                text: "Cancel"
+                size_hint: 1, 0.2
+                on_press:
+                    root.pm.screen_manager.transition.direction = 'right'
+                    root.pm.screen_manager.current = 'profiles'
 
             Widget:
 
+
 <ProfilesScreen>:
     layout: layout
     BoxLayout:
@@ -104,13 +143,19 @@
                     root.pm.screen_manager.transition.direction = 'left'
                     root.pm.screen_manager.current = 'new_profile'
             Button:
+                disabled: not root.list_adapter.selection
                 text: "Delete"
                 size_hint: 1, 0.1
+                on_press:
+                    root.pm.screen_manager.transition.direction = 'left'
+                    root.pm.screen_manager.current = 'delete_profiles'
+
 
 <ConnectButton>:
     text: "Connect"
     size_hint: 1, 0.1
 
+
 <ProfileItem>:
     background_normal: "button_selected.png" if self.is_selected else "button.png"
     deselected_color: 1,1,1,1