Mercurial > libervia-backend
changeset 1183:f36d7068a44b
Primitivus: fixed focus in ContactList:
current behavious is temporary and will need to be rethinked a bit: if FOCUS_SWITCH is pressed, the focus change on top widget, if FOCUS_UP/DOWN is pressed, focus will throught contact list.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 08 Sep 2014 18:14:51 +0200 (2014-09-08) |
parents | 4be53c14845e |
children | 62cba918cc63 |
files | frontends/src/primitivus/contact_list.py |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/primitivus/contact_list.py Mon Sep 08 16:53:41 2014 +0200 +++ b/frontends/src/primitivus/contact_list.py Mon Sep 08 18:14:51 2014 +0200 @@ -26,6 +26,8 @@ from sat_frontends.primitivus.status import StatusBar from sat_frontends.primitivus.constants import Const from sat_frontends.primitivus.keys import action_key_map as a_key +from sat.core import log as logging +log = logging.getLogger(__name__) class ContactList(urwid.WidgetWrap, QuickContactList): @@ -42,7 +44,7 @@ #we now build the widget self.host.status_bar = StatusBar(host) - self.frame = urwid.Frame(self.__buildList(), None, self.host.status_bar) + self.frame = sat_widgets.FocusFrame(self.__buildList(), None, self.host.status_bar) self.main_widget = sat_widgets.LabelLine(self.frame, sat_widgets.SurroundedText(_("Contacts"))) urwid.WidgetWrap.__init__(self, self.main_widget) if on_click: @@ -65,6 +67,12 @@ self.update() def keypress(self, size, key): + # FIXME: we have a temporary behaviour here: FOCUS_SWITCH change focus globally in the parent, + # and FOCUS_UP/DOWN is transwmitter to parent if we are respectively on the first or last element + if key in sat_widgets.FOCUS_KEYS: + if (key == a_key['FOCUS_SWITCH'] or (key == a_key['FOCUS_UP'] and self.frame.focus_position == 'body') or + (key == a_key['FOCUS_DOWN'] and self.frame.focus_position == 'footer')): + return key if key == a_key['STATUS_HIDE']: #user wants to (un)hide contacts' statuses self.show_status = not self.show_status self.update()