diff frontends/src/primitivus/contact_list.py @ 736:6246eb6d64a0

frontends: define the constants with classes and inheritance instance of using __builtin__
author souliane <souliane@mailoo.org>
date Sat, 23 Nov 2013 10:21:40 +0100
parents f7878ad3c846
children 378af36155c2
line wrap: on
line diff
--- a/frontends/src/primitivus/contact_list.py	Sun Nov 24 11:22:20 2013 +0100
+++ b/frontends/src/primitivus/contact_list.py	Sat Nov 23 10:21:40 2013 +0100
@@ -22,7 +22,7 @@
 from sat_frontends.quick_frontend.quick_contact_list import QuickContactList
 from sat_frontends.quick_frontend.quick_utils import escapePrivate, unescapePrivate
 from sat.tools.jid import JID
-
+from sat_frontends.primitivus.constants import Const
 
 class ContactList(urwid.WidgetWrap, QuickContactList):
     signals = ['click','change']
@@ -87,7 +87,7 @@
                     # contact group
                     value = widget.getValue()
                 elif isinstance(widget, sat_widgets.SelectableText):
-                    if  widget.data.startswith(const_PRIVATE_PREFIX):
+                    if  widget.data.startswith(Const.PRIVATE_PREFIX):
                         # muc private dialog
                         value = widget.getValue()
                     else:
@@ -137,7 +137,7 @@
         widgets = [] #list of built widgets
 
         for contact in contacts:
-            if contact.startswith(const_PRIVATE_PREFIX):
+            if contact.startswith(Const.PRIVATE_PREFIX):
                 contact_disp = ('alert' if contact in self.alert_jid else "show_normal", unescapePrivate(contact))
                 show_icon = ''
                 status = ''
@@ -152,7 +152,7 @@
                 if (not self.show_disconnected and show == "unavailable"
                     and not contact in self.alert_jid and contact != self.selected):
                     continue
-                show_icon, show_attr = const_SHOW_ICON.get(show,('','default'))
+                show_icon, show_attr = Const.PRESENCE.get(show, ('', 'default'))
                 contact_disp = ('alert' if contact in self.alert_jid else show_attr, nick or name or jid.node or jid.bare)
             display = [ show_icon + " " , contact_disp]
             if self.show_status: