[Python-apps-team] Bug#921824: terminator: Impossible to load a layout on startup after upgrading to 1.91-3
phep
phep-lists at teletopie.net
Sat Feb 9 11:06:55 GMT 2019
Hi,
I managed to fix this with the patch below but this probably not the best
way to do it. Besides, this might be the sign that the code base should be
checked up more thoroughly before to depend on python3.
diff --git a/layoutlauncher.py b/layoutlauncher.py
index b498174..31573fd 100644
--- a/layoutlauncher.py
+++ b/layoutlauncher.py
@@ -4,6 +4,7 @@
"""layoutlauncher.py - class for the Layout Launcher window"""
import os
+from functools import cmp_to_key
from gi.repository import Gtk
from gi.repository import GObject
@@ -13,6 +14,9 @@ from .translation import _
from .terminator import Terminator
from .plugin import PluginRegistry
+def cmp(a, b):
+ return (a > b) - (a < b)
+
class LayoutLauncher:
"""Class implementing the various parts of the preferences editor"""
terminator = None
@@ -72,7 +76,7 @@ class LayoutLauncher:
"""Update the contents of the layout"""
self.layouttreestore.clear()
layouts = self.config.list_layouts()
- for layout in sorted(layouts, cmp=lambda x,y: cmp(x.lower(),
y.lower())):
+ for layout in sorted(layouts, key=cmp_to_key(lambda x,y:
cmp(x.lower(), y.lower()))):
if layout != "default":
self.layouttreestore.append([layout])
else:
diff --git a/notebook.py b/notebook.py
index 000d6f9..6f32cd3 100644
--- a/notebook.py
+++ b/notebook.py
@@ -3,6 +3,7 @@
# GPL v2 only
"""notebook.py - classes for the notebook widget"""
+from functools import cmp_to_key
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gdk
@@ -100,7 +101,7 @@ class Notebook(Container, Gtk.Notebook):
num = 0
keys = list(children.keys())
- keys.sort(child_compare)
+ keys = sorted(keys, key=cmp_to_key(child_compare))
for child_key in keys:
child = children[child_key]
Cheers,
phep
More information about the Python-apps-team
mailing list