diff --git a/deluge/ui/client.py b/deluge/ui/client.py
index 6b657d5ca5..c2cfc540db 100644
--- a/deluge/ui/client.py
+++ b/deluge/ui/client.py
@@ -741,6 +741,12 @@ def connection_info(self):
return None
+ def connection_version(self):
+ if self.connected():
+ return self._daemon_proxy.daemon_info
+
+ return ''
+
def register_event_handler(self, event, handler):
"""
Registers a handler that will be called when an event is received from the daemon.
diff --git a/deluge/ui/gtk3/glade/main_window.tabs.ui b/deluge/ui/gtk3/glade/main_window.tabs.ui
index f98a384764..76cd772bde 100644
--- a/deluge/ui/gtk3/glade/main_window.tabs.ui
+++ b/deluge/ui/gtk3/glade/main_window.tabs.ui
@@ -591,7 +591,7 @@
4
- 1
+ 5
@@ -824,7 +824,7 @@
3
- 1
+ 5
diff --git a/deluge/ui/gtk3/trackers_tab.py b/deluge/ui/gtk3/trackers_tab.py
index ce6d40e4a3..f3b8ab8786 100644
--- a/deluge/ui/gtk3/trackers_tab.py
+++ b/deluge/ui/gtk3/trackers_tab.py
@@ -8,9 +8,13 @@
import logging
+from gi.repository.Gdk import EventType
from gi.repository.Gtk import CellRendererText, ListStore, SortType, TreeViewColumn
import deluge.component as component
+from deluge.common import VersionSplit
+from deluge.decorators import maybe_coroutine
+from deluge.ui.client import client
from .tab_data_funcs import ftranslate
from .torrentdetails import Tab
@@ -36,6 +40,8 @@ def __init__(self):
self.trackers = {}
self.constant_rows = {}
+ self._can_get_trackers_info = False
+
# self.treeview.append_column(
# Gtk.TreeViewColumn(_('Tier'), Gtk.CellRendererText(), text=0)
# )
@@ -104,6 +110,16 @@ def _fill_constant_rows(self):
self.constant_rows[item.lower()] = row
def update(self):
+ if client.is_standalone():
+ self._can_get_trackers_info = True
+ else:
+ self._can_get_trackers_info = (
+ VersionSplit(client.connection_version()) > VersionSplit('2.0.5')
+ )
+ self.do_update()
+
+ @maybe_coroutine
+ async def do_update(self):
# Get the first selected torrent
torrent_id = component.get('TorrentView').get_selected_torrents()
@@ -124,24 +140,41 @@ def update(self):
session = component.get('SessionProxy')
- tracker_keys = [
- 'trackers',
- 'trackers_status',
- 'trackers_peers',
- ]
+ if self._can_get_trackers_info:
+ tracker_keys = [
+ 'trackers',
+ 'trackers_status',
+ 'trackers_peers',
+ ]
+ else:
+ tracker_keys = [
+ 'tracker_host',
+ 'tracker_status',
+ ]
+
+ perrs_sources = await session.get_torrent_status(torrent_id, ['peers_source'])
+ self._on_get_peers_source_status(perrs_sources)
- session.get_torrent_status(torrent_id, tracker_keys).addCallback(
- self._on_get_torrent_tracker_status
- )
- session.get_torrent_status(torrent_id, ['peers_source']).addCallback(
- self._on_get_peers_source_status
- )
+ status = await session.get_torrent_status(torrent_id, tracker_keys)
+ self._on_get_torrent_tracker_status(status)
def _on_get_torrent_tracker_status(self, status):
# Check to see if we got valid data from the core
if not status:
return
+ if not self._can_get_trackers_info:
+ status['trackers'] = [
+ {
+ 'url': status['tracker_host'],
+ 'message': ''
+ }
+ ]
+ status['trackers_status'] = {
+ status['tracker_host']: status['tracker_status']
+ }
+ status['trackers_peers'] = {}
+
new_trackers = set()
for tracker in status['trackers']:
new_trackers.add(tracker['url'])
@@ -204,6 +237,8 @@ def _on_button_press_event(self, widget, event):
if event.button == 3:
self.trackers_menu.popup(None, None, None, None, event.button, event.time)
return True
+ elif event.type == EventType.DOUBLE_BUTTON_PRESS:
+ self.on_menuitem_edit_trackers_activate(event.button)
def on_menuitem_edit_trackers_activate(self, button):
torrent_id = component.get('TorrentView').get_selected_torrent()