Ondřej Lysoněk 088f5e2
From d46834808c3226b3a6e48649df65befc399c21cd Mon Sep 17 00:00:00 2001
Ondřej Lysoněk 088f5e2
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
Ondřej Lysoněk 088f5e2
Date: Wed, 11 Jul 2018 00:41:45 +0200
Ondřej Lysoněk 088f5e2
Subject: [PATCH] tuned-gui: Sort plugins based on their name
Ondřej Lysoněk 088f5e2
MIME-Version: 1.0
Ondřej Lysoněk 088f5e2
Content-Type: text/plain; charset=UTF-8
Ondřej Lysoněk 088f5e2
Content-Transfer-Encoding: 8bit
Ondřej Lysoněk 088f5e2
Ondřej Lysoněk 088f5e2
Previously the sorting was done by comparing the objects themselves,
Ondřej Lysoněk 088f5e2
which is not what we want and it doesn't work in Python 3 - TypeError
Ondřej Lysoněk 088f5e2
is raised, e.g:
Ondřej Lysoněk 088f5e2
TypeError: '<' not supported between instances of 'BootloaderPlugin' and 'MountsPlugin'
Ondřej Lysoněk 088f5e2
Ondřej Lysoněk 088f5e2
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
Ondřej Lysoněk 088f5e2
---
Ondřej Lysoněk 088f5e2
 tuned-gui.py | 3 ++-
Ondřej Lysoněk 088f5e2
 1 file changed, 2 insertions(+), 1 deletion(-)
Ondřej Lysoněk 088f5e2
Ondřej Lysoněk 088f5e2
diff --git a/tuned-gui.py b/tuned-gui.py
Ondřej Lysoněk 088f5e2
index 8f72fd5..e486687 100755
Ondřej Lysoněk 088f5e2
--- a/tuned-gui.py
Ondřej Lysoněk 088f5e2
+++ b/tuned-gui.py
Ondřej Lysoněk 088f5e2
@@ -278,7 +278,8 @@ class Base(object):
Ondřej Lysoněk 088f5e2
 		self.treestore_profiles = Gtk.ListStore(GObject.TYPE_STRING,
Ondřej Lysoněk 088f5e2
 				GObject.TYPE_STRING)
Ondřej Lysoněk 088f5e2
 		self.treestore_plugins = Gtk.ListStore(GObject.TYPE_STRING)
Ondřej Lysoněk 088f5e2
-		for plugin in sorted(self.plugin_loader.plugins):
Ondřej Lysoněk 088f5e2
+		for plugin in sorted(self.plugin_loader.plugins,
Ondřej Lysoněk 088f5e2
+				key = lambda plugin: plugin.name):
Ondřej Lysoněk 088f5e2
 			self.treestore_plugins.append([plugin.name])
Ondřej Lysoněk 088f5e2
 		self.combobox_plugins = \
Ondřej Lysoněk 088f5e2
 			self.builder.get_object('comboboxPlugins')
Ondřej Lysoněk 088f5e2
-- 
Ondřej Lysoněk 088f5e2
2.14.4
Ondřej Lysoněk 088f5e2