Preferences/Shortcuts.py

changeset 47
884e62c0b9cb
parent 45
9a18f4dbb493
child 50
a36eecf45b2e
diff -r b09750fd2a06 -r 884e62c0b9cb Preferences/Shortcuts.py
--- a/Preferences/Shortcuts.py	Mon Jan 11 15:23:45 2010 +0000
+++ b/Preferences/Shortcuts.py	Mon Jan 11 17:42:24 2010 +0000
@@ -201,12 +201,16 @@
                         """Compressed keyboard shortcut files"""
                         """ not supported. The compression library is missing."""))
                 return 0
-            f = gzip.open(fn, "w")
+            f = io.StringIO()
         else:
             f = open(fn, "w", encoding = "utf-8")
         
         ShortcutsWriter(f).writeXML()
         
+        if fn.lower().endswith("e4kz"):
+            g = gzip.open(fn, "wb")
+            g.write(f.getvalue().encode("utf-8"))
+            g.close()
         f.close()
         return True
     except IOError:
@@ -230,7 +234,9 @@
                         """Compressed keyboard shortcut files"""
                         """ not supported. The compression library is missing."""))
                 return False
-            f = gzip.open(fn, "r")
+            g = gzip.open(fn, "rb")
+            f = io.StringIO(g.read().decode("utf-8"))
+            g.close()
         else:
             f = open(fn, "r", encoding = "utf-8")
         try:
@@ -271,7 +277,9 @@
                         """Compressed keyboard shortcut files"""
                         """ not supported. The compression library is missing."""))
                 return False
-            f = gzip.open(fn, "r")
+            g = gzip.open(fn, "rb")
+            f = io.StringIO(g.read().decode("utf-8"))
+            g.close()
         else:
             f = open(fn, "r", encoding = "utf-8")
         try:

eric ide

mercurial