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_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_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="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> </widget>
</child> </child>
</widget> </widget>

View File

@ -697,24 +697,35 @@ class roster_Window:
def on_treeview_event(self, widget, event): def on_treeview_event(self, widget, event):
"""popup user's group's or agent menu""" """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:
try: if event.button == 3:
path, column, x, y = self.tree.get_path_at_pos(int(event.x), \ try:
int(event.y)) path, column, x, y = self.tree.get_path_at_pos(int(event.x), \
except TypeError: int(event.y))
return except TypeError:
model = self.tree.get_model() self.tree.get_selection().unselect_all()
iter = model.get_iter(path) return
type = model.get_value(iter, 2) model = self.tree.get_model()
if type == 'group': iter = model.get_iter(path)
self.mk_menu_g(event) type = model.get_value(iter, 2)
elif type == 'agent': if type == 'group':
self.mk_menu_agent(event, iter) self.mk_menu_g(event)
elif type == 'user': elif type == 'agent':
self.mk_menu_user(event, iter) self.mk_menu_agent(event, iter)
elif type == 'account': elif type == 'user':
self.mk_menu_account(event, iter) self.mk_menu_user(event, iter)
return gtk.TRUE 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 return gtk.FALSE
def on_req_usub(self, widget, user, account): def on_req_usub(self, widget, user, account):