Changeset 9597 for trunk/src/roster_window.py
- Timestamp:
- 05/08/08 23:18:39 (4 months ago)
- Files:
-
- 1 modified
-
trunk/src/roster_window.py (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/roster_window.py
r9595 r9597 247 247 248 248 249 ############################################################################# ###249 ############################################################################# 250 250 ### Methods for adding and removing roster window items 251 ############################################################################# ###251 ############################################################################# 252 252 253 253 def add_account(self, account): … … 318 318 319 319 320 def _add_entity(self, contact, account, groups = None, big_brother_contact = None,321 big_brother_ account = None):320 def _add_entity(self, contact, account, groups = None, 321 big_brother_contact = None, big_brother_account = None): 322 322 '''Add the given contact to roster data model. 323 323 … … 418 418 all_iters = iters[:] 419 419 group_iters = [self._get_group_iter(group, account) for group in groups] 420 iters = [iter for iter in all_iters if self.model.iter_parent(iter) in group_iters] 420 iters = [iter for iter in all_iters 421 if self.model.iter_parent(iter) in group_iters] 421 422 422 423 iter_children = self.model.iter_children(iters[0]) … … 462 463 big_brother_jid = big_brother_data['jid'] 463 464 big_brother_account = big_brother_data['account'] 464 big_brother_contact = gajim.contacts.get_first_contact_from_jid(big_brother_account, big_brother_jid) 465 466 assert len(self._get_contact_iter(big_brother_jid, big_brother_account, big_brother_contact, self.model)) == 0,\ 465 big_brother_contact = gajim.contacts.get_first_contact_from_jid( 466 big_brother_account, big_brother_jid) 467 468 assert len(self._get_contact_iter(big_brother_jid, big_brother_account, 469 big_brother_contact, self.model)) == 0,\ 467 470 "Big brother %s already in roster \n Family: %s" % (big_brother_jid, family) 468 471 self._add_entity(big_brother_contact, big_brother_account) … … 482 485 continue 483 486 484 assert len(self._get_contact_iter(_jid, _account, _contact, self.model) ) == 0,\485 "%s already in roster. \n Family: " % (_jid, nearby_family)487 assert len(self._get_contact_iter(_jid, _account, _contact, self.model) 488 ) == 0, "%s already in roster. \n Family: " % (_jid, nearby_family) 486 489 self._add_entity(_contact, _account, big_brother_contact = big_brother_contact, 487 490 big_brother_account = big_brother_account) … … 518 521 # Only try to remove what is actually in the roster 519 522 continue 520 assert iters, "%s shall be removed but is not in roster \n Family: %s" % (_jid, family) 523 assert iters, "%s shall be removed but is not in roster \ 524 \n Family: %s" % (_jid, family) 521 525 522 526 family_in_roster = True … … 540 544 return False 541 545 542 iters = self._get_contact_iter(old_big_jid, old_big_account, old_big_contact, self.model) 546 iters = self._get_contact_iter(old_big_jid, old_big_account, old_big_contact, 547 self.model) 543 548 assert len(iters) > 0, "Old Big Brother %s is not in roster anymore" % old_big_jid 544 549 assert not self.model.iter_children(iters[0]),\ … … 551 556 ok = self._remove_entity(old_big_contact, old_big_account) 552 557 assert ok, "Old Big Brother %s not removed" % old_big_jid 553 assert len(self._get_contact_iter(old_big_jid, old_big_account, old_big_contact, self.model)) == 0,\ 558 assert len(self._get_contact_iter(old_big_jid, old_big_account, old_big_contact, 559 self.model)) == 0,\ 554 560 "Old Big Brother %s is removed but still in roster" % old_big_jid 555 561 … … 1220 1226 return False 1221 1227 1222 ############################################################################## ##1228 ############################################################################## 1223 1229 ### Roster and Modelfilter handling 1224 ############################################################################## ##1230 ############################################################################## 1225 1231 1226 1232 def _search_roster_func(self, model, column, key, iter): … … 2048 2054 gajim.events.add_event(account, fjid, event) 2049 2055 if popup: 2050 # FIXME: What is happening here. What does "OR he is not in the roster at all" mean 2056 # FIXME: What is happening here. 2057 # What does "OR he is not in the roster at all" mean 2051 2058 if not ctrl: 2052 2059 gajim.interface.new_chat(contact, account, \ … … 3482 3489 3483 3490 def on_model_row_has_child_toggled(self, model, path, iter): 3484 '''This signal is emitted when a row has gotten the first child row or lost its last child row. 3491 '''Called when a row has gotten the first or lost its last child row. 3492 3485 3493 Expand Parent if necessary. 3486 3494 ''' … … 5752 5760 self._music_track_changed_signal = None 5753 5761 gajim.interface.msg_win_mgr = MessageWindowMgr(self.window, self.hpaned) 5754 gajim.interface.msg_win_mgr.connect('window-delete', self.on_message_window_delete) 5762 gajim.interface.msg_win_mgr.connect('window-delete', 5763 self.on_message_window_delete) 5755 5764 self.advanced_menus = [] # We keep them to destroy them 5756 5765 if gajim.config.get('roster_window_skip_taskbar'): … … 5799 5808 self.modelfilter = self.model.filter_new() 5800 5809 self.modelfilter.set_visible_func(self._visible_func) 5801 5802 5803 self. modelfilter.connect('row-has-child-toggled', self.on_model_row_has_child_toggled)5810 self.modelfilter.connect('row-has-child-toggled', 5811 self.on_model_row_has_child_toggled) 5812 self.tree.set_model(self.modelfilter) 5804 5813 # Workaroung: For strange reasons signal is behaving like row-changed 5805 5814 self._toggeling_row = False 5806 5807 self.tree.set_model(self.modelfilter)5808 5815 5809 5816 # when this value become 0 we quit main application. If it's more than 0 … … 5838 5845 for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'): 5839 5846 uf_show = helpers.get_uf_show(show) 5840 liststore.append([uf_show, gajim.interface.jabber_state_images['16'][show], show,5841 True])5847 liststore.append([uf_show, gajim.interface.jabber_state_images['16'][show], 5848 show, True]) 5842 5849 # Add a Separator (self._iter_is_separator() checks on string SEPARATOR) 5843 5850 liststore.append(['SEPARATOR', None, '', True])
