# Path: kano_settings/common.py
# IMAGES_DIR = os.path.join(media, "Graphics")
# 
# Path: kano_settings/system/about.py
# def get_current_version():
#     with open('/etc/kanux_version', 'r') as f:
#         output = f.read().strip()
#         dummy1, dummy2, number, name = _split_helper(*output.split("-"))
#     return number, name
# 
# def get_space_available():
#     out, err, rc = run_cmd('df -h / | tail -1')
#     device, size, used, free, percent, mp = out.split()
# 
#     info = {
#         'used': '',
#         'total': ''
#     }
# 
#     if not err:
#         info['used'] = used
#         info['total'] = size
# 
#     return info
# 
# def get_temperature():
#     temperature = None
#     with open('/sys/class/thermal/thermal_zone0/temp') as f:
#         output = f.read().strip()
#         temperature = int(output) / 1000.0
#     return temperature
# 
# def get_model_name():
#     model = get_rpi_model()
#     model_name = get_board_property(model, 'name')
# 
#     return model_name


import os
import subprocess
from gi import require_version
from gi.repository import Gtk
from kano.gtk3.kano_dialog import KanoDialog
from kano.gtk3.buttons import OrangeButton, KanoButton
from kano_profile.paths import legal_dir
from kano_settings.common import media
from kano.network import launch_browser
from kano.utils import read_file_contents
from kano_settings.system.about import (
    get_current_version, get_space_available, get_temperature, get_model_name
)
from kano.utils import get_user_unsudoed, get_cpu_id

        version_align = self.create_align(
            "Kano OS: {name} v{version}".format(name=os_name, version=version_number),
            'about_version'
        )
        if os_variant:
            variant_align = self.create_align(
                "{variant}".format(variant=os_variant),
                'about_version'
            )
        space_align = self.create_align(
            _("Disk space used: {used}B / {total}B").format(**get_space_available())
        )
        try:
            celsius = u"{:.1f}\N{DEGREE SIGN}C".format(get_temperature())
        except ValueError:
            celsius = "?"
        temperature_align = self.create_align(
            _(u"Temperature: {celsius}").format(celsius=celsius)
        )
        model_align = self.create_align(
            _("Model: {model}").format(model=get_model_name())
        )
        cpu_id_align = self.create_align(
            _("CPU ID: {id}").format(id=cpu_id)
        )

        terms_and_conditions = OrangeButton(_("Terms and conditions"))
        terms_and_conditions.connect(
            'button_release_event', self.show_terms_and_conditions

# Path: kano_settings/common.py
# IMAGES_DIR = os.path.join(media, "Graphics")
# 
# Path: kano_settings/system/about.py
# def get_current_version():
#     with open('/etc/kanux_version', 'r') as f:
#         output = f.read().strip()
#         dummy1, dummy2, number, name = _split_helper(*output.split("-"))
#     return number, name
# 
# def get_space_available():
#     out, err, rc = run_cmd('df -h / | tail -1')
#     device, size, used, free, percent, mp = out.split()
# 
#     info = {
#         'used': '',
#         'total': ''
#     }
# 
#     if not err:
#         info['used'] = used
#         info['total'] = size
# 
#     return info
# 
# def get_temperature():
#     temperature = None
#     with open('/sys/class/thermal/thermal_zone0/temp') as f:
#         output = f.read().strip()
#         temperature = int(output) / 1000.0
#     return temperature
# 
# def get_model_name():
#     model = get_rpi_model()
#     model_name = get_board_property(model, 'name')
# 
#     return model_name


# Path: kano_settings/set_about.py
import os
import subprocess
from gi import require_version
from gi.repository import Gtk
from kano.gtk3.kano_dialog import KanoDialog
from kano.gtk3.buttons import OrangeButton, KanoButton
from kano_profile.paths import legal_dir
from kano_settings.common import media
from kano.network import launch_browser
from kano.utils import read_file_contents
from kano_settings.system.about import (
    get_current_version, get_space_available, get_temperature, get_model_name
)
from kano.utils import get_user_unsudoed, get_cpu_id


        version_align = self.create_align(
            "Kano OS: {name} v{version}".format(name=os_name, version=version_number),
            'about_version'
        )
        if os_variant:
            variant_align = self.create_align(
                "{variant}".format(variant=os_variant),
                'about_version'
            )
        space_align = self.create_align(
            _("Disk space used: {used}B / {total}B").format(**get_space_available())
        )
        try:
            celsius = u"{:.1f}\N{DEGREE SIGN}C".format(get_temperature())
        except ValueError:
            celsius = "?"
        temperature_align = self.create_align(
            _(u"Temperature: {celsius}").format(celsius=celsius)
        )
        model_align = self.create_align(
            _("Model: {model}").format(model=get_model_name())
        )
        cpu_id_align = self.create_align(
            _("CPU ID: {id}").format(id=cpu_id)
        )

        terms_and_conditions = OrangeButton(_("Terms and conditions"))
        terms_and_conditions.connect(
            'button_release_event', self.show_terms_and_conditions

        )