can't make it to work [scroll_to CORRECT end]
This commit is contained in:
parent
710d41e2dc
commit
10e2d09595
|
@ -215,7 +215,9 @@ class Chat:
|
||||||
self.xmls[jid].get_widget('conversation_textview')
|
self.xmls[jid].get_widget('conversation_textview')
|
||||||
conversation_buffer = conversation_textview.get_buffer()
|
conversation_buffer = conversation_textview.get_buffer()
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = conversation_buffer.get_end_iter()
|
||||||
conversation_buffer.create_mark('end', end_iter, 0)
|
|
||||||
|
conversation_buffer.create_mark('end', end_iter, False)
|
||||||
|
|
||||||
self.tagIn[jid] = conversation_buffer.create_tag('incoming')
|
self.tagIn[jid] = conversation_buffer.create_tag('incoming')
|
||||||
color = self.plugin.config['inmsgcolor']
|
color = self.plugin.config['inmsgcolor']
|
||||||
self.tagIn[jid].set_property('foreground', color)
|
self.tagIn[jid].set_property('foreground', color)
|
||||||
|
@ -573,7 +575,11 @@ class Chat:
|
||||||
|
|
||||||
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.1, 0, 0, 0)
|
end_iter = buffer.get_end_iter()
|
||||||
|
# go before \n (which is always the last char in a message)
|
||||||
|
end_iter.backward_line() # FIXME: doesn't work as it should
|
||||||
|
buffer.create_mark('end_before_newline', end_iter, True)
|
||||||
|
textview.scroll_to_mark(buffer.get_mark('end_before_newline'), 0.1, 0, 0, 0)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def print_conversation_line(self, text, jid, kind, name, tim, \
|
def print_conversation_line(self, text, jid, kind, name, tim, \
|
||||||
|
@ -634,7 +640,7 @@ 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(100, self.scroll_to_end, conversation_textview)
|
gobject.timeout_add(1000, self.scroll_to_end, conversation_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
|
||||||
|
|
Loading…
Reference in New Issue