mirror of
https://git.deluge-torrent.org/deluge
synced 2025-09-26 12:18:32 +00:00
[#2783] [GTKUI] Case insensitive sort for name column
This commit is contained in:
parent
075542e4a5
commit
ee7e632b94
2 changed files with 13 additions and 2 deletions
|
@ -611,7 +611,7 @@ class ListView:
|
||||||
|
|
||||||
def add_texticon_column(self, header, col_types=None, sortid=1,
|
def add_texticon_column(self, header, col_types=None, sortid=1,
|
||||||
hidden=False, position=None, status_field=None,
|
hidden=False, position=None, status_field=None,
|
||||||
column_type="texticon", function=None,
|
column_type="texticon", function=None, sort_func=None,
|
||||||
tooltip=None, default=True, default_sort=False):
|
tooltip=None, default=True, default_sort=False):
|
||||||
"""Adds a texticon column to the listview."""
|
"""Adds a texticon column to the listview."""
|
||||||
if col_types is None:
|
if col_types is None:
|
||||||
|
@ -622,7 +622,7 @@ class ListView:
|
||||||
self.add_column(header, (render1, render2), col_types, hidden, position,
|
self.add_column(header, (render1, render2), col_types, hidden, position,
|
||||||
status_field, sortid, column_type=column_type,
|
status_field, sortid, column_type=column_type,
|
||||||
function=function, pixbuf=0, text=1, tooltip=tooltip,
|
function=function, pixbuf=0, text=1, tooltip=tooltip,
|
||||||
default=default, default_sort=default_sort)
|
sort_func=sort_func, default=default, default_sort=default_sort)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import logging
|
||||||
import gobject
|
import gobject
|
||||||
import gtk
|
import gtk
|
||||||
import pygtk
|
import pygtk
|
||||||
|
from locale import strcoll
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
|
@ -27,6 +28,16 @@ pygtk.require('2.0')
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def str_nocase_sort(model, iter1, iter2, data):
|
||||||
|
"""
|
||||||
|
Sort string column data with locale.strcoll which (allegedly) uses ISO 14651.
|
||||||
|
|
||||||
|
"""
|
||||||
|
v1 = model[iter1][data].lower()
|
||||||
|
v2 = model[iter2][data].lower()
|
||||||
|
return strcoll(v1, v2)
|
||||||
|
|
||||||
|
|
||||||
def queue_peer_seed_sort_function(v1, v2):
|
def queue_peer_seed_sort_function(v1, v2):
|
||||||
if v1 == v2:
|
if v1 == v2:
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue