Mercurial > libervia-backend
annotate frontends/src/quick_frontend/quick_profile_manager.py @ 1288:7cf32aeeebdb frontends_multi_profiles
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 24 Jan 2015 00:14:58 +0100 |
parents | frontends/src/primitivus/profile_manager.py@e3a9ea76de35 |
children | 948dc273ad93 |
rev | line source |
---|---|
112 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
4 # helper class for making a SAT frontend |
811 | 5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org) |
112 | 6 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
10 # (at your option) any later version. |
112 | 11 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
15 # GNU Affero General Public License for more details. |
112 | 16 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
112 | 19 |
771 | 20 from sat.core.i18n import _ |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
21 from sat.core import log as logging |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
22 log = logging.getLogger(__name__) |
1034
5197600a1e13
quick_app, primitivus: update the connection mechanism to ask for non empty profile passwords
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
23 from sat_frontends.primitivus.constants import Const as C |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
24 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
25 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
26 class ProfileRecord(object): |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
27 """Class which manage data for one profile""" |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
28 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
29 def __init__(self, profile=None, login=None, password=None): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
30 self._profile = profile |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
31 self._login = login |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
32 self._password = password |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
33 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
34 @property |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
35 def profile(self): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
36 return self._profile |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
37 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
38 @profile.setter |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
39 def profile(self, value): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
40 self._profile = value |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
41 # if we change the profile, |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
42 # we must have no login/password until backend give them |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
43 self._login = self._password = None |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
44 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
45 @property |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
46 def login(self): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
47 return self._login |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
48 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
49 @login.setter |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
50 def login(self, value): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
51 self._login = value |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
52 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
53 @property |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
54 def password(self): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
55 return self._password |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
56 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
57 @password.setter |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
58 def password(self, value): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
59 self._password = value |
112 | 60 |
61 | |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
62 class QuickProfileManager(object): |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
63 """Class with manage profiles creation/deletion/connection""" |
112 | 64 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
65 def __init__(self, host, autoconnect=None): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
66 """Create the manager |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
67 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
68 @param host: %(doc_host)s |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
69 @param autoconnect(iterable): list of profiles to connect automatically |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
70 """ |
112 | 71 self.host = host |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
72 self._autoconnect = bool(autoconnect) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
73 self.current = ProfileRecord() |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
74 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
75 def go(self, autoconnect): |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
76 if self._autoconnect: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
77 self.autoconnect(autoconnect) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
78 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
79 def autoconnect(self, profile_keys): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
80 """Automatically connect profiles |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
81 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
82 @param profile_keys(iterable): list of profile keys to connect |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
83 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
84 if not profile_keys: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
85 log.warning("No profile given to autoconnect") |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
86 return |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
87 self._autoconnect = True |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
88 self._autoconnect_profiles=[] |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
89 self._do_autoconnect(profile_keys) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
90 |
113 | 91 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
92 def _do_autoconnect(self, profile_keys): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
93 """Connect automatically given profiles |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
94 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
95 @param profile_kes(iterable): profiles to connect |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
96 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
97 assert self._autoconnect |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
98 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
99 def authenticate_cb(callback_id, data, profile): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
100 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
101 if C.bool(data['validated']): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
102 self._autoconnect_profiles.append(profile) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
103 if len(self._autoconnect_profiles) == len(profile_keys): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
104 # all the profiles have been validated |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
105 self.host.plug_profiles(self._autoconnect_profiles) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
106 else: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
107 # a profile is not validated, we go to manual mode |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
108 self._autoconnect=False |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
109 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
110 for profile_key in profile_keys: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
111 profile = self.host.bridge.getProfileName(profile_key) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
112 if not profile: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
113 self._autoconnect = False # manual mode |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
114 msg = _("Trying to plug an unknown profile key ({})".format(profile_key)) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
115 log.warning(msg) |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
116 self.alert(_("Profile plugging in error"), msg, ok_cb=self.host.removePopUp) |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
117 break |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
118 self.host.launchAction(C.AUTHENTICATE_PROFILE_ID, callback=authenticate_cb, profile=profile) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
119 |
112 | 120 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
121 def getParamError(self, dummy): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
122 self.alert(_(u"Error"), _("Can't get profile parameter")) |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
123 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
124 ## Helping methods ## |
113 | 125 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
126 def _getErrorMessage(self, reason): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
127 """Return an error message corresponding to profile creation error |
421
28e4299d4553
primitivus: profile manager updated to use new asynchronous profile creation
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
128 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
129 @param reason (str): reason as returned by asyncCreateProfile |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
130 @return (unicode): human readable error message |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
131 """ |
1063
6ec513ad92c2
frontends: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1034
diff
changeset
|
132 if reason == "ConflictError": |
6ec513ad92c2
frontends: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1034
diff
changeset
|
133 message = _("A profile with this name already exists") |
6ec513ad92c2
frontends: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1034
diff
changeset
|
134 elif reason == "CancelError": |
6ec513ad92c2
frontends: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents:
1034
diff
changeset
|
135 message = _("Profile creation cancelled by backend") |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
136 elif reason == "ValueError": |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
137 message = _("You profile name is not valid") # TODO: print a more informative message (empty name, name starting with '@') |
421
28e4299d4553
primitivus: profile manager updated to use new asynchronous profile creation
Goffi <goffi@goffi.org>
parents:
413
diff
changeset
|
138 else: |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
139 message = _("Can't create profile ({})").format(reason) |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
140 return message |
113 | 141 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
142 def _deleteProfile(self): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
143 """Delete the currently selected profile""" |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
144 if self.current.profile: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
145 self.host.bridge.asyncDeleteProfile(self.current.profile, callback=self.refillProfiles) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
146 self.resetFields() |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
147 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
148 ## workflow methods (events occuring during the profiles selection) ## |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
149 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
150 # These methods must be called by the frontend at some point |
113 | 151 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
152 def _onConnectProfiles(self): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
153 """Connect the profiles and start the main widget""" |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
154 if self._autoconnect: |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
155 self.alert(_('Internal error'), _('You can connect manually and automatically at the same time')) |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
156 return |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
157 self.updateConnectionParams() |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
158 profiles = self.getProfiles() |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
159 if not profiles: |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
160 self.alert(_('No profile selected'), _('You need to create and select at least one profile before connecting')) |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
161 else: |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
162 # All profiles in the list are already validated, so we can plug them directly |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
163 self.host.plug_profiles(profiles) |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
164 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
165 def getConnectionParams(self, profile): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
166 """Get login and password and display them |
1034
5197600a1e13
quick_app, primitivus: update the connection mechanism to ask for non empty profile passwords
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
167 |
5197600a1e13
quick_app, primitivus: update the connection mechanism to ask for non empty profile passwords
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
168 @param profile: %(doc_profile)s |
5197600a1e13
quick_app, primitivus: update the connection mechanism to ask for non empty profile passwords
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
169 """ |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
170 self.host.bridge.asyncGetParamA("JabberID", "Connection", profile_key=profile, callback=self.setJID, errback=self.getParamError) |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
171 self.host.bridge.asyncGetParamA("Password", "Connection", profile_key=profile, callback=self.setPassword, errback=self.getParamError) |
1034
5197600a1e13
quick_app, primitivus: update the connection mechanism to ask for non empty profile passwords
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
172 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
173 def updateConnectionParams(self): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
174 """Check if connection parameters have changed, and update them if so""" |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
175 if self.current.profile: |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
176 login = self.getJID() |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
177 password = self.getPassword() |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
178 if login != self.current.login and self.current.login is not None: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
179 self.current.login = login |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
180 self.host.bridge.setParam("JabberID", login, "Connection", profile_key=self.current.profile) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
181 log.info("login updated for profile [{}]".format(self.current.profile)) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
182 if password != self.current.password and self.current.password is not None: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
183 self.current.password = password |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
184 self.host.bridge.setParam("Password", password, "Connection", profile_key=self.current.profile) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
185 log.info("password updated for profile [{}]".format(self.current.profile)) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
186 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
187 ## graphic updates (should probably be overriden in frontends) ## |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
188 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
189 def resetFields(self): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
190 """Set profile to None, and reset fields""" |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
191 self.current.profile=None |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
192 self.setJID("") |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
193 self.setPassword("") |
1034
5197600a1e13
quick_app, primitivus: update the connection mechanism to ask for non empty profile passwords
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
194 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
195 def refillProfiles(self): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
196 """Rebuild the list of profiles""" |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
197 profiles = self.host.bridge.getProfilesList() |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
198 profiles.sort() |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
199 self.setProfiles(profiles) |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
200 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
201 ## Method which must be implemented by frontends ## |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
202 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
203 # get/set data |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
204 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
205 def getProfiles(self): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
206 """Return list of selected profiles |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
207 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
208 Must be implemented by frontends |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
209 @return (list): list of profiles |
1034
5197600a1e13
quick_app, primitivus: update the connection mechanism to ask for non empty profile passwords
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
210 """ |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
211 raise NotImplementedError |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
212 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
213 def setProfiles(self, profiles): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
214 """Update the list of profiles""" |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
215 raise NotImplementedError |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
216 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
217 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
218 def getJID(self): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
219 """Get current jid |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
220 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
221 Must be implemented by frontends |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
222 @return (unicode): current jabber id |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
223 """ |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
224 raise NotImplementedError |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
225 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
226 def getPassword(self): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
227 """Get current password |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
228 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
229 Must be implemented by frontends |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
230 @return (unicode): current password |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
231 """ |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
232 raise NotImplementedError |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
233 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
234 def setJID(self, jid_): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
235 """Set current jid |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
236 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
237 Must be implemented by frontends |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
238 @param jid_(unicode): jabber id to set |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1178
diff
changeset
|
239 """ |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
240 raise NotImplementedError |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
241 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
242 def setPassword(self, password): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
243 """Set current password |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
244 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
245 Must be implemented by frontends |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
246 """ |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
247 raise NotImplementedError |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
248 |
1288
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
249 # dialogs |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
250 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
251 def alert(self, title, message): |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
252 """Show an alert message, must be implemented by frontends |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
253 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
254 @param title: title of the dialog/popup |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
255 @param message: error message |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
256 """ |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
257 raise NotImplementedError |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
258 |
7cf32aeeebdb
quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
259 # Note: a method which check profiles change must be implemented too |