annotate sat_frontends/quick_frontend/quick_profile_manager.py @ 2617:81b70eeb710f

quick_frontend(contact list): refactored update: update is now called with appropriate constant value (C.UPDATE_ADD, C.UPDATE_DELETE, C.UPDATE_MODIFY and so on) when a widget change visibility according to current options. Before it was linked to cache only (C.UPDATE_ADD was only called when contact was first added to cache). This make widget handling in frontends more easy. Renamed entityToShow to entityVisible, which seems to correspond better. Started reducing lines lenght to 90 chars as a test. May become the new coding style soon.
author Goffi <goffi@goffi.org>
date Sun, 24 Jun 2018 21:59:29 +0200
parents 26edcf3a30eb
children 56f94936df1e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1934
2daf7b4c6756 use of /usr/bin/env instead of /usr/bin/python in shebang
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
1 #!/usr/bin/env python2
112
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
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
2483
0046283a285d dates update
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
5 # Copyright (C) 2009-2018 Jérôme Poisson (goffi@goffi.org)
112
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
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
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
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
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
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
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
19
771
bfabeedbf32e core: i18n refactoring:
Goffi <goffi@goffi.org>
parents: 751
diff changeset
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
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
60
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
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
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
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
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
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
e5ca22113280 Primitivus: profile manager
Goffi <goffi@goffi.org>
parents: 112
diff changeset
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
1489
039d96e131be frontends: callback are now always used in QuickApp launchAction (before it was only used if validated is present):
Goffi <goffi@goffi.org>
parents: 1409
diff changeset
99 def authenticate_cb(data, cb_id, profile):
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
diff changeset
100
1489
039d96e131be frontends: callback are now always used in QuickApp launchAction (before it was only used if validated is present):
Goffi <goffi@goffi.org>
parents: 1409
diff changeset
101 if C.bool(data.pop('validated', C.BOOL_FALSE)):
1265
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
1489
039d96e131be frontends: callback are now always used in QuickApp launchAction (before it was only used if validated is present):
Goffi <goffi@goffi.org>
parents: 1409
diff changeset
109 self.host.actionManager(data, callback=authenticate_cb, profile=profile)
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
diff changeset
110
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
111 def getProfileNameCb(profile):
1265
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:
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
113 # FIXME: this method is not handling manual mode correclty anymore
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
114 # must be thought to be handled asynchronously
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
diff changeset
115 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
116 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
117 log.warning(msg)
2091
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
118 self.host.showDialog(_("Profile plugging in error"), msg, 'error')
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
119 else:
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
120 self.host.launchAction(C.AUTHENTICATE_PROFILE_ID, callback=authenticate_cb, profile=profile)
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
121
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
122 def getProfileNameEb(failure):
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
123 log.error(u"Can't retrieve profile name: {}".format(failure))
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
124
f413bfc24458 bridge, quick_frontend: preparation for async bridge
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
125 for profile_key in profile_keys:
2168
255830fdb80b core, bridge: renamed getProfileName to profileNameGet according to new conventions
Goffi <goffi@goffi.org>
parents: 2146
diff changeset
126 self.host.bridge.profileNameGet(profile_key, callback=getProfileNameCb, errback=getProfileNameEb)
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
diff changeset
127
112
f551e44adb25 Primitivus first draft
Goffi <goffi@goffi.org>
parents:
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 def getParamError(self, dummy):
1613
1c5761cb1bdc quick_frontend(profile manager): fixed alert messages
Goffi <goffi@goffi.org>
parents: 1489
diff changeset
130 self.host.showDialog(_(u"Error"), _("Can't get profile parameter"), 'error')
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
131
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
132 ## Helping methods ##
113
e5ca22113280 Primitivus: profile manager
Goffi <goffi@goffi.org>
parents: 112
diff changeset
133
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
134 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
135 """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
136
2171
978011533892 primitivus: fixed profileCreate bridge call
Goffi <goffi@goffi.org>
parents: 2168
diff changeset
137 @param reason (str): reason as returned by profileCreate
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
138 @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
139 """
1063
6ec513ad92c2 frontends: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1034
diff changeset
140 if reason == "ConflictError":
6ec513ad92c2 frontends: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1034
diff changeset
141 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
142 elif reason == "CancelError":
6ec513ad92c2 frontends: async failures are more detailed (full class name + error message)
souliane <souliane@mailoo.org>
parents: 1034
diff changeset
143 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
144 elif reason == "ValueError":
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
diff changeset
145 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
146 else:
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
diff changeset
147 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
148 return message
113
e5ca22113280 Primitivus: profile manager
Goffi <goffi@goffi.org>
parents: 112
diff changeset
149
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
150 def _deleteProfile(self):
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
151 """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
152 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
153 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
154 self.resetFields()
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
155
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
156 ## 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
157
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
158 # These methods must be called by the frontend at some point
113
e5ca22113280 Primitivus: profile manager
Goffi <goffi@goffi.org>
parents: 112
diff changeset
159
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
160 def _onConnectProfiles(self):
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
161 """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
162 if self._autoconnect:
1613
1c5761cb1bdc quick_frontend(profile manager): fixed alert messages
Goffi <goffi@goffi.org>
parents: 1489
diff changeset
163 self.host.showDialog(_('Internal error'), _("You can't connect manually and automatically at the same time"), 'error')
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
164 return
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
165 self.updateConnectionParams()
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
166 profiles = self.getProfiles()
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
167 if not profiles:
1613
1c5761cb1bdc quick_frontend(profile manager): fixed alert messages
Goffi <goffi@goffi.org>
parents: 1489
diff changeset
168 self.host.showDialog(_('No profile selected'), _('You need to create and select at least one profile before connecting'), 'error')
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
169 else:
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
170 # 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
171 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
172
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
diff changeset
173 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
174 """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
175
5197600a1e13 quick_app, primitivus: update the connection mechanism to ask for non empty profile passwords
souliane <souliane@mailoo.org>
parents: 1019
diff changeset
176 @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
177 """
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
178 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
179 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
180
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
diff changeset
181 def updateConnectionParams(self):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
diff changeset
182 """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
183 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
184 login = self.getJID()
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
185 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
186 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
187 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
188 self.host.bridge.setParam("JabberID", login, "Connection", profile_key=self.current.profile)
1409
3265a2639182 massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
souliane <souliane@mailoo.org>
parents: 1405
diff changeset
189 log.info(u"login updated for profile [{}]".format(self.current.profile))
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
diff changeset
190 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
191 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
192 self.host.bridge.setParam("Password", password, "Connection", profile_key=self.current.profile)
1409
3265a2639182 massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
souliane <souliane@mailoo.org>
parents: 1405
diff changeset
193 log.info(u"password updated for profile [{}]".format(self.current.profile))
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1178
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 ## 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
196
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
197 def resetFields(self):
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
198 """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
199 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
200 self.setJID("")
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
201 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
202
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
203 def refillProfiles(self):
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
204 """Rebuild the list of profiles"""
2146
1bb9bf1b4150 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
205 profiles = self.host.bridge.profilesListGet()
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
206 profiles.sort()
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
207 self.setProfiles(profiles)
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
208
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
209 ## 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
210
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
211 # get/set data
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 getProfiles(self):
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
214 """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
215
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
216 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
217 @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
218 """
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
219 raise NotImplementedError
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
220
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
221 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
222 """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
223 raise NotImplementedError
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
224
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 getJID(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 jid
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
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 jabber id
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 getPassword(self):
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
235 """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
236
1288
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 @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
239 """
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 setJID(self, jid_):
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
243 """Set current jid
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 @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
247 """
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
248 raise NotImplementedError
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
249
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
250 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
251 """Set current password
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
252
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
253 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
254 """
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
255 raise NotImplementedError
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
256
1288
7cf32aeeebdb quick_frontend, primitivus: moved parts of primitivus's profileManager to quick_frontend
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
257 # dialogs
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