comit better logic for focus-out line

This commit is contained in:
Nikos Kouremenos 2005-10-07 23:17:17 +00:00
parent 835e48b64d
commit f847084593
1 changed files with 16 additions and 8 deletions

View File

@ -192,7 +192,14 @@ class GroupchatWindow(chat.Chat):
def check_and_possibly_add_focus_out_line(self, room_jid): def check_and_possibly_add_focus_out_line(self, room_jid):
'''checks and possibly adds focus out line for room(s) that need it '''checks and possibly adds focus out line for room(s) that need it
and do not already have it as last event''' and do not already have it as last event. If it goes to add this line
it removes previous line first'''
if room_jid == self.get_active_jid() and self.window.get_property('has-toplevel-focus'):
# it's the current room and it's the focused window.
# we have full focus (we are reading it!)
return
print_focus_out_line = False print_focus_out_line = False
textview = self.xmls[room_jid].get_widget('conversation_textview') textview = self.xmls[room_jid].get_widget('conversation_textview')
buffer = textview.get_buffer() buffer = textview.get_buffer()
@ -223,7 +230,6 @@ class GroupchatWindow(chat.Chat):
buffer.delete(begin_iter_for_previous_line, buffer.delete(begin_iter_for_previous_line,
end_iter_for_previous_line) end_iter_for_previous_line)
# add the new focus out line # add the new focus out line
dash_char = unicodedata.lookup( dash_char = unicodedata.lookup(
'BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL').encode('utf-8') 'BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL').encode('utf-8')
@ -242,8 +248,9 @@ class GroupchatWindow(chat.Chat):
def on_groupchat_window_focus_out_event(self, widget, event): def on_groupchat_window_focus_out_event(self, widget, event):
'''When window loses focus, we print focus-out-line in every tab''' '''When window loses focus, we print focus-out-line in every tab'''
for room_jid in self.xmls: pass
self.check_and_possibly_add_focus_out_line(room_jid) #for room_jid in self.xmls:
# self.check_and_possibly_add_focus_out_line(room_jid)
def on_chat_notebook_key_press_event(self, widget, event): def on_chat_notebook_key_press_event(self, widget, event):
chat.Chat.on_chat_notebook_key_press_event(self, widget, event) chat.Chat.on_chat_notebook_key_press_event(self, widget, event)
@ -936,11 +943,10 @@ current room topic.') % command, room_jid)
kind = 'status' kind = 'status'
# Highlighting and sounds
nick = self.nicks[room_jid] nick = self.nicks[room_jid]
if kind == 'incoming': if kind == 'incoming': # it's a message NOT from us
# highlighting and sounds
(highlight, sound) = self.highlighting_for_message(text, nick, tim) (highlight, sound) = self.highlighting_for_message(text, nick, tim)
if highlight: if highlight:
other_tags_for_name.append('bold') other_tags_for_name.append('bold')
@ -950,6 +956,8 @@ current room topic.') % command, room_jid)
elif sound == 'highlight': elif sound == 'highlight':
helpers.play_sound('muc_message_highlight') helpers.play_sound('muc_message_highlight')
self.check_and_possibly_add_focus_out_line(room_jid)
chat.Chat.print_conversation_line(self, text, room_jid, kind, contact, chat.Chat.print_conversation_line(self, text, room_jid, kind, contact,
tim, other_tags_for_name, [], other_tags_for_text) tim, other_tags_for_name, [], other_tags_for_text)