From 3f63a84bc78001a4df00fa777f5bc02756baed0a Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Thu, 9 Aug 2012 10:19:01 -0300
Subject: [PATCH Speak] Use json as included in Python SL #3142
We use json as included in Python. This will make Sugar dependent on
Python 2.6 and Python 2.7 to have the highest JSON performance.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
activity.py | 6 +++---
face.py | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/activity.py b/activity.py
index d4f0e2a..257365f 100644
a
|
b
|
import logging |
28 | 28 | import gtk |
29 | 29 | import gobject |
30 | 30 | import pango |
31 | | import cjson |
| 31 | import json |
32 | 32 | from gettext import gettext as _ |
33 | 33 | |
34 | 34 | from sugar.graphics.toolbarbox import ToolbarButton |
… |
… |
class SpeakActivity(SharedActivity): |
283 | 283 | % xoOwner.props.nick) |
284 | 284 | |
285 | 285 | def resume_instance(self, file_path): |
286 | | cfg = cjson.decode(file(file_path, 'r').read()) |
| 286 | cfg = json.loads(file(file_path, 'r').read()) |
287 | 287 | |
288 | 288 | status = self.face.status = face.Status().deserialize(cfg['status']) |
289 | 289 | self.voices.select(status.voice) |
… |
… |
class SpeakActivity(SharedActivity): |
305 | 305 | 'history': [unicode(i[0], 'utf-8', 'ignore') \ |
306 | 306 | for i in self.entrycombo.get_model()], |
307 | 307 | } |
308 | | file(file_path, 'w').write(cjson.encode(cfg)) |
| 308 | file(file_path, 'w').write(json.dumps(cfg)) |
309 | 309 | |
310 | 310 | def share_instance(self, connection, is_initiator): |
311 | 311 | self.chat.messenger = Messenger(connection, is_initiator, self.chat) |
diff --git a/face.py b/face.py
index b7e3372..f5e0d00 100644
a
|
b
|
|
24 | 24 | |
25 | 25 | import logging |
26 | 26 | import gtk |
27 | | import cjson |
| 27 | import json |
28 | 28 | |
29 | 29 | import sugar.graphics.style as style |
30 | 30 | |
… |
… |
class Status: |
57 | 57 | fft_mouth.FFTMouth: 2, |
58 | 58 | waveform_mouth.WaveformMouth: 3} |
59 | 59 | |
60 | | return cjson.encode({ |
| 60 | return json.dumps({ |
61 | 61 | 'voice': {'language': self.voice.language, |
62 | 62 | 'name': self.voice.name}, |
63 | 63 | 'pitch': self.pitch, |
… |
… |
class Status: |
72 | 72 | 2: fft_mouth.FFTMouth, |
73 | 73 | 3: waveform_mouth.WaveformMouth} |
74 | 74 | |
75 | | data = cjson.decode(buf) |
| 75 | data = json.loads(buf) |
76 | 76 | self.voice = voice.Voice(data['voice']['language'], |
77 | 77 | data['voice']['name']) |
78 | 78 | self.pitch = data['pitch'] |