示例#1
0
import logging
logger = logging.getLogger(__name__)

from gi.repository import GdkPixbuf
from gi.repository import GLib
from gettext import gettext as _

import mypaintlib
import lib.pixbuf
import lib.glib


try:
    from json import dumps as json_dumps_builtin, loads as json_loads
    logger.debug("Using builtin python 2.6 json support")
    json_dumps = lambda obj: json_dumps_builtin(obj, indent=2)
except ImportError:
    try:
        from cjson import encode as json_dumps, decode as json_loads
        logger.debug("Using external python-cjson")
    except ImportError:
        try:
            from json import write as json_dumps, read as json_loads
            logger.debug("Using external python-json")
        except ImportError:
            try:
                from simplejson import dumps as json_dumps, loads as json_loads
                logger.debug("Using external python-simplejson")
            except ImportError:
                raise ImportError("Could not import json. You either need to use python >= 2.6 or install one of python-cjson, python-json or python-simplejson.")
示例#2
0
logger = logging.getLogger(__name__)

import lib.gichecks
from gi.repository import GdkPixbuf
from gi.repository import GLib
from gettext import gettext as _

import mypaintlib
import lib.pixbuf
import lib.glib


try:
    from json import dumps as json_dumps_builtin, loads as json_loads
    logger.debug("Using builtin python 2.6 json support")
    json_dumps = lambda obj: json_dumps_builtin(obj, indent=2)
except ImportError:
    try:
        from cjson import encode as json_dumps, decode as json_loads
        logger.debug("Using external python-cjson")
    except ImportError:
        try:
            from json import write as json_dumps, read as json_loads
            logger.debug("Using external python-json")
        except ImportError:
            try:
                from simplejson import dumps as json_dumps, loads as json_loads
                logger.debug("Using external python-simplejson")
            except ImportError:
                raise ImportError("Could not import json. You either need to use python >= 2.6 or install one of python-cjson, python-json or python-simplejson.")