Made focus in the Files tab to work the same way as in torrents list.

This commit is contained in:
Alex Dedul 2007-07-22 17:17:30 +00:00
commit 67976167aa
2 changed files with 30 additions and 7 deletions

View file

@ -77,7 +77,14 @@ class FilesBaseManager(object):
self.file_view.set_model(self.file_store_sorted) self.file_view.set_model(self.file_store_sorted)
self.file_view.get_selection().set_mode(gtk.SELECTION_MULTIPLE) self.file_view.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
try:
self.file_view.get_selection().set_select_function(self.file_clicked,
full=True)
except TypeError:
self.torrent_view.get_selection().set_select_function(self.file_clicked_old)
self.file_view.connect("button-press-event", self.mouse_clicked) self.file_view.connect("button-press-event", self.mouse_clicked)
self.right_click = False
def clear_file_store(self): def clear_file_store(self):
self.file_store.clear() self.file_store.clear()
@ -98,7 +105,6 @@ class FilesBaseManager(object):
msgBox.run() msgBox.run()
msgBox.destroy() msgBox.destroy()
def priority_clicked(self, widget): def priority_clicked(self, widget):
if self.config.get("use_compact_storage"): if self.config.get("use_compact_storage"):
self.compact_warning(widget) self.compact_warning(widget)
@ -119,12 +125,30 @@ class FilesBaseManager(object):
self.update_priorities() self.update_priorities()
def file_clicked_old(self, path):
return self.file_clicked(self.file_view.get_selection(),
self.file_store, path, False)
def file_clicked(self, selection, model, path, is_selected):
if is_selected:
return not self.right_click
return True
def mouse_clicked(self, widget, event): def mouse_clicked(self, widget, event):
if event.button == 3: if event.button == 3:
self.file_view.get_selection().get_selected_rows()[1] data = self.file_view.get_path_at_pos(int(event.x), int(event.y))
if data is None:
return True
path, col, cellx, celly = data
self.right_click = self.file_view.get_selection().path_is_selected(path)
self.file_view.grab_focus()
self.file_view.set_cursor(path, col, 0)
self.file_menu.popup(None, None, None, event.button, event.time) self.file_menu.popup(None, None, None, event.button, event.time)
return False return True
else: else:
self.right_click = False
return False return False
def update_priorities(self): def update_priorities(self):

View file

@ -558,9 +558,8 @@ class DelugeGTK:
def torrent_view_clicked(self, widget, event): def torrent_view_clicked(self, widget, event):
if event.button == 3: if event.button == 3:
x = int(event.x) data = self.torrent_view.get_path_at_pos(int(event.x),
y = int(event.y) int(event.y))
data = self.torrent_view.get_path_at_pos(x, y)
if data is None: if data is None:
return True return True
path, col, cellx, celly = data path, col, cellx, celly = data