~ubuntu-branches/ubuntu/oneiric/emesene/oneiric-proposed

« back to all changes in this revision

Viewing changes to emesene/gui/gtkui/ContactInformation.py

  • Committer: Bazaar Package Importer
  • Author(s): Lorenzo De Liso
  • Date: 2011-04-27 19:59:14 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20110427195914-27om6e1ah1v9cedc
Tags: 2.11.4+dfsg-0ubuntu1
* New upstream version (LP: #771988)
* Tarball repacked according to debian/README.source
* Bump Standards-Version to 3.9.2; no further changes required
* This upload also closes the following bugs:
  - LP: #728726
  - LP: #729124
  - LP: #729544
  - LP: #729919
  - LP: #759484
  - LP: #759845
  - LP: #763972
  - LP: #767973
  - LP: #767976
  - LP: #767979

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
import logging
33
33
log = logging.getLogger('gtkui.ContactInformation')
34
34
 
 
35
from IconView import IconView
 
36
 
35
37
class ContactInformation(gtk.Window, gui.base.ContactInformation):
36
38
    '''a window that displays information about a contact'''
37
39
 
43
45
        self.set_title(_('Contact information (%s)') % (account,))
44
46
        self.set_role("dialog")
45
47
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
46
 
        self.set_icon(utils.safe_gtk_image_load(gui.theme.logo).get_pixbuf())
47
48
 
48
49
        self.tabs = gtk.Notebook()
49
50
 
58
59
        '''create all the tabs on the window'''
59
60
        self.info = InformationWidget(self.session, self.account)
60
61
        self.nicks = ListWidget(self.session, self.account)
 
62
 
 
63
        self.avatar_manager = gui.base.AvatarManager(self.session)
 
64
 
 
65
        account_path = self.avatar_manager.get_contact_avatars_dir(self.account)
 
66
 
 
67
        self.avatars = IconView(_('Avatar history'), [account_path], 
 
68
                        None, None, IconView.TYPE_SELF_PICS)
61
69
        self.messages = ListWidget(self.session, self.account)
62
70
        self.status = ListWidget(self.session, self.account)
63
71
        self.chats = ChatWidget(self.session, self.account)
64
72
 
65
73
        self.tabs.append_page(self.info, gtk.Label(_('Information')))
66
74
        self.tabs.append_page(self.nicks, gtk.Label(_('Nick history')))
 
75
        self.tabs.append_page(self.avatars, gtk.Label(_('Avatar history')))
67
76
        self.tabs.append_page(self.messages, gtk.Label(_('Message history')))
68
77
        self.tabs.append_page(self.status, gtk.Label(_('Status history')))
69
78
        self.tabs.append_page(self.chats, gtk.Label(_('Chat history')))
274
283
        from_datetime = datetime.date(from_year, from_month + 1,
275
284
                from_day) - datetime.timedelta(30)
276
285
 
277
 
        from_t = from_datetime.timetuple()
278
 
 
279
 
        self.from_calendar.select_month(from_t.tm_mon - 1, from_t.tm_year)
 
286
        self.from_calendar.select_month(from_datetime.month - 1,
 
287
                from_datetime.year)
 
288
        self.from_calendar.select_day(from_datetime.day)
280
289
        self.to_calendar = gtk.Calendar()
281
290
 
282
291
        save.connect('clicked', self._on_save_clicked)
325
334
    def refresh_history(self):
326
335
        '''refresh the history according to the values on the calendars
327
336
        '''
328
 
        self.text.clear()
 
337
        if self.contact:
 
338
            his_picture = self.contact.picture or utils.path_to_url(os.path.abspath(gui.theme.user))
 
339
            my_picture = self.session.contacts.me.picture or utils.path_to_url(os.path.abspath(gui.theme.user))
 
340
            self.text.clear(self.account, self.contact.nick, self.contact.display_name, my_picture, his_picture)
 
341
        else:
 
342
            self.text.clear()
329
343
        self.request_chats_between(1000, self._on_chats_ready)
330
344
 
331
345
    def request_chats_between(self, limit, callback):
360
374
            return
361
375
 
362
376
        for stat, timestamp, msg_text, nick, account in results:
363
 
            contact = e3.Contact(account, nick=nick)
 
377
 
 
378
            contact = founded_account = self.session.contacts.get(account)
 
379
 
 
380
            if contact == None:
 
381
                contact = e3.Contact(account, nick=nick)
364
382
 
365
383
            is_me = self.session.contacts.me.account == account
366
384
            datetimestamp = datetime.datetime.fromtimestamp(timestamp)