parent
a19ae26f01
commit
d315135652
175
src/chat.py
175
src/chat.py
|
@ -56,11 +56,11 @@ class Chat:
|
||||||
|
|
||||||
def update_tags(self):
|
def update_tags(self):
|
||||||
for jid in self.tagIn:
|
for jid in self.tagIn:
|
||||||
self.tagIn[jid].set_property('foreground', \
|
self.tagIn[jid].set_property('foreground',
|
||||||
gajim.config.get('inmsgcolor'))
|
gajim.config.get('inmsgcolor'))
|
||||||
self.tagOut[jid].set_property('foreground', \
|
self.tagOut[jid].set_property('foreground',
|
||||||
gajim.config.get('outmsgcolor'))
|
gajim.config.get('outmsgcolor'))
|
||||||
self.tagStatus[jid].set_property('foreground', \
|
self.tagStatus[jid].set_property('foreground',
|
||||||
gajim.config.get('statusmsgcolor'))
|
gajim.config.get('statusmsgcolor'))
|
||||||
|
|
||||||
def update_print_time(self):
|
def update_print_time(self):
|
||||||
|
@ -71,10 +71,13 @@ class Chat:
|
||||||
del self.print_time_timeout_id[jid]
|
del self.print_time_timeout_id[jid]
|
||||||
else:
|
else:
|
||||||
for jid in self.xmls:
|
for jid in self.xmls:
|
||||||
if not self.print_time_timeout_id.has_key(jid):
|
if self.print_time_timeout_id.has_key(jid):
|
||||||
|
continue
|
||||||
self.print_time_timeout(jid)
|
self.print_time_timeout(jid)
|
||||||
self.print_time_timeout_id[jid] = gobject.timeout_add(300000, \
|
self.print_time_timeout_id[jid] = \
|
||||||
self.print_time_timeout, jid)
|
gobject.timeout_add(300000,
|
||||||
|
self.print_time_timeout,
|
||||||
|
jid)
|
||||||
|
|
||||||
def show_title(self):
|
def show_title(self):
|
||||||
"""redraw the window's title"""
|
"""redraw the window's title"""
|
||||||
|
@ -87,15 +90,14 @@ class Chat:
|
||||||
elif unread == 1:
|
elif unread == 1:
|
||||||
start = '* '
|
start = '* '
|
||||||
chat = self.names[jid]
|
chat = self.names[jid]
|
||||||
if len(self.xmls) > 1: # if more than one tabs in the same window
|
if len(self.xmls) > 1: # if more than one tab in the same window
|
||||||
if self.widget_name == 'tabbed_chat_window':
|
if self.widget_name == 'tabbed_chat_window':
|
||||||
chat = 'Chat'
|
chat = 'Chat'
|
||||||
elif self.widget_name == 'groupchat_window':
|
elif self.widget_name == 'groupchat_window':
|
||||||
chat = 'Groupchat'
|
chat = 'Groupchat'
|
||||||
if len(gajim.connections) >= 2: # if we have 2 or more accounts
|
|
||||||
title = start + chat + ' (account: ' + self.account + ')'
|
|
||||||
else:
|
|
||||||
title = start + chat
|
title = start + chat
|
||||||
|
if len(gajim.connections) >= 2: # if we have 2 or more accounts
|
||||||
|
title = title + ' (account: ' + self.account + ')'
|
||||||
|
|
||||||
self.window.set_title(title)
|
self.window.set_title(title)
|
||||||
|
|
||||||
|
@ -122,8 +124,8 @@ class Chat:
|
||||||
del self.plugin.windows[self.account][kind]['tabbed']
|
del self.plugin.windows[self.account][kind]['tabbed']
|
||||||
|
|
||||||
def get_active_jid(self):
|
def get_active_jid(self):
|
||||||
active_child = self.notebook.get_nth_page(\
|
notebook = self.notebook
|
||||||
self.notebook.get_current_page())
|
active_child = notebook.get_nth_page(notebook.get_current_page())
|
||||||
active_jid = ''
|
active_jid = ''
|
||||||
for jid in self.xmls:
|
for jid in self.xmls:
|
||||||
if self.childs[jid] == active_child:
|
if self.childs[jid] == active_child:
|
||||||
|
@ -138,12 +140,11 @@ class Chat:
|
||||||
def on_chat_window_focus_in_event(self, widget, event):
|
def on_chat_window_focus_in_event(self, widget, event):
|
||||||
"""When window get focus"""
|
"""When window get focus"""
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
conversation_textview = self.xmls[jid].\
|
textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
get_widget('conversation_textview')
|
buffer = textview.get_buffer()
|
||||||
conversation_buffer = conversation_textview.get_buffer()
|
end_iter = buffer.get_end_iter()
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_rect = textview.get_iter_location(end_iter)
|
||||||
end_rect = conversation_textview.get_iter_location(end_iter)
|
visible_rect = textview.get_visible_rect()
|
||||||
visible_rect = conversation_textview.get_visible_rect()
|
|
||||||
if end_rect.y <= (visible_rect.y + visible_rect.height):
|
if end_rect.y <= (visible_rect.y + visible_rect.height):
|
||||||
#we are at the end
|
#we are at the end
|
||||||
if self.nb_unread[jid] > 0:
|
if self.nb_unread[jid] > 0:
|
||||||
|
@ -160,6 +161,7 @@ class Chat:
|
||||||
if self.childs[jid] == new_child:
|
if self.childs[jid] == new_child:
|
||||||
new_jid = jid
|
new_jid = jid
|
||||||
break
|
break
|
||||||
|
|
||||||
conversation_textview = self.xmls[new_jid].\
|
conversation_textview = self.xmls[new_jid].\
|
||||||
get_widget('conversation_textview')
|
get_widget('conversation_textview')
|
||||||
conversation_buffer = conversation_textview.get_buffer()
|
conversation_buffer = conversation_textview.get_buffer()
|
||||||
|
@ -182,7 +184,7 @@ class Chat:
|
||||||
def remove_tab(self, jid, kind): #kind is 'chats' or 'gc'
|
def remove_tab(self, jid, kind): #kind is 'chats' or 'gc'
|
||||||
if len(self.xmls) == 1:
|
if len(self.xmls) == 1:
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
else:
|
return
|
||||||
if self.nb_unread[jid] > 0:
|
if self.nb_unread[jid] > 0:
|
||||||
self.nb_unread[jid] = 0
|
self.nb_unread[jid] = 0
|
||||||
self.show_title()
|
self.show_title()
|
||||||
|
@ -297,8 +299,8 @@ class Chat:
|
||||||
elif event.keyval == gtk.keysyms.F4 and \
|
elif event.keyval == gtk.keysyms.F4 and \
|
||||||
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + F4
|
(event.state & gtk.gdk.CONTROL_MASK): # CTRL + F4
|
||||||
self.remove_tab(jid)
|
self.remove_tab(jid)
|
||||||
elif event.string and event.string in st \
|
elif event.string and event.string in st and \
|
||||||
and (event.state & gtk.gdk.MOD1_MASK): # alt + 1,2,3..
|
(event.state & gtk.gdk.MOD1_MASK): # alt + 1,2,3..
|
||||||
self.notebook.set_current_page(st.index(event.string))
|
self.notebook.set_current_page(st.index(event.string))
|
||||||
elif event.keyval == gtk.keysyms.Page_Down:
|
elif event.keyval == gtk.keysyms.Page_Down:
|
||||||
if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN
|
if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN
|
||||||
|
@ -326,10 +328,8 @@ class Chat:
|
||||||
# or event.keyval == gtk.keysyms.KP_Up
|
# or event.keyval == gtk.keysyms.KP_Up
|
||||||
elif event.keyval == gtk.keysyms.Up:
|
elif event.keyval == gtk.keysyms.Up:
|
||||||
if event.state & gtk.gdk.SHIFT_MASK: # SHIFT + UP
|
if event.state & gtk.gdk.SHIFT_MASK: # SHIFT + UP
|
||||||
print 'be' # FIXME: find a way to to keyUP in scrolledwindow
|
conversation_scrolledwindow = self.xml.get_widget('conversation_scrolledwindow')
|
||||||
conversation_scrolledwindow = self.xml.get_widget\
|
conversation_scrolledwindow.emit('scroll-child',
|
||||||
('conversation_scrolledwindow')
|
|
||||||
conversation_scrolledwindow.emit('scroll-child', \
|
|
||||||
gtk.SCROLL_PAGE_BACKWARD, False)
|
gtk.SCROLL_PAGE_BACKWARD, False)
|
||||||
elif event.hardware_keycode == 23: # TAB
|
elif event.hardware_keycode == 23: # TAB
|
||||||
if (event.state & gtk.gdk.CONTROL_MASK) and \
|
if (event.state & gtk.gdk.CONTROL_MASK) and \
|
||||||
|
@ -345,10 +345,12 @@ class Chat:
|
||||||
self.notebook.set_current_page(current + 1)
|
self.notebook.set_current_page(current + 1)
|
||||||
else:
|
else:
|
||||||
self.notebook.set_current_page(0)
|
self.notebook.set_current_page(0)
|
||||||
elif (event.state & gtk.gdk.CONTROL_MASK) or (event.keyval ==\
|
elif (event.state & gtk.gdk.CONTROL_MASK) or \
|
||||||
gtk.keysyms.Control_L) or (event.keyval == gtk.keysyms.Control_R):
|
(event.keyval == gtk.keysyms.Control_L) or \
|
||||||
# we pressed a control key or ctrl+sth: we don't block the event
|
(event.keyval == gtk.keysyms.Control_R):
|
||||||
# in order to let ctrl+c (copy text) and others do their default work
|
# we pressed a control key or ctrl+sth: we don't block
|
||||||
|
# the event in order to let ctrl+c (copy text) and
|
||||||
|
# others do their default work
|
||||||
pass
|
pass
|
||||||
else: # it's a normal key press make sure message_textview has focus
|
else: # it's a normal key press make sure message_textview has focus
|
||||||
message_textview = self.xmls[jid].get_widget('message_textview')
|
message_textview = self.xmls[jid].get_widget('message_textview')
|
||||||
|
@ -360,11 +362,11 @@ class Chat:
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
if not self.nb_unread[jid]:
|
if not self.nb_unread[jid]:
|
||||||
return
|
return
|
||||||
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
conversation_buffer = conversation_textview.get_buffer()
|
buffer = textview.get_buffer()
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = buffer.get_end_iter()
|
||||||
end_rect = conversation_textview.get_iter_location(end_iter)
|
end_rect = textview.get_iter_location(end_iter)
|
||||||
visible_rect = conversation_textview.get_visible_rect()
|
visible_rect = textview.get_visible_rect()
|
||||||
if end_rect.y <= (visible_rect.y + visible_rect.height) and \
|
if end_rect.y <= (visible_rect.y + visible_rect.height) and \
|
||||||
self.window.is_active():
|
self.window.is_active():
|
||||||
#we are at the end
|
#we are at the end
|
||||||
|
@ -383,24 +385,30 @@ class Chat:
|
||||||
widget.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(\
|
widget.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(\
|
||||||
gtk.gdk.Cursor(gtk.gdk.XTERM))
|
gtk.gdk.Cursor(gtk.gdk.XTERM))
|
||||||
self.change_cursor = None
|
self.change_cursor = None
|
||||||
|
tag_table = widget.get_buffer().get_tag_table()
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
if tag == widget.get_buffer().get_tag_table().lookup('url') or \
|
if tag_table.lookup('url') or tag_table.lookup('mail'):
|
||||||
tag == widget.get_buffer().get_tag_table().lookup('mail'):
|
|
||||||
widget.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(\
|
widget.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(\
|
||||||
gtk.gdk.Cursor(gtk.gdk.HAND2))
|
gtk.gdk.Cursor(gtk.gdk.HAND2))
|
||||||
self.change_cursor = tag
|
self.change_cursor = tag
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def on_conversation_textview_button_press_event(self, widget, event):
|
def on_conversation_textview_button_press_event(self, widget, event):
|
||||||
# Do not open the standard popup menu, so we block right button click
|
# Do not open the standard popup menu, so we block right button
|
||||||
# on a taged text
|
# click on a taged text
|
||||||
if event.button == 3:
|
|
||||||
|
if event.button != 3:
|
||||||
|
return False
|
||||||
|
|
||||||
win = widget.get_window(gtk.TEXT_WINDOW_TEXT)
|
win = widget.get_window(gtk.TEXT_WINDOW_TEXT)
|
||||||
x, y = widget.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,\
|
x, y = widget.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,\
|
||||||
int(event.x), int(event.y))
|
int(event.x), int(event.y))
|
||||||
iter = widget.get_iter_at_location(x, y)
|
iter = widget.get_iter_at_location(x, y)
|
||||||
tags = iter.get_tags()
|
tags = iter.get_tags()
|
||||||
if tags:
|
|
||||||
|
if not tags:
|
||||||
|
return False
|
||||||
|
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
tag_name = tag.get_property('name')
|
tag_name = tag.get_property('name')
|
||||||
if 'url' in tag_name or 'mail' in tag_name:
|
if 'url' in tag_name or 'mail' in tag_name:
|
||||||
|
@ -410,21 +418,21 @@ class Chat:
|
||||||
if not jid in self.xmls.keys():
|
if not jid in self.xmls.keys():
|
||||||
return 0
|
return 0
|
||||||
if gajim.config.get('print_time') == 'sometimes':
|
if gajim.config.get('print_time') == 'sometimes':
|
||||||
conversation_textview = self.xmls[jid].\
|
textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
get_widget('conversation_textview')
|
buffer = textview.get_buffer()
|
||||||
conversation_buffer = conversation_textview.get_buffer()
|
end_iter = buffer.get_end_iter()
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
|
||||||
tim = time.localtime()
|
tim = time.localtime()
|
||||||
tim_format = time.strftime('%H:%M', tim)
|
tim_format = time.strftime('%H:%M', tim)
|
||||||
conversation_buffer.insert_with_tags_by_name(end_iter, tim_format + \
|
buffer.insert_with_tags_by_name(end_iter,
|
||||||
'\n', 'time_sometimes')
|
tim_format + '\n',
|
||||||
|
'time_sometimes')
|
||||||
#scroll to the end of the textview
|
#scroll to the end of the textview
|
||||||
end_rect = conversation_textview.get_iter_location(end_iter)
|
end_rect = textview.get_iter_location(end_iter)
|
||||||
visible_rect = conversation_textview.get_visible_rect()
|
visible_rect = textview.get_visible_rect()
|
||||||
if end_rect.y <= (visible_rect.y + visible_rect.height):
|
if end_rect.y <= (visible_rect.y + visible_rect.height):
|
||||||
#we are at the end
|
#we are at the end
|
||||||
conversation_textview.scroll_to_mark(conversation_buffer.\
|
textview.scroll_to_mark(buffer.get_mark('end'),
|
||||||
get_mark('end'), 0.1, 0, 0, 0)
|
0.1, 0, 0, 0)
|
||||||
return 1
|
return 1
|
||||||
if self.print_time_timeout_id.has_key(jid):
|
if self.print_time_timeout_id.has_key(jid):
|
||||||
del self.print_time_timeout_id[jid]
|
del self.print_time_timeout_id[jid]
|
||||||
|
@ -481,10 +489,10 @@ class Chat:
|
||||||
buffer.apply_tag_by_name(tag, begin_tagged, iter)
|
buffer.apply_tag_by_name(tag, begin_tagged, iter)
|
||||||
buffer.delete_mark(begin_mark)
|
buffer.delete_mark(begin_mark)
|
||||||
|
|
||||||
def detect_and_print_special_text(self, otext, jid, other_tags, \
|
def detect_and_print_special_text(self, otext, jid, other_tags,
|
||||||
print_all_special):
|
print_all_special):
|
||||||
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
conversation_buffer = conversation_textview.get_buffer()
|
buffer = textview.get_buffer()
|
||||||
|
|
||||||
start = 0
|
start = 0
|
||||||
end = 0
|
end = 0
|
||||||
|
@ -500,22 +508,25 @@ class Chat:
|
||||||
special_text = otext[start:end]
|
special_text = otext[start:end]
|
||||||
if start != 0:
|
if start != 0:
|
||||||
text_before_special_text = otext[index:start]
|
text_before_special_text = otext[index:start]
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = buffer.get_end_iter()
|
||||||
if print_all_special:
|
if print_all_special:
|
||||||
self.print_with_tag_list(conversation_buffer, \
|
self.print_with_tag_list(buffer,
|
||||||
text_before_special_text, end_iter, other_tags)
|
text_before_special_text,
|
||||||
|
end_iter, other_tags)
|
||||||
else:
|
else:
|
||||||
conversation_buffer.insert(end_iter, text_before_special_text)
|
buffer.insert(end_iter,
|
||||||
|
text_before_special_text)
|
||||||
if not print_all_special:
|
if not print_all_special:
|
||||||
other_tags = []
|
other_tags = []
|
||||||
index = end # update index
|
index = end # update index
|
||||||
|
|
||||||
#now print it
|
#now print it
|
||||||
self.print_special_text(special_text, other_tags, conversation_buffer)
|
self.print_special_text(special_text, other_tags,
|
||||||
|
buffer)
|
||||||
|
|
||||||
return index
|
return index
|
||||||
|
|
||||||
def print_special_text(self, special_text, other_tags, conversation_buffer):
|
def print_special_text(self, special_text, other_tags, buffer):
|
||||||
tags = []
|
tags = []
|
||||||
use_other_tags = True
|
use_other_tags = True
|
||||||
|
|
||||||
|
@ -523,8 +534,8 @@ class Chat:
|
||||||
if possible_emot_ascii_caps in self.plugin.emoticons.keys():
|
if possible_emot_ascii_caps in self.plugin.emoticons.keys():
|
||||||
#it's an emoticon
|
#it's an emoticon
|
||||||
emot_ascii = possible_emot_ascii_caps
|
emot_ascii = possible_emot_ascii_caps
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = buffer.get_end_iter()
|
||||||
conversation_buffer.insert_pixbuf(end_iter, \
|
buffer.insert_pixbuf(end_iter,
|
||||||
self.plugin.emoticons[emot_ascii])
|
self.plugin.emoticons[emot_ascii])
|
||||||
elif special_text.startswith('mailto:'):
|
elif special_text.startswith('mailto:'):
|
||||||
#it's a mail
|
#it's a mail
|
||||||
|
@ -570,41 +581,42 @@ class Chat:
|
||||||
use_other_tags = False
|
use_other_tags = False
|
||||||
|
|
||||||
if len(tags) > 0:
|
if len(tags) > 0:
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = buffer.get_end_iter()
|
||||||
all_tags = tags[:]
|
all_tags = tags[:]
|
||||||
if use_other_tags:
|
if use_other_tags:
|
||||||
all_tags += other_tags
|
all_tags += other_tags
|
||||||
self.print_with_tag_list(conversation_buffer, special_text, end_iter, \
|
self.print_with_tag_list(buffer, special_text,
|
||||||
all_tags)
|
end_iter, all_tags)
|
||||||
|
|
||||||
def scroll_to_end(self, textview):
|
def scroll_to_end(self, textview):
|
||||||
buffer = textview.get_buffer()
|
buffer = textview.get_buffer()
|
||||||
textview.scroll_to_mark(buffer.get_mark('end'), 0, True, 0, 1)
|
textview.scroll_to_mark(buffer.get_mark('end'), 0, True, 0, 1)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def print_conversation_line(self, text, jid, kind, name, tim, \
|
def print_conversation_line(self, text, jid, kind, name, tim,
|
||||||
other_tags_for_name = []):
|
other_tags_for_name = []):
|
||||||
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
conversation_buffer = conversation_textview.get_buffer()
|
buffer = textview.get_buffer()
|
||||||
print_all_special = False
|
print_all_special = False
|
||||||
at_the_end = False
|
at_the_end = False
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = buffer.get_end_iter()
|
||||||
end_rect = conversation_textview.get_iter_location(end_iter)
|
end_rect = textview.get_iter_location(end_iter)
|
||||||
visible_rect = conversation_textview.get_visible_rect()
|
visible_rect = textview.get_visible_rect()
|
||||||
if end_rect.y <= (visible_rect.y + visible_rect.height):
|
if end_rect.y <= (visible_rect.y + visible_rect.height):
|
||||||
at_the_end = True
|
at_the_end = True
|
||||||
if not text:
|
if not text:
|
||||||
text = ''
|
text = ''
|
||||||
if conversation_buffer.get_char_count() > 0:
|
if buffer.get_char_count() > 0:
|
||||||
conversation_buffer.insert(end_iter, '\n')
|
buffer.insert(end_iter, '\n')
|
||||||
if gajim.config.get('print_time') == 'always':
|
if gajim.config.get('print_time') == 'always':
|
||||||
if not tim:
|
if not tim:
|
||||||
tim = time.localtime()
|
tim = time.localtime()
|
||||||
self.before_time_symbols = gajim.config.get('before_time')
|
self.before_time_symbols = gajim.config.get('before_time')
|
||||||
self.after_time_symbols = gajim.config.get('after_time')
|
self.after_time_symbols = gajim.config.get('after_time')
|
||||||
format = self.before_time_symbols + '%H:%M:%S' + self.after_time_symbols
|
format = self.before_time_symbols + '%H:%M:%S' + \
|
||||||
|
self.after_time_symbols
|
||||||
tim_format = time.strftime(format, tim)
|
tim_format = time.strftime(format, tim)
|
||||||
conversation_buffer.insert(end_iter, tim_format + ' ')
|
buffer.insert(end_iter, tim_format + ' ')
|
||||||
|
|
||||||
if kind == 'status':
|
if kind == 'status':
|
||||||
print_all_special = True
|
print_all_special = True
|
||||||
|
@ -625,16 +637,16 @@ class Chat:
|
||||||
self.print_with_tag_list(conversation_buffer, format, end_iter, tags)
|
self.print_with_tag_list(conversation_buffer, format, end_iter, tags)
|
||||||
|
|
||||||
# detect urls formatting and if the user has it on emoticons
|
# detect urls formatting and if the user has it on emoticons
|
||||||
index = self.detect_and_print_special_text(text, jid, \
|
index = self.detect_and_print_special_text(text, jid,
|
||||||
tags, print_all_special)
|
tags, print_all_special)
|
||||||
|
|
||||||
# add the rest of text located in the index and after
|
# add the rest of text located in the index and after
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = buffer.get_end_iter()
|
||||||
if print_all_special:
|
if print_all_special:
|
||||||
conversation_buffer.insert_with_tags_by_name(end_iter, text[index:], \
|
buffer.insert_with_tags_by_name(end_iter,
|
||||||
kind)
|
text[index:], kind)
|
||||||
else:
|
else:
|
||||||
conversation_buffer.insert(end_iter, text[index:])
|
buffer.insert(end_iter, text[index:])
|
||||||
|
|
||||||
#scroll to the end of the textview
|
#scroll to the end of the textview
|
||||||
end = False
|
end = False
|
||||||
|
@ -642,8 +654,9 @@ class Chat:
|
||||||
#we are at the end or we are sending something
|
#we are at the end or we are sending something
|
||||||
end = True
|
end = True
|
||||||
# We scroll to the end after the scrollbar has appeared
|
# We scroll to the end after the scrollbar has appeared
|
||||||
gobject.timeout_add(50, self.scroll_to_end, conversation_textview)
|
gobject.timeout_add(50, self.scroll_to_end, textview)
|
||||||
if ((jid != self.get_active_jid()) or (not self.window.is_active()) or \
|
if ((jid != self.get_active_jid()) or \
|
||||||
|
(not self.window.is_active()) or \
|
||||||
(not end)) and kind == 'incoming':
|
(not end)) and kind == 'incoming':
|
||||||
self.nb_unread[jid] += 1
|
self.nb_unread[jid] += 1
|
||||||
if self.plugin.systray_enabled:
|
if self.plugin.systray_enabled:
|
||||||
|
|
Loading…
Reference in New Issue