commit almost there code for tooltip over ---- line. Dimitur plz read this commit and FIXME I have

This commit is contained in:
Nikos Kouremenos 2005-10-08 16:47:35 +00:00
parent 4d15c54010
commit c8602d63c4
3 changed files with 25 additions and 9 deletions

View file

@ -25,6 +25,7 @@ import time
import dialogs
import history_window
import gtkgui_helpers
import tooltips
try:
import gtkspell
@ -844,8 +845,9 @@ class Chat:
def on_conversation_textview_motion_notify_event(self, widget, event):
'''change the cursor to a hand when we are over a mail or an url'''
jid = self.get_active_jid()
x, y, spam = widget.window.get_pointer()
x, y = widget.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, x, y)
pointer_x, pointer_y, spam = widget.window.get_pointer()
x, y = widget.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, pointer_x,
pointer_y)
tags = widget.get_iter_at_location(x, y).get_tags()
if self.change_cursor:
widget.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
@ -853,11 +855,24 @@ class Chat:
self.change_cursor = None
tag_table = widget.get_buffer().get_tag_table()
for tag in tags:
if tag == tag_table.lookup('url') or tag == tag_table.lookup('mail'):
if tag in (tag_table.lookup('url'), tag_table.lookup('mail')):
widget.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
gtk.gdk.Cursor(gtk.gdk.HAND2))
self.change_cursor = tag
return False
elif self.widget_name == 'groupchat_window' and \
tag == tag_table.lookup('focus-out-line'):
widget.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(
gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
self.change_cursor = tag
tooltip = tooltips.BaseTooltip()
message = _('abcdoremi')
# FIXME: found out (dkirov can help) what those params are supposed to be
# FIXME: also fix tooltips.py docstrings and comments (imporve and add more)
# to explain it better as atm it's poor
#tooltip.show_tooltip(message, (pointer_x, pointer_y), (pointer_x, pointer_y))
if tooltip.timeout != 0:
tooltip.hide_tooltip()
def on_clear(self, widget, textview):
'''clear text in the given textview'''

View file

@ -656,10 +656,10 @@ class RosterWindow:
if props and self.tooltip.id == props[0]:
# check if the current pointer is at the same path
# as it was before setting the timeout
rect = self.tree.get_cell_area(props[0],props[1])
rect = self.tree.get_cell_area(props[0], props[1])
position = self.tree.window.get_origin()
pointer = self.window.get_pointer()
self.tooltip.show_tooltip(contact, (pointer[0], rect.height ),
self.tooltip.show_tooltip(contact, (pointer[0], rect.height),
(position[0], position[1] + rect.y))
else:
self.tooltip.hide_tooltip()

View file

@ -32,10 +32,11 @@ _ = i18n._
APP = i18n.APP
class BaseTooltip:
''' Base Tooltip . Usage:
''' Base Tooltip; Usage:
tooltip = BaseTooltip()
....
tooltip.show_tooltip('', window_postions, widget_postions)
tooltip.show_tooltip('', window_positions, widget_positions)
#FIXME: what is window, what is widget?
....
if tooltip.timeout != 0:
tooltip.hide_tooltip()
@ -108,7 +109,7 @@ class BaseTooltip:
self.win.show_all()
def hide_tooltip(self):
if(self.timeout > 0):
if self.timeout > 0:
gobject.source_remove(self.timeout)
self.timeout = 0
if self.win: