comparison frontends/src/primitivus/profile_manager.py @ 1161:344bbe6fd1de

primitivus: profile manager now handle APP_QUIT key
author Goffi <goffi@goffi.org>
date Thu, 04 Sep 2014 19:05:57 +0200
parents 75025461141f
children 49d39b619e5d
comparison
equal deleted inserted replaced
1160:2ff15a6c5791 1161:344bbe6fd1de
19 19
20 from sat.core.i18n import _ 20 from sat.core.i18n import _
21 from sat_frontends.primitivus.constants import Const as C 21 from sat_frontends.primitivus.constants import Const as C
22 import urwid 22 import urwid
23 from urwid_satext.sat_widgets import AdvancedEdit, Password, List, InputDialog, ConfirmDialog, Alert 23 from urwid_satext.sat_widgets import AdvancedEdit, Password, List, InputDialog, ConfirmDialog, Alert
24 from sat_frontends.tools.jid import JID 24 from sat_frontends.primitivus.keys import action_key_map as a_key
25 25
26 26
27 class ProfileManager(urwid.WidgetWrap): 27 class ProfileManager(urwid.WidgetWrap):
28 28
29 def __init__(self, host): 29 def __init__(self, host):
57 body_content = urwid.SimpleListWalker([buttons_flow,self.list_profile,divider,self.login_wid, self.pass_wid, connect_button]) 57 body_content = urwid.SimpleListWalker([buttons_flow,self.list_profile,divider,self.login_wid, self.pass_wid, connect_button])
58 frame_body = urwid.ListBox(body_content) 58 frame_body = urwid.ListBox(body_content)
59 frame = urwid.Frame(frame_body,urwid.AttrMap(urwid.Text(_("Profile Manager"),align='center'),'title')) 59 frame = urwid.Frame(frame_body,urwid.AttrMap(urwid.Text(_("Profile Manager"),align='center'),'title'))
60 self.main_widget = urwid.LineBox(frame) 60 self.main_widget = urwid.LineBox(frame)
61 urwid.WidgetWrap.__init__(self, self.main_widget) 61 urwid.WidgetWrap.__init__(self, self.main_widget)
62
63 def keypress(self, size, key):
64 if key == a_key['APP_QUIT']:
65 self.host.onExit()
66 raise urwid.ExitMainLoop()
67 return super(ProfileManager, self).keypress(size, key)
62 68
63 def __refillProfiles(self): 69 def __refillProfiles(self):
64 """Update the list of profiles""" 70 """Update the list of profiles"""
65 profiles = self.host.bridge.getProfilesList() 71 profiles = self.host.bridge.getProfilesList()
66 profiles.sort() 72 profiles.sort()