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
parent 2c746a3ee9
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.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.right_click = False
def clear_file_store(self):
self.file_store.clear()
@ -97,7 +104,6 @@ class FilesBaseManager(object):
message_format = (_("File priority can only be set when using full allocation.\nPlease change your preference to disable compact allocation, then remove and readd this torrent.")))
msgBox.run()
msgBox.destroy()
def priority_clicked(self, widget):
if self.config.get("use_compact_storage"):
@ -118,13 +124,31 @@ class FilesBaseManager(object):
priority)
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):
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)
return False
return True
else:
self.right_click = False
return False
def update_priorities(self):

View file

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