[orca] Converting yaml backend into json
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Converting yaml backend into json
- Date: Tue, 8 Feb 2011 03:49:36 +0000 (UTC)
commit cab1b0ba704700a0949e34cda222d02504ec122e
Author: Javier Hernández Antúnez <jhernandez emergya es>
Date: Thu Feb 3 19:42:45 2011 +0100
Converting yaml backend into json
src/orca/backends/Makefile.am | 2 +-
.../backends/{yaml_backend.py => json_backend.py} | 17 +++++++++--------
2 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/backends/Makefile.am b/src/orca/backends/Makefile.am
index 9519b48..4006067 100644
--- a/src/orca/backends/Makefile.am
+++ b/src/orca/backends/Makefile.am
@@ -3,7 +3,7 @@ orca_pathdir=$(pyexecdir)
orca_python_PYTHON = \
__init__.py \
gconf_backend.py\
- yaml_backend.py
+ json_backend.py
orca_pythondir=$(pyexecdir)/orca/backends
diff --git a/src/orca/backends/yaml_backend.py b/src/orca/backends/json_backend.py
similarity index 92%
rename from src/orca/backends/yaml_backend.py
rename to src/orca/backends/json_backend.py
index 8c015b0..681f20d 100644
--- a/src/orca/backends/yaml_backend.py
+++ b/src/orca/backends/json_backend.py
@@ -1,7 +1,8 @@
# Orca
#
-# Copyright 2010 Consorcio Fernando de los Rios.
+# Copyright 2010-2011 Consorcio Fernando de los Rios.
# Author: Juanje Ojeda Croissier <jojeda emergya es>
+# Author: Javier Hernández Antúnez <jhernandez emergya es>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,22 +19,22 @@
# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
# Boston MA 02110-1301 USA.
-"""YAML backend for Orca settings"""
+"""JSON backend for Orca settings"""
__id__ = "$Id$"
__version__ = "$Revision$"
__date__ = "$Date$"
-__copyright__ = "Copyright (c) 2010 Consorcio Fernando de los Rios."
+__copyright__ = "Copyright (c) 2010-2011 Consorcio Fernando de los Rios."
__license__ = "LGPL"
-from yaml import load, dump
+from json import load, dump
import os
from orca import settings
class Backend:
def __init__(self):
- """ Initialize the YAML Backend.
+ """ Initialize the JSON Backend.
"""
self.general = {}
self.pronunciations = {}
@@ -61,7 +62,7 @@ class Backend:
self.keybindings = keybindings
settingsFile = open(self.settingsFile, 'w')
- dump(prefs, settingsFile)
+ dump(prefs, settingsFile, indent=4)
settingsFile.close()
def saveProfileSettings(self, profile, general,
@@ -79,7 +80,7 @@ class Backend:
prefs['profiles'][profile] = general
settingsFile.seek(0)
settingsFile.truncate()
- dump(prefs, settingsFile)
+ dump(prefs, settingsFile, indent=4)
def _getSettings(self):
""" Load from config file all settings """
@@ -139,7 +140,7 @@ class Backend:
prefs['general'][key] = value
settingsFile.seek(0)
settingsFile.truncate()
- dump(prefs, settingsFile)
+ dump(prefs, settingsFile, indent=4)
def setFirstStart(self, value=False):
"""Set firstStart. This user-configurable settting is primarily
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]