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="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property> <property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</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> <child>
<widget class="GtkTreeView" id="roster_treeview"> <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="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="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="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> </widget>
</child> </child>
</widget> </widget>

View File

@ -543,8 +543,15 @@ class RosterWindow:
account) account)
def show_tooltip(self, contact, img): def show_tooltip(self, contact, img):
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.tooltip.show_tooltip(contact, img, self.window.get_pointer(),
self.window.get_position()) self.window.get_position())
else:
self.tooltip.hide_tooltip()
def on_roster_treeview_leave_notify_event(self, widget, event): def on_roster_treeview_leave_notify_event(self, widget, event):
model = widget.get_model() 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.remove_user(user1, account)
self.add_contact_to_roster(jid, 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): def on_roster_treeview_key_press_event(self, widget, event):
'''when a key is pressed in the treeviews''' '''when a key is pressed in the treeviews'''
self.tooltip.hide_tooltip()
if event.keyval == gtk.keysyms.Escape: if event.keyval == gtk.keysyms.Escape:
self.tree.get_selection().unselect_all() self.tree.get_selection().unselect_all()
if event.keyval == gtk.keysyms.F2: 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): def on_roster_treeview_button_press_event(self, widget, event):
'''popup contact's, group's or agent's menu''' '''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 if event.button == 3: # Right click
try: try:
path, column, x, y = self.tree.get_path_at_pos(int(event.x), path, column, x, y = self.tree.get_path_at_pos(int(event.x),