Changeset 9727
- Timestamp:
- 05/31/08 21:41:42 (6 months ago)
- Files:
-
- 1 modified
-
trunk/src/history_window.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/history_window.py
r9564 r9727 118 118 self.accounts_seen_online = [] # Update dict when new accounts connect 119 119 self.jids_to_search = [] 120 self._fill_completion_dict() 120 121 # This will load history too 122 gobject.idle_add(self._fill_completion_dict().next) 121 123 122 124 if jid: … … 124 126 125 127 xml.signal_autoconnect(self) 126 self._load_history(jid, account)127 128 self.window.show_all() 128 129 129 130 def _fill_completion_dict(self): 130 '''Fill completion_dict for key auto completion. 131 '''Fill completion_dict for key auto completion. Then load history for 132 current jid (by calling another function). 131 133 132 134 Key will be either jid or full_completion_name … … 134 136 135 137 {key : (jid, account, nick_name, full_completion_name} 138 this is a generator and does pseudo-threading via idle_add() 136 139 ''' 137 140 liststore = gtkgui_helpers.get_completion_liststore(self.jid_entry) … … 151 154 contact_img = gajim.interface.jabber_state_images['16']['online'] 152 155 muc_active_pix = muc_active_img.get_pixbuf() 153 contact_pix = contact_img.get_pixbuf() 156 contact_pix = contact_img.get_pixbuf() 157 154 158 keys = self.completion_dict.keys() 159 # Move the actual jid at first so we load history faster 160 actual_jid = self.jid_entry.get_text().decode('utf-8') 161 keys.remove(actual_jid) 162 keys.insert(0, actual_jid) 155 163 # Map jid to info tuple 156 164 # Warning : This for is time critical with big DB … … 181 189 else: 182 190 pix = contact_pix 183 191 184 192 liststore.append((pix, completed)) 185 193 self.completion_dict[key] = (info_jid, info_acc, info_name, … … 187 195 self.completion_dict[completed] = (info_jid, info_acc, 188 196 info_name, info_completion) 197 if key == actual_jid: 198 self._load_history(info_jid, info_acc) 199 yield True 189 200 keys.sort() 201 yield False 190 202 191 203 def _get_account_for_jid(self, jid): … … 481 493 local_time = time.localtime(tim) 482 494 date = time.strftime('%x', local_time) 483 # jid (to which log is assigned to), name, date, message, time (full unix time) 495 # jid (to which log is assigned to), name, date, message, 496 # time (full unix time) 484 497 model.append((jid, contact_name, date, message, tim)) 485 498 … … 574 587 def open_history(self, jid, account): 575 588 '''Load chat history of the specified jid''' 589 self.jid_entry.set_text(jid) 576 590 if account and account not in self.accounts_seen_online: 577 591 # Update dict to not only show bare jid 578 self._fill_completion_dict 579 self.jid_entry.set_text(jid) 580 self._load_history(jid, account) 592 gobject.idle_add(self._fill_completion_dict().next) 593 else: 594 # Only in that case because it's called by self._fill_completion_dict() 595 # otherwise 596 self._load_history(jid, account) 581 597 self.results_window.set_property('visible', False)
