primitivus: use of new keys modules from Urwid SàText

This commit is contained in:
Goffi 2014-09-04 19:05:57 +02:00
commit c45ba71f2a

View file

@ -26,6 +26,7 @@ from sat_frontends.primitivus.card_game import CardGame
from sat_frontends.quick_frontend.quick_utils import escapePrivate, unescapePrivate
from sat_frontends.primitivus import xmlui
from sat_frontends.primitivus.constants import Const as C
from sat_frontends.primitivus.keys import action_key_map as a_key
import time
from sat_frontends.tools.jid import JID
@ -95,26 +96,26 @@ class Chat(urwid.WidgetWrap, QuickChat):
self.subject = None
def keypress(self, size, key):
if key == "meta p": #user wants to (un)hide the presents panel
if key == a_key['OCCUPANTS_HIDE']: #user wants to (un)hide the presents panel
if self.type == 'group':
widgets = [widget for (widget, options) in self.chat_colums.contents]
if self.present_panel in widgets:
self.__removePresentPanel()
else:
self.__appendPresentPanel()
elif key == "meta t": #user wants to (un)hide timestamp
elif key == a_key['TIMESTAMP_HIDE']: #user wants to (un)hide timestamp
self.show_timestamp = not self.show_timestamp
for wid in self.content:
wid._invalidate()
elif key == "meta n": #user wants to (not) use short nick
elif key == a_key['SHORT_NICKNAME']: #user wants to (not) use short nick
self.show_short_nick = not self.show_short_nick
for wid in self.content:
wid._invalidate()
elif key == "meta l": #user wants to (un)hide widget decoration
elif key == a_key['DECORATION_HIDE']: #user wants to (un)hide widget decoration
show = not isinstance(self._w, sat_widgets.LabelLine)
self.showDecoration(show)
self._invalidate()
elif key == "meta s": #user wants to (un)hide group's subject or change its apperance
elif key == a_key['SUBJECT_SWITCH']: #user wants to (un)hide group's subject or change its apperance
if self.subject:
self.show_title = (self.show_title + 1) % 3
if self.show_title == 0: