[GTK3] Fix UnicodeWarning in row comparison on Python 2

This commit is contained in:
Calum Lind 2018-10-24 11:33:16 +01:00
parent 4a79e1f100
commit bb6e290bf8
2 changed files with 4 additions and 3 deletions

View File

@ -13,7 +13,7 @@ import logging
from xml.sax.saxutils import escape as xml_escape
import deluge.component as component
from deluge.common import fdate, fsize, is_url
from deluge.common import decode_bytes, fdate, fsize, is_url
from .tab_data_funcs import fdate_or_dash, fpieces_num_size
from .torrentdetails import Tab
@ -63,7 +63,7 @@ class DetailsTab(Tab):
# Update all the label widgets
for widget in self.tab_widgets.values():
txt = xml_escape(self.widget_status_as_fstr(widget, status))
if widget.obj.get_text() != txt:
if decode_bytes(widget.obj.get_text()) != txt:
if 'comment' in widget.status_keys and is_url(txt):
widget.obj.set_markup('<a href="%s">%s</a>' % (txt, txt))
else:

View File

@ -20,6 +20,7 @@ from gi.repository.Gtk import EntryIconPosition
from twisted.internet import reactor
import deluge.component as component
from deluge.common import decode_bytes
from deluge.ui.client import client
from . import torrentview_data_funcs as funcs
@ -663,7 +664,7 @@ class TorrentView(ListView, component.Component):
to_update = []
for i, status_field in fields_to_update:
row_value = status[torrent_id][status_field]
if row[i] != row_value:
if decode_bytes(row[i]) != row_value:
to_update.append(i)
to_update.append(row_value)
# Update fields in the liststore