elect all rows when escape is pressed or when we click under all rows

This commit is contained in:
Yann Leboulanger 2004-05-18 23:39:11 +00:00
parent 2d35fbcafd
commit 4106ff0f55
2 changed files with 30 additions and 18 deletions

View File

@ -236,6 +236,7 @@
<signal name="row_activated" handler="on_row_activated" last_modification_time="Sun, 12 Oct 2003 18:11:52 GMT"/>
<signal name="row_expanded" handler="on_row_expanded" last_modification_time="Wed, 10 Dec 2003 10:31:44 GMT"/>
<signal name="row_collapsed" handler="on_row_collapsed" last_modification_time="Wed, 10 Dec 2003 10:54:27 GMT"/>
<signal name="key_release_event" handler="on_treeview_event" last_modification_time="Tue, 18 May 2004 23:30:46 GMT"/>
</widget>
</child>
</widget>

View File

@ -697,11 +697,13 @@ class roster_Window:
def on_treeview_event(self, widget, event):
"""popup user's group's or agent menu"""
if (event.button == 3) & (event.type == gtk.gdk.BUTTON_PRESS):
if event.type == gtk.gdk.BUTTON_PRESS:
if event.button == 3:
try:
path, column, x, y = self.tree.get_path_at_pos(int(event.x), \
int(event.y))
except TypeError:
self.tree.get_selection().unselect_all()
return
model = self.tree.get_model()
iter = model.get_iter(path)
@ -715,6 +717,15 @@ class roster_Window:
elif type == 'account':
self.mk_menu_account(event, iter)
return gtk.TRUE
if event.button == 1:
try:
path, column, x, y = self.tree.get_path_at_pos(int(event.x), \
int(event.y))
except TypeError:
self.tree.get_selection().unselect_all()
if event.type == gtk.gdk.KEY_RELEASE:
if event.keyval == gtk.keysyms.Escape:
self.tree.get_selection().unselect_all()
return gtk.FALSE
def on_req_usub(self, widget, user, account):