hide tooltip on certain events

This commit is contained in:
Nikos Kouremenos 2005-07-08 22:26:46 +00:00
parent b8f2740ebe
commit 2aa4f0fa96
2 changed files with 16 additions and 3 deletions

View File

@ -304,7 +304,6 @@
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<signal name="scroll_child" handler="on_scrolledwindow_scroll_child" last_modification_time="Fri, 08 Jul 2005 21:04:28 GMT"/>
<child>
<widget class="GtkTreeView" id="roster_treeview">
@ -321,6 +320,7 @@
<signal name="key_press_event" handler="on_roster_treeview_key_press_event" last_modification_time="Sat, 26 Mar 2005 20:39:36 GMT"/>
<signal name="motion_notify_event" handler="on_roster_treeview_motion_notify_event" last_modification_time="Wed, 06 Jul 2005 14:38:58 GMT"/>
<signal name="leave_notify_event" handler="on_roster_treeview_leave_notify_event" last_modification_time="Wed, 06 Jul 2005 14:39:06 GMT"/>
<signal name="scroll_event" handler="on_roster_treeview_scroll_event" last_modification_time="Fri, 08 Jul 2005 22:09:03 GMT"/>
</widget>
</child>
</widget>

View File

@ -543,8 +543,15 @@ class RosterWindow:
account)
def show_tooltip(self, contact, img):
self.tooltip.show_tooltip(contact, img, self.window.get_pointer(),
self.window.get_position())
pointer = self.tree.get_pointer()
props = self.tree.get_path_at_pos(pointer[0], pointer[1])
if props and self.tooltip.path == props[0]:
# check if the current pointer is at the same path
# as it was before setting the timeout
self.tooltip.show_tooltip(contact, img, self.window.get_pointer(),
self.window.get_position())
else:
self.tooltip.hide_tooltip()
def on_roster_treeview_leave_notify_event(self, widget, event):
model = widget.get_model()
@ -893,8 +900,12 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
self.remove_user(user1, account)
self.add_contact_to_roster(jid, account)
def on_roster_treeview_scroll_event(self, widget, event):
self.tooltip.hide_tooltip()
def on_roster_treeview_key_press_event(self, widget, event):
'''when a key is pressed in the treeviews'''
self.tooltip.hide_tooltip()
if event.keyval == gtk.keysyms.Escape:
self.tree.get_selection().unselect_all()
if event.keyval == gtk.keysyms.F2:
@ -924,6 +935,8 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
def on_roster_treeview_button_press_event(self, widget, event):
'''popup contact's, group's or agent's menu'''
# hide tooltip, whichever button is pressed
self.tooltip.hide_tooltip()
if event.button == 3: # Right click
try:
path, column, x, y = self.tree.get_path_at_pos(int(event.x),