Mercurial > libervia-desktop-kivy
comparison src/cagou/core/profile_manager.py @ 62:1922506846be
design fixes:
- adjust sizes using sp/dp so it adapts on different screen resolutions
- use a shorter sentence for profile manager label, so it appears better on small screens
- various design adjustment to appear correclty on different screen size
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 04 Dec 2016 21:34:30 +0100 |
parents | 817a45e6d7e3 |
children | af4f986d86f0 |
comparison
equal
deleted
inserted
replaced
61:0b7f10de416e | 62:1922506846be |
---|---|
25 from kivy.uix.boxlayout import BoxLayout | 25 from kivy.uix.boxlayout import BoxLayout |
26 from kivy.uix import listview | 26 from kivy.uix import listview |
27 from kivy.uix.button import Button | 27 from kivy.uix.button import Button |
28 from kivy.uix.screenmanager import ScreenManager, Screen | 28 from kivy.uix.screenmanager import ScreenManager, Screen |
29 from kivy.adapters import listadapter | 29 from kivy.adapters import listadapter |
30 from kivy.metrics import sp | |
30 from kivy import properties | 31 from kivy import properties |
31 from cagou import G | 32 from cagou import G |
32 | 33 |
33 | 34 |
34 class ProfileItem(listview.ListItemButton): | 35 class ProfileItem(listview.ListItemButton): |
134 profiles = G.host.bridge.getProfilesList() | 135 profiles = G.host.bridge.getProfilesList() |
135 profiles.sort() | 136 profiles.sort() |
136 self.list_adapter = ProfileListAdapter(pm, | 137 self.list_adapter = ProfileListAdapter(pm, |
137 data=profiles, | 138 data=profiles, |
138 cls=ProfileItem, | 139 cls=ProfileItem, |
140 args_converter=self.converter, | |
139 selection_mode='multiple', | 141 selection_mode='multiple', |
140 allow_empty_selection=True, | 142 allow_empty_selection=True, |
141 ) | 143 ) |
142 super(ProfilesScreen, self).__init__(name=u'profiles') | 144 super(ProfilesScreen, self).__init__(name=u'profiles') |
143 self.layout.add_widget(listview.ListView(adapter=self.list_adapter)) | 145 self.layout.add_widget(listview.ListView(adapter=self.list_adapter)) |
144 connect_btn = ConnectButton(self) | 146 connect_btn = ConnectButton(self) |
145 self.layout.add_widget(connect_btn) | 147 self.layout.add_widget(connect_btn) |
148 | |
149 def converter(self, row_idx, obj): | |
150 return {'text': obj, | |
151 'size_hint_y': None, | |
152 'height': sp(40)} | |
146 | 153 |
147 def reload(self): | 154 def reload(self): |
148 """Reload profiles list""" | 155 """Reload profiles list""" |
149 profiles = G.host.bridge.getProfilesList() | 156 profiles = G.host.bridge.getProfilesList() |
150 profiles.sort() | 157 profiles.sort() |