Mercurial > libervia-desktop-kivy
annotate libervia/desktop_kivy/core/profile_manager.py @ 499:f387992d8e37
plugins: new "call" plugin for A/V calls:
this is the base implementation for calls plugin, handling one2one calls.
For now, the interface is very basic, call is done by specifying the bare jid of the
destinee, then press the "call" button. Incoming calls are automatically accepted.
rel 424
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 04 Oct 2023 22:54:36 +0200 |
parents | b3cedbee561d |
children |
rev | line source |
---|---|
379 | 1 #!/usr/bin/env python3 |
2 | |
0 | 3 |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
4 #Libervia Desktop-Kivy |
461 | 5 # Copyright (C) 2016-2021 Jérôme Poisson (goffi@goffi.org) |
0 | 6 |
7 # This program is free software: you can redistribute it and/or modify | |
8 # it under the terms of the GNU Affero General Public License as published by | |
9 # the Free Software Foundation, either version 3 of the License, or | |
10 # (at your option) any later version. | |
11 | |
12 # This program is distributed in the hope that it will be useful, | |
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 # GNU Affero General Public License for more details. | |
16 | |
17 # You should have received a copy of the GNU Affero General Public License | |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | |
20 | |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
21 from libervia.backend.core import log as logging |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
22 log = logging.getLogger(__name__) |
56
817a45e6d7e3
core (profile_manager): fixed bad import
Goffi <goffi@goffi.org>
parents:
16
diff
changeset
|
23 from .constants import Const as C |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
24 from libervia.frontends.quick_frontend.quick_profile_manager import QuickProfileManager |
0 | 25 from kivy.uix.boxlayout import BoxLayout |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
26 from kivy.uix.togglebutton import ToggleButton |
0 | 27 from kivy.uix.screenmanager import ScreenManager, Screen |
62 | 28 from kivy.metrics import sp |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
29 from kivy import properties |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
30 from libervia.desktop_kivy import G |
0 | 31 |
32 | |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
33 class ProfileItem(ToggleButton): |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
34 ps = properties.ObjectProperty() |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
35 index = properties.NumericProperty(0) |
0 | 36 |
37 | |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
38 class NewProfileScreen(Screen): |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
39 profile_name = properties.ObjectProperty(None) |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
40 jid = properties.ObjectProperty(None) |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
41 password = properties.ObjectProperty(None) |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
42 error_msg = properties.StringProperty('') |
0 | 43 |
44 def __init__(self, pm): | |
312 | 45 super(NewProfileScreen, self).__init__(name='new_profile') |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
46 self.pm = pm |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
47 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
48 def on_creation_failure(self, failure): |
312 | 49 msg = [l for l in str(failure).split('\n') if l][-1] |
50 self.error_msg = str(msg) | |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
51 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
52 def on_creation_success(self, profile): |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
53 self.pm.profiles_screen.reload() |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
54 G.host.bridge.profile_start_session( |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
55 self.password.text, profile, |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
56 callback=lambda __: self._session_started(profile), |
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
57 errback=self.on_creation_failure) |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
58 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
59 def _session_started(self, profile): |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
60 jid = self.jid.text.strip() |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
61 G.host.bridge.param_set("JabberID", jid, "Connection", -1, profile) |
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
62 G.host.bridge.param_set("Password", self.password.text, "Connection", -1, profile) |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
63 self.pm.screen_manager.transition.direction = 'right' |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
64 self.pm.screen_manager.current = 'profiles' |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
65 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
66 def doCreate(self): |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
67 name = self.profile_name.text.strip() |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
68 # XXX: we use XMPP password for profile password to simplify |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
69 # if user want to change profile password, he can do it in preferences |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
70 G.host.bridge.profile_create( |
312 | 71 name, self.password.text, '', |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
72 callback=lambda: self.on_creation_success(name), |
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
73 errback=self.on_creation_failure) |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
74 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
75 |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
76 class DeleteProfilesScreen(Screen): |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
77 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
78 def __init__(self, pm): |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
79 self.pm = pm |
312 | 80 super(DeleteProfilesScreen, self).__init__(name='delete_profiles') |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
81 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
82 def do_delete(self): |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
83 """This method will delete *ALL* selected profiles""" |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
84 to_delete = self.pm.get_profiles() |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
85 deleted = [0] |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
86 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
87 def delete_inc(): |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
88 deleted[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
|
89 if deleted[0] == len(to_delete): |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
90 self.pm.profiles_screen.reload() |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
91 self.pm.screen_manager.transition.direction = 'right' |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
92 self.pm.screen_manager.current = 'profiles' |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
93 |
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
|
94 for profile in to_delete: |
312 | 95 log.info("Deleteing profile [{}]".format(profile)) |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
96 G.host.bridge.profile_delete_async( |
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
97 profile, callback=delete_inc, errback=delete_inc) |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
98 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
99 |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
100 class ProfilesScreen(Screen): |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
101 layout = properties.ObjectProperty(None) |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
102 profiles = properties.ListProperty() |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
103 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
104 def __init__(self, pm): |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
105 self.pm = pm |
312 | 106 super(ProfilesScreen, self).__init__(name='profiles') |
63 | 107 self.reload() |
108 | |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
109 def _profiles_list_get_cb(self, profiles): |
63 | 110 profiles.sort() |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
111 self.profiles = profiles |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
112 for idx, profile in enumerate(profiles): |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
113 item = ProfileItem(ps=self, index=idx, text=profile, group='profiles') |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
114 self.layout.add_widget(item) |
0 | 115 |
62 | 116 def converter(self, row_idx, obj): |
117 return {'text': obj, | |
118 'size_hint_y': None, | |
119 'height': sp(40)} | |
120 | |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
121 def reload(self): |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
122 """Reload profiles list""" |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
123 self.layout.clear_widgets() |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
124 G.host.bridge.profiles_list_get(callback=self._profiles_list_get_cb) |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
125 |
0 | 126 |
127 class ProfileManager(QuickProfileManager, BoxLayout): | |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
128 selected = properties.ObjectProperty(None) |
0 | 129 |
16
ba14b596b90e
host can now be get as a global value:
Goffi <goffi@goffi.org>
parents:
15
diff
changeset
|
130 def __init__(self, autoconnect=None): |
ba14b596b90e
host can now be get as a global value:
Goffi <goffi@goffi.org>
parents:
15
diff
changeset
|
131 QuickProfileManager.__init__(self, G.host, autoconnect) |
0 | 132 BoxLayout.__init__(self, orientation="vertical") |
133 self.screen_manager = ScreenManager() | |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
134 self.profiles_screen = ProfilesScreen(self) |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
135 self.new_profile_screen = NewProfileScreen(self) |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
136 self.delete_profiles_screen = DeleteProfilesScreen(self) |
312 | 137 self.xmlui_screen = Screen(name='xmlui') |
0 | 138 self.screen_manager.add_widget(self.profiles_screen) |
139 self.screen_manager.add_widget(self.xmlui_screen) | |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
140 self.screen_manager.add_widget(self.new_profile_screen) |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
141 self.screen_manager.add_widget(self.delete_profiles_screen) |
0 | 142 self.add_widget(self.screen_manager) |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
143 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
144 def close_ui(self, xmlui, reason=None): |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
145 self.screen_manager.transition.direction = 'right' |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
146 self.screen_manager.current = 'profiles' |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
147 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
148 def show_ui(self, xmlui): |
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
149 xmlui.set_close_cb(self.close_ui) |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
150 if xmlui.type == 'popup': |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
151 xmlui.bind(on_touch_up=lambda obj, value: self.close_ui(xmlui)) |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
152 self.xmlui_screen.clear_widgets() |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
153 self.xmlui_screen.add_widget(xmlui) |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
154 self.screen_manager.transition.direction = 'left' |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
155 self.screen_manager.current = 'xmlui' |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
156 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
157 def select_profile(self, profile_item): |
450
ff5516adc1f5
profile manager: don't activate `Connect` button until we get authentication result from backend
Goffi <goffi@goffi.org>
parents:
379
diff
changeset
|
158 if not profile_item.selected: |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
159 return |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
160 def authenticate_cb(data, cb_id, profile): |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
161 if not C.bool(data.pop('validated', C.BOOL_FALSE)): |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
162 # profile didn't validate, we unselect it |
450
ff5516adc1f5
profile manager: don't activate `Connect` button until we get authentication result from backend
Goffi <goffi@goffi.org>
parents:
379
diff
changeset
|
163 profile_item.state = 'normal' |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
164 self.selected = '' |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
165 else: |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
166 # state may have been modified so we need to be sure it's down |
450
ff5516adc1f5
profile manager: don't activate `Connect` button until we get authentication result from backend
Goffi <goffi@goffi.org>
parents:
379
diff
changeset
|
167 profile_item.state = 'down' |
ff5516adc1f5
profile manager: don't activate `Connect` button until we get authentication result from backend
Goffi <goffi@goffi.org>
parents:
379
diff
changeset
|
168 self.selected = profile_item |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
169 G.host.action_manager(data, callback=authenticate_cb, ui_show_cb=self.show_ui, |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
170 profile=profile) |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
171 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
172 G.host.action_launch(C.AUTHENTICATE_PROFILE_ID, callback=authenticate_cb, |
450
ff5516adc1f5
profile manager: don't activate `Connect` button until we get authentication result from backend
Goffi <goffi@goffi.org>
parents:
379
diff
changeset
|
173 profile=profile_item.text) |
0 | 174 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
175 def get_profiles(self): |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
176 # for now we restrict to a single profile in LiberviaDesktopKivy |
270
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
177 # TODO: handle multi-profiles |
89ba66464329
profile manager: don't use anymore deprecated ListView + use dp() for sizes of buttons instead of relative size.
Goffi <goffi@goffi.org>
parents:
139
diff
changeset
|
178 return [self.selected.text] if self.selected else [] |