Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2009-08-06 16:31:00 (GMT)
committer Simon Schampijer <simon@schampijer.de>2009-08-06 16:31:00 (GMT)
commit041f65ae6dcdc22d235c0ef7fe05b53334a4d1ff (patch)
tree1a73e0c0c697e36d0420f309718bd6c6615f0460
parent535b9dd9c33b0f6daf76042bf183aa94d8afc053 (diff)
Adopt to json changes in python-2.6 #711
-rw-r--r--keyboard.py6
-rwxr-xr-xlessonbuilder.py4
-rw-r--r--lessonscreen.py2
-rw-r--r--mainscreen.py4
-rw-r--r--medalscreen.py2
-rwxr-xr-xtypingturtle.py4
6 files changed, 11 insertions, 11 deletions
diff --git a/keyboard.py b/keyboard.py
index 34a9da2..9a04d9d 100644
--- a/keyboard.py
+++ b/keyboard.py
@@ -22,7 +22,7 @@ import gtk
import rsvg
import os, glob, re
import pango
-import simplejson
+import json
# Tweaking variables.
HAND_YOFFSET = -15
@@ -321,10 +321,10 @@ class KeyboardData:
pass
def load_letter_map(self, filename):
- self.letter_map = simplejson.loads(open(filename, 'r').read())
+ self.letter_map = json.loads(open(filename, 'r').read())
def save_letter_map(self, filename):
- text = simplejson.dumps(self.letter_map, ensure_ascii=False, sort_keys=True, indent=4)
+ text = json.dumps(self.letter_map, ensure_ascii=False, sort_keys=True, indent=4)
f = open(filename, 'w')
f.write(text)
f.close()
diff --git a/lessonbuilder.py b/lessonbuilder.py
index fa942b7..396ac86 100755
--- a/lessonbuilder.py
+++ b/lessonbuilder.py
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with Typing Turtle. If not, see <http://www.gnu.org/licenses/>.
-import os, sys, random, simplejson, locale, re, optparse
+import os, sys, random, json, locale, re, optparse
from gettext import gettext as _
# For modifier constants.
@@ -561,7 +561,7 @@ def main():
new_keys=options.keys, base_keys=options.base_keys,
words=words, bad_words=bad_words)
- text = simplejson.dumps(lesson, ensure_ascii=False, sort_keys=True, indent=4)
+ text = json.dumps(lesson, ensure_ascii=False, sort_keys=True, indent=4)
open(options.output, 'w').write(text)
diff --git a/lessonscreen.py b/lessonscreen.py
index 5b620cb..3177dd5 100644
--- a/lessonscreen.py
+++ b/lessonscreen.py
@@ -16,7 +16,7 @@
# vi:sw=4 et
# Import standard Python modules.
-import logging, os, math, time, copy, json, locale, datetime, random, re
+import logging, os, math, time, copy, locale, datetime, random, re
from gettext import gettext as _
# Import PyGTK.
diff --git a/mainscreen.py b/mainscreen.py
index 56c105e..8af4f93 100644
--- a/mainscreen.py
+++ b/mainscreen.py
@@ -15,7 +15,7 @@
# along with Typing Turtle. If not, see <http://www.gnu.org/licenses/>.
# Import standard Python modules.
-import logging, os, math, time, copy, simplejson, locale, datetime, random, re, glob
+import logging, os, math, time, copy, cjson, locale, datetime, random, re, glob
from gettext import gettext as _
# Import PyGTK.
@@ -126,7 +126,7 @@ class MainScreen(gtk.VBox):
for f in glob.iglob(path + '/*.lesson'):
fd = open(f, 'r')
try:
- lesson = simplejson.loads(fd.read())
+ lesson = cjson.decode(fd.read())
self.lessons.append(lesson)
finally:
fd.close()
diff --git a/medalscreen.py b/medalscreen.py
index 42833bf..a1d881a 100644
--- a/medalscreen.py
+++ b/medalscreen.py
@@ -15,7 +15,7 @@
# along with Typing Turtle. If not, see <http://www.gnu.org/licenses/>.
# Import standard Python modules.
-import logging, os, math, time, copy, json, locale, datetime, random, re
+import logging, os, math, time, copy, locale, datetime, random, re
from gettext import gettext as _
# Import PyGTK.
diff --git a/typingturtle.py b/typingturtle.py
index e9c2f9e..e09fc71 100755
--- a/typingturtle.py
+++ b/typingturtle.py
@@ -115,7 +115,7 @@ class TypingTurtle(sugar.activity.activity.Activity):
try:
text = fd.read()
print "read %s" % text
- self.data = json.read(text)
+ self.data = json.loads(text)
finally:
fd.close()
@@ -129,7 +129,7 @@ class TypingTurtle(sugar.activity.activity.Activity):
fd = open(file_path, 'w')
try:
- text = json.write(self.data)
+ text = json.dumps(self.data)
fd.write(text)
print "wrote %s" % text
finally: