From 7be21fc77f33afa2a23cd4c7b10158067a386e69 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Fri, 11 Feb 2011 17:07:59 +0000 Subject: [PATCH] Sort the new tweaks box. --- src/calibre/gui2/preferences/tweaks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/preferences/tweaks.py b/src/calibre/gui2/preferences/tweaks.py index 9928e6a892..c532f3059a 100644 --- a/src/calibre/gui2/preferences/tweaks.py +++ b/src/calibre/gui2/preferences/tweaks.py @@ -60,7 +60,10 @@ class Tweak(object): # {{{ return ans def __cmp__(self, other): - return cmp(self.is_customized, getattr(other, 'is_customized', False)) + if self.is_customized != getattr(other, 'is_customized', False): + return -1 * cmp(self.is_customized, + getattr(other, 'is_customized', False)) + return cmp(icu_lower(self.name), icu_lower(getattr(other, 'name', ''))) @property def is_customized(self): @@ -139,6 +142,7 @@ class Tweaks(QAbstractListModel): # {{{ pos = self.read_tweak(lines, pos, dl, l) pos += 1 + self.tweaks.sort() default_keys = set(dl.iterkeys()) custom_keys = set(l.iterkeys())