changeset 4:440a743b58ee

Profile manager: Connect button is disabled when no profile is selected
author Goffi <goffi@goffi.org>
date Thu, 07 Jul 2016 09:39:21 +0200
parents accbc3c18762
children 33b619506832
files src/profile_manager.kv src/profile_manager.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/profile_manager.kv	Thu Jul 07 09:39:21 2016 +0200
+++ b/src/profile_manager.kv	Thu Jul 07 09:39:21 2016 +0200
@@ -154,6 +154,7 @@
 <ConnectButton>:
     text: "Connect"
     size_hint: 1, 0.1
+    disabled: not self.ps.list_adapter.selection
 
 
 <ProfileItem>:
--- a/src/profile_manager.py	Thu Jul 07 09:39:21 2016 +0200
+++ b/src/profile_manager.py	Thu Jul 07 09:39:21 2016 +0200
@@ -64,7 +64,10 @@
 
 
 class ConnectButton(Button):
-    pass
+
+    def __init__(self, ps):
+        self.ps = ps
+        super(ConnectButton, self).__init__()
 
 
 class NewProfileScreen(Screen):
@@ -140,7 +143,7 @@
                                               )
         super(ProfilesScreen, self).__init__(name=u'profiles')
         self.layout.add_widget(listview.ListView(adapter=self.list_adapter))
-        connect_btn = ConnectButton()
+        connect_btn = ConnectButton(self)
         self.layout.add_widget(connect_btn)
 
     def reload(self):