Commit 174c51e3 authored by thiolliere's avatar thiolliere
Browse files

add aflatoun

parent 004e3d39
import json
# machine must provide write_file and exec_cmd functions
def run(machine, name, timezone, wifi_pwd, kalite, zim_install):
def run(machine, name, timezone, wifi_pwd, kalite, aflatoun, zim_install):
machine.exec_cmd("sudo apt-get update")
machine.exec_cmd("sudo apt-get install -y python-pip git python-dev libffi-dev libssl-dev gnutls-bin")
......@@ -28,6 +28,9 @@ def run(machine, name, timezone, wifi_pwd, kalite, zim_install):
"version": "0.16.9",
"language": kalite or [],
},
"aflatoun": {
"activated": aflatoun,
},
"idc_import": {
"activated": "False",
"content_name": [],
......@@ -48,12 +51,12 @@ def run(machine, name, timezone, wifi_pwd, kalite, zim_install):
extra_vars += " timezone=%s" % timezone
if wifi_pwd:
extra_vars += " wpa_pass=%s" % wifi_pwd
extra_vars += " git_branch=oneUpdateFile0.2"
extra_vars += " git_branch=oneUpdateFile0.3"
extra_vars += " own_config_file=True"
extra_vars += " managed_by_bsf=False"
ansible_pull_cmd = "sudo /usr/local/bin/ansible-pull"
ansible_pull_cmd += " --checkout oneUpdateFile0.2"
ansible_pull_cmd += " --checkout oneUpdateFile0.3"
ansible_pull_cmd += " --directory /var/lib/ansible/local"
ansible_pull_cmd += " --inventory hosts"
ansible_pull_cmd += " --url https://github.com/thiolliere/ansiblecube.git"
......
......@@ -25,6 +25,12 @@ KALITE_SIZES = {
"en": 41875931136,
}
# This size is 5G but actual final size on disk is 3.9
# We use 8G because we need space to build aflatoun
# TODO: 5G is not enough
# TODO: 8G may not be enough
AFLATOUN_SIZE = 8589934592;
def hide_on_delete(widget, event):
widget.hide()
return True
......@@ -227,6 +233,9 @@ class Application:
button.set_label("{} ({})".format(button.get_label(), human_readable_size(KALITE_SIZES[lang])))
button.connect("toggled", lambda button: self.update_free_space())
# aflatoun
self.component.aflatoun_switch.connect("notify::active", lambda switch, state: self.update_free_space())
# language tree view
renderer_text = Gtk.CellRendererText()
column_text = Gtk.TreeViewColumn("Language", renderer_text, text=0)
......@@ -361,6 +370,8 @@ class Application:
else:
kalite = None
aflatoun = self.component.aflatoun_switch.get_active()
build_dir = self.component.build_path_chooser.get_filename()
condition = build_dir != None
validate_label(self.component.build_path_chooser_label, condition)
......@@ -386,6 +397,7 @@ class Application:
timezone=timezone,
wifi_pwd=wifi_pwd,
kalite=kalite,
aflatoun=aflatoun,
zim_install=zim_install,
size=output_size,
logger=self.logger,
......@@ -432,6 +444,9 @@ class Application:
for lang, button in self.iter_kalite_check_button():
if button.get_active():
used_space += KALITE_SIZES[lang]
if self.component.aflatoun_switch.get_active():
used_space += AFLATOUN_SIZE
return self.get_output_size() - used_space
def update_free_space(self):
......
......@@ -11,7 +11,7 @@ import data
import sys
import re
def run_installation(name, timezone, wifi_pwd, kalite, zim_install, size, logger, cancel_event, sd_card, done_callback=None, build_dir="."):
def run_installation(name, timezone, wifi_pwd, kalite, aflatoun, zim_install, size, logger, cancel_event, sd_card, done_callback=None, build_dir="."):
try:
# Prepare SD Card
......@@ -75,6 +75,7 @@ def run_installation(name, timezone, wifi_pwd, kalite, zim_install, size, logger
timezone=timezone,
wifi_pwd=wifi_pwd,
kalite=kalite,
aflatoun=aflatoun,
zim_install=zim_install)
# Write ideascube configuration
......@@ -89,9 +90,24 @@ def run_installation(name, timezone, wifi_pwd, kalite, zim_install, size, logger
extra_app_cards = []
if kalite != None:
extra_app_cards.append('khanacademy')
custom_cards = []
if aflatoun == True:
custom_cards.append({
'category': 'learn',
'url': 'http://aflatoun.koombook.lan',
'title': 'Aflatoun',
'description': 'Social and Financial Education for Children and Young People',
'fa': 'book',
'is_staff': False
})
kb_conf = """from .pibox import * # pragma: no flakes
EXTRA_APP_CARDS = {}""".format(extra_app_cards)
EXTRA_APP_CARDS = {}
CUSTOM_CARDS = {}
""".format(extra_app_cards, custom_cards)
kb_conf_fmt = kb_conf.replace("'", "'\\''")
kb_conf_path = "/opt/venvs/ideascube/lib/python3.4/site-packages/ideascube/conf/kb.py"
......
......@@ -326,7 +326,7 @@ and digits '0' to '9' and hyphen '-'</property>
<object class="GtkLabel" id="no_id_11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Open WiFi</property>
<property name="label" translatable="yes">Open WiFi :</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -802,6 +802,41 @@ and digits '0' to '9'</property>
<property name="position">10</property>
</packing>
</child>
<child>
<object class="GtkBox" id="no_id_13">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="no_id_25">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Aflatoun :</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="aflatoun_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">11</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......@@ -817,7 +852,7 @@ and digits '0' to '9'</property>
<property name="type_hint">dialog</property>
<property name="transient_for">window</property>
<property name="program_name">Pibox Installer</property>
<property name="version">0.0.2</property>
<property name="version">0.0.3</property>
<property name="website">https://framagit.org/ideascube/pibox-installer</property>
<property name="logo_icon_name">image-missing</property>
<property name="license_type">gpl-3-0</property>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment