# Path: kano_settings/config_file.py
# def file_replace(fname, pat, s_after):
#     logger.debug("config_file / file_replace {} \"{}\" \"{}\"".format(fname, pat, s_after))
#     if not os.path.exists(fname):
#         logger.debug("config_file / file_replace file doesn't exists")
#         return -1
# 
#     # if escape:
#         # pat = re.escape(pat)
#         # logger.debug('config_file / file_replace replacing pattern, new pattern: "{}"'.format(pat))
# 
#     # See if the pattern is even in the file.
#     with open(fname) as f:
#         if not any(re.search(pat, line) for line in f):
#             logger.debug("config_file / file_replace pattern does not occur in file")
#             return -1  # pattern does not occur in file so we are done.
# 
#     # pattern is in the file, so perform replace operation.
#     with open(fname) as f:
#         out_fname = fname + ".tmp"
#         out = open(out_fname, 'w')
#         for line in f:
#             out.write(re.sub(pat, s_after, line))
#         out.close()
# 
#         # preserving permissions from the old file
#         shutil.copystat(fname, out_fname)
# 
#         # overwriting the old file with the new one
#         os.rename(out_fname, fname)
# 
#     logger.debug("config_file / file_replace file replaced")


import os
from kano_settings.config_file import file_replace
from kano.utils import get_user_unsudoed
from kano.logging import logger
#!/usr/bin/env python

# font.py
#
# Copyright (C) 2014 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
#
# Backend font functions
#




SIZES = [10, 14, 18]


username = get_user_unsudoed()
config_file = os.path.join('/home', username, '.config/lxsession/LXDE/desktop.conf')


# int configuration: 0 = small, 1 = normal, 2 = big
def change_font_size(configuration):
    try:
        size = SIZES[configuration]
    except IndexError:
        return


# Path: kano_settings/config_file.py
# def file_replace(fname, pat, s_after):
#     logger.debug("config_file / file_replace {} \"{}\" \"{}\"".format(fname, pat, s_after))
#     if not os.path.exists(fname):
#         logger.debug("config_file / file_replace file doesn't exists")
#         return -1
# 
#     # if escape:
#         # pat = re.escape(pat)
#         # logger.debug('config_file / file_replace replacing pattern, new pattern: "{}"'.format(pat))
# 
#     # See if the pattern is even in the file.
#     with open(fname) as f:
#         if not any(re.search(pat, line) for line in f):
#             logger.debug("config_file / file_replace pattern does not occur in file")
#             return -1  # pattern does not occur in file so we are done.
# 
#     # pattern is in the file, so perform replace operation.
#     with open(fname) as f:
#         out_fname = fname + ".tmp"
#         out = open(out_fname, 'w')
#         for line in f:
#             out.write(re.sub(pat, s_after, line))
#         out.close()
# 
#         # preserving permissions from the old file
#         shutil.copystat(fname, out_fname)
# 
#         # overwriting the old file with the new one
#         os.rename(out_fname, fname)
# 
#     logger.debug("config_file / file_replace file replaced")


# Path: kano_settings/system/font.py
import os
from kano_settings.config_file import file_replace
from kano.utils import get_user_unsudoed
from kano.logging import logger

#!/usr/bin/env python

# font.py
#
# Copyright (C) 2014 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
#
# Backend font functions
#




SIZES = [10, 14, 18]


username = get_user_unsudoed()
config_file = os.path.join('/home', username, '.config/lxsession/LXDE/desktop.conf')


# int configuration: 0 = small, 1 = normal, 2 = big
def change_font_size(configuration):
    try:
        size = SIZES[configuration]
    except IndexError:
        return


    font = "sGtk/FontName=Bariol {}"