Mercurial > libervia-desktop-kivy
annotate cagou/core/profile_manager.py @ 354:aa860c10acfc
chat: new chat selector:
Using the new ScreenManager feature, a widget to select a chat to display is shown when a
user opens the chat (except if an entity jid is specified, in which case it opens directly
the Chat widget), or when user presses ESC.
When on ChatSelector, pressing ESC brings to the root widget (i.e. default widget).
The ChatSelect is a first draft, it is planned to show opened chats, rooms, and a way to
create new chats.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 17 Jan 2020 18:44:35 +0100 |
parents | 772c170b47a9 |
children | 4d660b252487 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
4 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client | |
282 | 5 # Copyright (C) 2016-2019 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 | |
2
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
21 from sat.core import log as logging |
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 |
0 | 24 from sat_frontends.quick_frontend.quick_profile_manager import QuickProfileManager |
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 |
16
ba14b596b90e
host can now be get as a global value:
Goffi <goffi@goffi.org>
parents:
15
diff
changeset
|
30 from cagou 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 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
48 def onCreationFailure(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 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
52 def onCreationSuccess(self, profile): |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
53 self.pm.profiles_screen.reload() |
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
|
54 G.host.bridge.profileStartSession( |
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, |
284 | 56 callback=lambda __: self._sessionStarted(profile), |
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
|
57 errback=self.onCreationFailure) |
1
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
58 |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
59 def _sessionStarted(self, profile): |
189b76859110
Profile manager: new profile creation is handled
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
60 jid = self.jid.text.strip() |
16
ba14b596b90e
host can now be get as a global value:
Goffi <goffi@goffi.org>
parents:
15
diff
changeset
|
61 G.host.bridge.setParam("JabberID", jid, "Connection", -1, profile) |
ba14b596b90e
host can now be get as a global value:
Goffi <goffi@goffi.org>
parents:
15
diff
changeset
|
62 G.host.bridge.setParam("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 |
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
|
70 G.host.bridge.profileCreate( |
312 | 71 name, self.password.text, '', |
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
|
72 callback=lambda: self.onCreationSuccess(name), |
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
|
73 errback=self.onCreationFailure) |
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 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
82 def doDelete(self): |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
83 """This method will delete *ALL* selected profiles""" |
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
|
84 to_delete = self.pm.getProfiles() |
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 |
8f9ed634a5eb
Profile manager: profile(s) deletion is handled
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
87 def deleteInc(): |
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)) |
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
|
96 G.host.bridge.asyncDeleteProfile( |
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
|
97 profile, callback=deleteInc, errback=deleteInc) |
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 | |
124
7f7f3b8eb154
profile manager: fixed profilesListGet bridge call following name change in bridge
Goffi <goffi@goffi.org>
parents:
63
diff
changeset
|
109 def _profilesListGetCb(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() |
124
7f7f3b8eb154
profile manager: fixed profilesListGet bridge call following name change in bridge
Goffi <goffi@goffi.org>
parents:
63
diff
changeset
|
124 G.host.bridge.profilesListGet(callback=self._profilesListGetCb) |
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 self.bind(selected=self.onProfileSelect) |
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
|
144 |
305
b2727877bad4
remote: fixed workflow and size for XMLUI panel used with Ad-Hoc commands:
Goffi <goffi@goffi.org>
parents:
284
diff
changeset
|
145 def closeUI(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
|
146 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
|
147 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
|
148 |
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
|
149 def showUI(self, 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
|
150 xmlui.setCloseCb(self.closeUI) |
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
|
151 if xmlui.type == 'popup': |
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 xmlui.bind(on_touch_up=lambda obj, value: self.closeUI(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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 |
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
|
158 def onProfileSelect(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
|
159 if not 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
|
160 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
|
161 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
|
162 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
|
163 # profile didn't validate, we unselect it |
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 selected.state = 'normal' |
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 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
|
166 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
|
167 # state may have been modified so we need to be sure it's down |
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
|
168 selected.state = 'down' |
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
|
169 self.selected = 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
|
170 G.host.actionManager(data, callback=authenticate_cb, ui_show_cb=self.showUI, |
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 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
|
172 |
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
|
173 G.host.launchAction(C.AUTHENTICATE_PROFILE_ID, callback=authenticate_cb, |
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
|
174 profile=selected.text) |
0 | 175 |
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
|
176 def getProfiles(self): |
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 # for now we restrict to a single profile in Cagou |
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 # 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
|
179 return [self.selected.text] if self.selected else [] |