Commit bc6a5ad5 authored by Dan Pascu's avatar Dan Pascu

Defined __unicode__ for Contact and ContactGroup

parent 28c92282
......@@ -3,6 +3,8 @@
__all__ = ['Contact', 'ContactGroup', 'ContactDelegate', 'ContactModel', 'ContactSearchModel']
import sys
from PyQt4.QtCore import Qt, QAbstractListModel, QModelIndex, QSize
from PyQt4.QtGui import QColor, QPainter, QPalette, QPixmap, QStyle, QSortFilterProxyModel, QStyledItemDelegate
......@@ -33,6 +35,9 @@ class ContactGroup(object):
return "%s(%r)" % (self.__class__.__name__, self.name)
def __str__(self):
return self.name.encode(sys.stdout.encoding)
def __unicode__(self):
return self.name
@property
......@@ -87,9 +92,15 @@ class Contact(object):
def __repr__(self):
return '%s(%r, %r, %r, %r)' % (self.__class__.__name__, self.group, self.name, self.uri, self.image)
def __str__(self):
def __unicode__(self):
return '%s <%s>' % (self.name, self.uri) if self.name else self.uri
def __str__(self):
return unicode(self).encode(sys.stdout.encoding)
def __unicode__(self):
return u'%s <%s>' % (self.name, self.uri) if self.name else self.uri
def __reduce__(self):
return (self.__class__, (self.group, self.name, self.uri, self.image), None)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment