Mercurial > libervia-backend
comparison frontends/src/primitivus/profile_manager.py @ 422:5a18c5f08d9b
Primitivus: Profile Manager: fixed redraw on profile change + use of AdvandedEdit for login field
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 06 Nov 2011 15:19:51 +0100 |
parents | 28e4299d4553 |
children | 6c20c76abdcc |
comparison
equal
deleted
inserted
replaced
421:28e4299d4553 | 422:5a18c5f08d9b |
---|---|
18 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
19 along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 """ | 20 """ |
21 | 21 |
22 import urwid | 22 import urwid |
23 from urwid_satext.sat_widgets import Password,List,InputDialog,ConfirmDialog,Alert,FocusFrame | 23 from urwid_satext.sat_widgets import AdvancedEdit,Password,List,InputDialog,ConfirmDialog,Alert,FocusFrame |
24 from sat.tools.jid import JID | 24 from sat.tools.jid import JID |
25 | 25 |
26 | 26 |
27 class ProfileManager(urwid.WidgetWrap): | 27 class ProfileManager(urwid.WidgetWrap): |
28 | 28 |
31 #profiles list | 31 #profiles list |
32 profiles = self.host.bridge.getProfilesList() | 32 profiles = self.host.bridge.getProfilesList() |
33 profiles.sort() | 33 profiles.sort() |
34 | 34 |
35 #login & password box must be created before list because of onProfileChange | 35 #login & password box must be created before list because of onProfileChange |
36 self.login_wid = urwid.Edit(_('Login:'),align='center') | 36 self.login_wid = AdvancedEdit(_('Login:'),align='center') |
37 self.pass_wid = Password(_('Password:'),align='center') | 37 self.pass_wid = Password(_('Password:'),align='center') |
38 | 38 |
39 self.list_profile = List(profiles, style=['single'], align='center', on_click=self.onProfileChange) | 39 self.list_profile = List(profiles, style=['single'], align='center', on_click=self.onProfileChange) |
40 | 40 |
41 #new & delete buttons | 41 #new & delete buttons |
113 | 113 |
114 profile_name = list_wid.getSelectedValue() | 114 profile_name = list_wid.getSelectedValue() |
115 if profile_name: | 115 if profile_name: |
116 self.host.bridge.asyncGetParamA("JabberID", "Connection", profile_key=profile_name, callback=setJID, errback=self.getParamError) | 116 self.host.bridge.asyncGetParamA("JabberID", "Connection", profile_key=profile_name, callback=setJID, errback=self.getParamError) |
117 self.host.bridge.asyncGetParamA("Password", "Connection", profile_key=profile_name, callback=setPassword, errback=self.getParamError) | 117 self.host.bridge.asyncGetParamA("Password", "Connection", profile_key=profile_name, callback=setPassword, errback=self.getParamError) |
118 self.host.redraw() | |
118 | 119 |
119 def onConnectProfile(self, button): | 120 def onConnectProfile(self, button): |
120 profile_name = self.list_profile.getSelectedValue() | 121 profile_name = self.list_profile.getSelectedValue() |
121 if not profile_name: | 122 if not profile_name: |
122 pop_up_widget = Alert(_('No profile selected'), _('You need to create and select a profile before connecting'), ok_cb=self.cancelDialog) | 123 pop_up_widget = Alert(_('No profile selected'), _('You need to create and select a profile before connecting'), ok_cb=self.cancelDialog) |