mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-16 21:36:40 +00:00
[GTK3] Use decode_bytes from method returns
Python3 PyGObject automatically encodes/decodes strings to and from methods. This does not happen on Python 2 so for compatibility use decode_bytes.
This commit is contained in:
parent
ae0b072b75
commit
14b6ba10cf
@ -711,7 +711,7 @@ class AddTorrentDialog(component.Component):
|
||||
response = dialog.run()
|
||||
|
||||
if response == Gtk.ResponseType.OK:
|
||||
url = entry.get_text().decode('utf-8')
|
||||
url = deluge.common.decode_bytes(entry.get_text())
|
||||
else:
|
||||
url = None
|
||||
|
||||
|
@ -18,7 +18,7 @@ from gi.repository.GObject import TYPE_UINT64, idle_add
|
||||
from twisted.internet.threads import deferToThread
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.common import get_path_size, is_url, resource_filename
|
||||
from deluge.common import decode_bytes, get_path_size, is_url, resource_filename
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.ui.client import client
|
||||
|
||||
@ -149,7 +149,7 @@ class CreateTorrentDialog(object):
|
||||
chooser.destroy()
|
||||
return
|
||||
|
||||
path = result.decode('utf-8')
|
||||
path = decode_bytes(result)
|
||||
|
||||
self.files_treestore.clear()
|
||||
self.files_treestore.append(None, [result, Gtk.STOCK_FILE, get_path_size(path)])
|
||||
@ -183,7 +183,7 @@ class CreateTorrentDialog(object):
|
||||
chooser.destroy()
|
||||
return
|
||||
|
||||
path = result.decode('utf-8')
|
||||
path = decode_bytes(result)
|
||||
|
||||
self.files_treestore.clear()
|
||||
self.files_treestore.append(None, [result, Gtk.STOCK_OPEN, get_path_size(path)])
|
||||
@ -340,11 +340,11 @@ class CreateTorrentDialog(object):
|
||||
)
|
||||
|
||||
client.core.create_torrent(
|
||||
path,
|
||||
decode_bytes(path),
|
||||
tracker,
|
||||
piece_length,
|
||||
comment,
|
||||
result,
|
||||
decode_bytes(result),
|
||||
webseeds,
|
||||
private,
|
||||
author,
|
||||
@ -359,12 +359,12 @@ class CreateTorrentDialog(object):
|
||||
|
||||
deferToThread(
|
||||
self.create_torrent,
|
||||
path.decode('utf-8'),
|
||||
decode_bytes(path),
|
||||
tracker,
|
||||
piece_length,
|
||||
self._on_create_torrent_progress,
|
||||
comment,
|
||||
result.decode('utf-8'),
|
||||
decode_bytes(result),
|
||||
webseeds,
|
||||
private,
|
||||
author,
|
||||
|
@ -162,7 +162,7 @@ class QueuedTorrents(component.Component):
|
||||
def on_button_add_clicked(self, widget):
|
||||
# Add all the torrents in the liststore
|
||||
def add_torrent(model, path, _iter, data):
|
||||
torrent_path = model.get_value(_iter, 1).decode('utf-8')
|
||||
torrent_path = deluge.common.decode_bytes(model.get_value(_iter, 1))
|
||||
process_args([torrent_path])
|
||||
|
||||
self.liststore.foreach(add_torrent, None)
|
||||
|
@ -12,7 +12,7 @@ from __future__ import division, unicode_literals
|
||||
import logging
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.common import fpeer
|
||||
from deluge.common import decode_bytes, fpeer
|
||||
from deluge.configmanager import ConfigManager
|
||||
|
||||
from .piecesbar import PiecesBar
|
||||
@ -107,7 +107,7 @@ class StatusTab(Tab):
|
||||
# Update all the label widgets
|
||||
for widget in self.tab_widgets.values():
|
||||
txt = self.widget_status_as_fstr(widget, status)
|
||||
if widget[0].get_text().decode('utf-8') != txt:
|
||||
if decode_bytes(widget[0].get_text()) != txt:
|
||||
widget[0].set_text(txt)
|
||||
|
||||
# Update progress bar seperately as it's a special case (not a label).
|
||||
|
Loading…
x
Reference in New Issue
Block a user