~ubuntu-branches/ubuntu/hardy/emesene/hardy-updates

« back to all changes in this revision

Viewing changes to MainWindow.py

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2008-03-29 21:48:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080329214829-spbg3uej5aozf2c1
Tags: 1.0-dist-1
* New upstream stable release from the emesene-1.0-dist upstream tarball
  (which contains setup.py and misc/ ).
* debian/patches/01_setup_py_update_get_orig_source.patch:
  - Removed, not needed anymore as we aren't using get-orig-source.
* debian/rules:
  - Remove get-orig-source rule, as from now on we will use upstream
    tarballs.
  - Remove python-patchsys include.
  - Run dh_icons and dh_desktop
  - Build the package with python2.5 since it FTBFS with python2.4 due to
    an issue with distutils.
* debian/copyright:
  - Updated.
* debian/watch:
  - Updated so that it reports 1.* as the newer versions.
* debian/emesene-launcher:
  - Update for the new Controller.py location.
* debian/control:
  - Build-Depend on python2.5 since the package is built with python2.5,
    as it fails with python2.4's distutils.
  - Wrap Build-Depends.
  - Build-Depend on debhelper >= 5.0.51~ for dh_icons

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
       
73
73
        self.connect('size-allocate', self.on_size_alloc)
74
74
 
75
 
        theme = controller.getTheme()
 
75
        theme = controller.theme
76
76
        gtk.window_set_default_icon_list(theme.getImage('icon16'),
77
77
                                          theme.getImage('icon32'),
78
78
                                          theme.getImage('icon48'),
85
85
        self.currentInterface = 'login'
86
86
        self.buildInterface('login')
87
87
        
 
88
        self.itemSelectedId = 0
 
89
        
88
90
        self.signals = []
89
91
        sap = self.signals.append
90
92
        sap(self.config.connect('change::showUserPanel', 
98
100
        sap(self.config.connect('change::userListAvatarSize', 
99
101
            self.updateSize))
100
102
        sap(self.config.connect('change::smallIcons', self.updateSize))
101
 
 
102
103
        # TODO: do we need disconnecting these signals?
103
104
        
104
105
    def on_size_alloc(self, widget, allocation):
174
175
        
175
176
        if self.userList:
176
177
            self.userList.tooltips.hideTooltip()
 
178
            self.userList.disconnect(self.itemSelectedId)
177
179
 
178
180
        # if i dont add this if we disconnect then the image isnt shown
179
181
        if guiType == 'userlist' and self.login:
202
204
            self.vbox.pack_start(self.menu, False, False)
203
205
            self.userList = UserList.UserList(self.controller, \
204
206
                self.controller.theme, self.controller.config)
 
207
            self.itemSelectedId = self.userList.connect('item-selected',
 
208
                self.onItemSelected)
205
209
            
206
210
            self.userPanel = UserPanel.UserPanel(self.controller)
207
211
            self.vbox.pack_start(self.userPanel, False, False)
302
306
        if self.currentInterface == 'userlist':
303
307
            self.userPanel.setAvatar(pixbuf)
304
308
 
 
309
    def onItemSelected(self, userlist, objType, obj, path):
 
310
        if objType == 'user':
 
311
            self.controller.newConversation(self.controller.msn,
 
312
                                            obj.email, None, True)
 
313
        elif objType == 'group':
 
314
            if self.userList.row_expanded(path):
 
315
                self.userList.collapse_row(path)
 
316
            else:
 
317
                self.userList.expand_row(path, False)
 
318
    
 
319
 
305
320
class StatusCombo(gtk.ComboBox):
306
321
    '''this class represent the combo where you set the status'''
307
322
 
332
347
        counter = 0
333
348
        flag = False
334
349
        j = 0
335
 
        for i in controller.status_ordered[1]:
336
 
            if emesenelib.common.status_table[i] == \
337
 
                self.controller.getContactStatus():
338
 
                flag = True
339
 
 
340
 
            if not flag:
341
 
                counter += 1
 
350
        for i in controller.status_ordered[0]:
 
351
            if self.controller.contacts.get_status() == i:
 
352
                self.set_active(j)
342
353
                
343
 
            if i != 'offline':
344
 
                self.statusListStore\
345
 
                        .append([self.controller.theme.statusToPixbuf(
346
 
                               emesenelib.common.status_table[i]), i,
347
 
                               self.controller.status_ordered[2][j]])
348
 
                j += 1
 
354
            if i != 'FLN':
 
355
                self.statusListStore.append([
 
356
                    self.controller.theme.statusToPixbuf(i), i,
 
357
                    _(self.controller.status_ordered[2][j])]) # re-gettext-it
 
358
            j += 1
349
359
 
350
 
        self.set_active(counter)
 
360
        # flag needed to avoid the double-changing of status when
 
361
        # user changes it from another place
 
362
        self.changeStatusFlag = True 
351
363
        
352
 
        self.connect('changed' , self.on_status_changed)
 
364
        self.connect('changed', self.on_status_changed, self.changeStatusFlag)
353
365
        self.controller.msn.connect('self-status-changed', 
354
366
            self.selfStatusChanged)
355
367
 
356
368
    def selfStatusChanged(self, msnp, status):
 
369
        self.changeStatusFlag = False
357
370
        statusOrdered = self.controller.status_ordered[1]
358
371
        
359
372
        if emesenelib.common.reverse_status[status] in statusOrdered:
360
373
            self.set_active(statusOrdered.index(\
361
374
                emesenelib.common.reverse_status[status]))
 
375
                
 
376
        self.changeStatusFlag = True
362
377
 
363
378
    def on_status_changed(self , *args):
364
 
        self.controller.contact_manager.set_status(self.statusListStore.get(\
365
 
            self.get_active_iter(), 1)[0])
366
 
 
 
379
        if self.changeStatusFlag:
 
380
            asd = self.statusListStore.get(self.get_active_iter(), 1)
 
381
            print "on_status_changed", asd
 
382
            self.controller.contacts.set_status(asd[0])