[GTK] Fix unicode warnings on Python 2
GTK3 on Python 2 returns bytes so decode before comparisons.
This commit is contained in:
parent
ab1b2bcf14
commit
9f9f564e62
|
@ -20,7 +20,7 @@ from gi.repository.GdkPixbuf import Pixbuf
|
||||||
from gi.repository.Pango import EllipsizeMode
|
from gi.repository.Pango import EllipsizeMode
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.common import TORRENT_STATE, resource_filename
|
from deluge.common import TORRENT_STATE, decode_bytes, resource_filename
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ class FilterTreeView(component.Component):
|
||||||
|
|
||||||
def render_cell_data(self, column, cell, model, row, data):
|
def render_cell_data(self, column, cell, model, row, data):
|
||||||
cat = model.get_value(row, 0)
|
cat = model.get_value(row, 0)
|
||||||
label = model.get_value(row, 2)
|
label = decode_bytes(model.get_value(row, 2))
|
||||||
count = model.get_value(row, 3)
|
count = model.get_value(row, 3)
|
||||||
|
|
||||||
# Supress Warning: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed
|
# Supress Warning: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed
|
||||||
|
|
|
@ -266,7 +266,8 @@ class ListView(object):
|
||||||
sort = None
|
sort = None
|
||||||
if self.model_filter:
|
if self.model_filter:
|
||||||
sort_id, order = self.model_filter.get_sort_column_id()
|
sort_id, order = self.model_filter.get_sort_column_id()
|
||||||
if self.get_column_name(sort_id) == column.get_title():
|
col_title = decode_bytes(column.get_title())
|
||||||
|
if self.get_column_name(sort_id) == col_title:
|
||||||
sort = sort_id
|
sort = sort_id
|
||||||
|
|
||||||
return ListViewColumnState(
|
return ListViewColumnState(
|
||||||
|
@ -582,7 +583,7 @@ class ListView(object):
|
||||||
column_in_state = False
|
column_in_state = False
|
||||||
if self.state is not None:
|
if self.state is not None:
|
||||||
for column_state in self.state:
|
for column_state in self.state:
|
||||||
if header == column_state.name:
|
if header == decode_bytes(column_state.name):
|
||||||
# We found a loaded state
|
# We found a loaded state
|
||||||
column_in_state = True
|
column_in_state = True
|
||||||
if column_state.width > 0:
|
if column_state.width > 0:
|
||||||
|
|
|
@ -109,7 +109,8 @@ class Preferences(component.Component):
|
||||||
|
|
||||||
# Add and set separator after Plugins.
|
# Add and set separator after Plugins.
|
||||||
def set_separator(model, _iter, data=None):
|
def set_separator(model, _iter, data=None):
|
||||||
if model.get_value(_iter, 1) == '_separator_':
|
entry = deluge.common.decode_bytes(model.get_value(_iter, 1))
|
||||||
|
if entry == '_separator_':
|
||||||
return True
|
return True
|
||||||
|
|
||||||
self.treeview.set_row_separator_func(set_separator, None)
|
self.treeview.set_row_separator_func(set_separator, None)
|
||||||
|
@ -277,7 +278,7 @@ class Preferences(component.Component):
|
||||||
self.iter_to_remove = None
|
self.iter_to_remove = None
|
||||||
|
|
||||||
def on_foreach_row(model, path, _iter, user_data):
|
def on_foreach_row(model, path, _iter, user_data):
|
||||||
row_name = model.get_value(_iter, 1)
|
row_name = deluge.common.decode_bytes(model.get_value(_iter, 1))
|
||||||
if row_name == user_data:
|
if row_name == user_data:
|
||||||
# This is the row we need to remove
|
# This is the row we need to remove
|
||||||
self.page_num_to_remove = model.get_value(_iter, 0)
|
self.page_num_to_remove = model.get_value(_iter, 0)
|
||||||
|
|
Loading…
Reference in New Issue