[gedit/wip/python3] external tools: fix manager
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/python3] external tools: fix manager
- Date: Mon, 29 Oct 2012 07:53:01 +0000 (UTC)
commit 28a9dcdf1a98f5154f18b7ae0b6c79bc92f7a9c7
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Oct 29 08:52:39 2012 +0100
external tools: fix manager
plugins/externaltools/tools/library.py | 2 +-
plugins/externaltools/tools/manager.py | 11 ++++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/plugins/externaltools/tools/library.py b/plugins/externaltools/tools/library.py
index 47f0bba..6efd03d 100644
--- a/plugins/externaltools/tools/library.py
+++ b/plugins/externaltools/tools/library.py
@@ -408,7 +408,7 @@ class Tool(object):
def _dump_properties(self):
lines = ['# [Gedit Tool]']
- for item in self._properties.iteritems():
+ for item in self._properties.items():
if item[0] in self._transform:
lines.append('# %s=%s' % (item[0], self._transform[item[0]][1](item[1])))
elif item[1] is not None:
diff --git a/plugins/externaltools/tools/manager.py b/plugins/externaltools/tools/manager.py
index f9d3a8b..84a016e 100644
--- a/plugins/externaltools/tools/manager.py
+++ b/plugins/externaltools/tools/manager.py
@@ -460,7 +460,12 @@ class Manager(GObject.Object):
n1 = t1.name
n2 = t2.name
- return cmp(n1.lower(), n2.lower())
+ if n1.lower() < n2.lower():
+ return -1
+ elif n1.lower() > n2.lower():
+ return 1
+ else:
+ return 0
def __init_tools_view(self):
# Tools column
@@ -510,7 +515,7 @@ class Manager(GObject.Object):
return None, None
def compute_hash(self, string):
- return hashlib.md5(string).hexdigest()
+ return hashlib.md5(string.encode('utf-8')).hexdigest()
def save_current_tool(self):
if self.current_node is None:
@@ -584,7 +589,7 @@ class Manager(GObject.Object):
self.script_hash = self.compute_hash(script)
- contenttype, uncertain = Gio.content_type_guess(None, script)
+ contenttype, uncertain = Gio.content_type_guess(None, script.encode('utf-8'))
lmanager = GtkSource.LanguageManager.get_default()
language = lmanager.guess_language(None, contenttype)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]