Fix get_selected_torrents() when removing multiple torrents.
This commit is contained in:
parent
5ab95814e7
commit
3ccfb4e03e
|
@ -366,7 +366,7 @@ class TorrentView(listview.ListView, component.Component):
|
||||||
self.update()
|
self.update()
|
||||||
break
|
break
|
||||||
row = self.liststore.iter_next(row)
|
row = self.liststore.iter_next(row)
|
||||||
|
|
||||||
def get_selected_torrent(self):
|
def get_selected_torrent(self):
|
||||||
"""Returns a torrent_id or None. If multiple torrents are selected,
|
"""Returns a torrent_id or None. If multiple torrents are selected,
|
||||||
it will return the torrent_id of the first one."""
|
it will return the torrent_id of the first one."""
|
||||||
|
@ -385,15 +385,25 @@ class TorrentView(listview.ListView, component.Component):
|
||||||
return []
|
return []
|
||||||
try:
|
try:
|
||||||
for path in paths:
|
for path in paths:
|
||||||
torrent_ids.append(
|
try:
|
||||||
self.model_filter.get_value(
|
row = self.model_filter.get_iter(path)
|
||||||
self.model_filter.get_iter(path), 0))
|
except Exception, e:
|
||||||
|
log.debug("Unable to get iter from path: %s", e)
|
||||||
if len(torrent_ids) is 0:
|
|
||||||
|
child_row = self.model_filter.convert_iter_to_child_iter(None, row)
|
||||||
|
child_row = self.model_filter.get_model().convert_iter_to_child_iter(child_row)
|
||||||
|
if self.liststore.iter_is_valid(child_row):
|
||||||
|
try:
|
||||||
|
value = self.liststore.get_value(child_row, 0)
|
||||||
|
except Exception, e:
|
||||||
|
log.debug("Unable to get value from row: %s", e)
|
||||||
|
else:
|
||||||
|
torrent_ids.append(value)
|
||||||
|
if len(torrent_ids) == 0:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
return torrent_ids
|
return torrent_ids
|
||||||
except ValueError:
|
except ValueError, TypeError:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_torrent_status(self, torrent_id):
|
def get_torrent_status(self, torrent_id):
|
||||||
|
|
Loading…
Reference in New Issue