mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 12:04:10 +00:00
Fix #1195 - Right-click selecting issue when switching between files and folders
This commit is contained in:
parent
a710bcaed4
commit
82712c80e1
@ -505,17 +505,15 @@ class FilesTab(Tab):
|
|||||||
# We only care about right-clicks
|
# We only care about right-clicks
|
||||||
if event.button == 3:
|
if event.button == 3:
|
||||||
x, y = event.get_coords()
|
x, y = event.get_coords()
|
||||||
path = self.listview.get_path_at_pos(int(x), int(y))
|
cursor_path = self.listview.get_path_at_pos(int(x), int(y))
|
||||||
if not path:
|
if not cursor_path:
|
||||||
return
|
return
|
||||||
row = self.treestore.get_iter(path[0])
|
|
||||||
|
|
||||||
if self.get_selected_files():
|
paths = self.listview.get_selection().get_selected_rows()[1]
|
||||||
if self.treestore.get_value(row, 5) not in self.get_selected_files():
|
if cursor_path[0] not in paths:
|
||||||
|
row = self.treestore.get_iter(cursor_path[0])
|
||||||
self.listview.get_selection().unselect_all()
|
self.listview.get_selection().unselect_all()
|
||||||
self.listview.get_selection().select_iter(row)
|
self.listview.get_selection().select_iter(row)
|
||||||
else:
|
|
||||||
self.listview.get_selection().select_iter(row)
|
|
||||||
|
|
||||||
for widget in self.file_menu_priority_items:
|
for widget in self.file_menu_priority_items:
|
||||||
widget.set_sensitive(not self.__compact)
|
widget.set_sensitive(not self.__compact)
|
||||||
@ -524,13 +522,13 @@ class FilesTab(Tab):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _on_key_press_event(self, widget, event):
|
def _on_key_press_event(self, widget, event):
|
||||||
if not self.get_selected_files():
|
|
||||||
return
|
|
||||||
|
|
||||||
keyname = gtk.gdk.keyval_name(event.keyval)
|
keyname = gtk.gdk.keyval_name(event.keyval)
|
||||||
func = getattr(self, 'keypress_' + keyname, None)
|
func = getattr(self, 'keypress_' + keyname, None)
|
||||||
if func:
|
selected_rows = self.listview.get_selection().get_selected_rows()[1]
|
||||||
|
if func and selected_rows:
|
||||||
return func(event)
|
return func(event)
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
def keypress_Menu(self, event):
|
def keypress_Menu(self, event):
|
||||||
self.file_menu.popup(None, None, None, 3, event.time)
|
self.file_menu.popup(None, None, None, 3, event.time)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user