[GTK3] Fix cmp sorting on Python 3
This commit is contained in:
parent
a3bd2e547a
commit
ce49cde49d
|
@ -34,6 +34,17 @@ from deluge.common import PY2, get_pixmap, osx_check, windows_check
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def cmp(x, y):
|
||||||
|
"""Replacement for built-in function cmp that was removed in Python 3.
|
||||||
|
|
||||||
|
Compare the two objects x and y and return an integer according to
|
||||||
|
the outcome. The return value is negative if x < y, zero if x == y
|
||||||
|
and strictly positive if x > y.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (x > y) - (x < y)
|
||||||
|
|
||||||
|
|
||||||
def create_blank_pixbuf(size=16):
|
def create_blank_pixbuf(size=16):
|
||||||
pix = Pixbuf.new(Colorspace.RGB, True, 8, size, size)
|
pix = Pixbuf.new(Colorspace.RGB, True, 8, size, size)
|
||||||
pix.fill(0x0)
|
pix.fill(0x0)
|
||||||
|
|
|
@ -15,7 +15,7 @@ from gi.repository import GObject, Gtk
|
||||||
|
|
||||||
from deluge.common import PY2, decode_bytes
|
from deluge.common import PY2, decode_bytes
|
||||||
|
|
||||||
from .common import load_pickled_state_file, save_pickled_state_file
|
from .common import cmp, load_pickled_state_file, save_pickled_state_file
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import deluge.component as component
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
|
||||||
from . import torrentview_data_funcs as funcs
|
from . import torrentview_data_funcs as funcs
|
||||||
|
from .common import cmp
|
||||||
from .listview import ListView
|
from .listview import ListView
|
||||||
from .removetorrentdialog import RemoveTorrentDialog
|
from .removetorrentdialog import RemoveTorrentDialog
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue