Commit 8145a8a6 authored by thiolliere's avatar thiolliere
Browse files

add wikifundi

parent f35922a3
import json
# machine must provide write_file and exec_cmd functions
def run(machine, name, timezone, wifi_pwd, edupi, aflatoun, kalite, zim_install, ansiblecube_path):
def run(machine, name, timezone, wifi_pwd, edupi, wikifundi, aflatoun, kalite, zim_install, ansiblecube_path):
machine.exec_cmd("sudo apt-get update")
machine.exec_cmd("sudo apt-get install -y python-pip python-yaml python-jinja2 python-httplib2 python-paramiko python-pkg-resources libffi-dev libssl-dev git lsb-release")
machine.exec_cmd("sudo pip install ansible==2.2.0")
......@@ -21,6 +21,10 @@ def run(machine, name, timezone, wifi_pwd, edupi, aflatoun, kalite, zim_install,
"version": "0.16.9",
"language": kalite or [],
},
"wikifundi": {
"activated": str(wikifundi != None),
"language": wikifundi or [],
},
"aflatoun": {
"activated": aflatoun,
},
......
......@@ -25,6 +25,13 @@ KALITE_SIZES = {
"en": 41875931136,
}
# Those size correspond to 2017_01 packages.
# It must be updated as africapack are updated.
WIKIFUNDI_SIZES = {
"fr": 0,
"en": 0,
}
# 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
......@@ -271,6 +278,11 @@ class Application:
button.set_label("{} ({})".format(button.get_label(), human_readable_size(KALITE_SIZES[lang])))
button.connect("toggled", lambda button: self.update_free_space())
# wikifundi
for lang, button in self.iter_wikifundi_check_button():
button.set_label("{} ({})".format(button.get_label(), human_readable_size(WIKIFUNDI_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())
......@@ -297,6 +309,10 @@ class Application:
("en", self.component.kalite_en_check_button),
("es", self.component.kalite_es_check_button)]
def iter_wikifundi_check_button(self):
return [("fr", self.component.wikifundi_fr_check_button),
("en", self.component.wikifundi_en_check_button)]
def space_error_window_ok_button_clicked(self, widget):
self.component.space_error_window.hide()
......@@ -417,12 +433,18 @@ class Application:
validate_label(self.component.free_space_name_label, condition)
all_valid = all_valid and condition
active_buttons = [lang for lang, button in self.iter_kalite_check_button() if button.get_active()]
if len(active_buttons) != 0:
kalite = active_buttons
kalit_active_buttons = [lang for lang, button in self.iter_kalite_check_button() if button.get_active()]
if len(kalit_active_buttons) != 0:
kalite = kalit_active_buttons
else:
kalite = None
wikifundi_active_buttons = [lang for lang, button in self.iter_wikifundi_check_button() if button.get_active()]
if len(wikifundi_active_buttons) != 0:
wikifundi = wikifundi_active_buttons
else:
wikifundi = None
aflatoun = self.component.aflatoun_switch.get_active()
edupi = self.component.edupi_switch.get_active()
......@@ -456,6 +478,7 @@ class Application:
language=language,
wifi_pwd=wifi_pwd,
kalite=kalite,
wikifundi=wikifundi,
aflatoun=aflatoun,
edupi=edupi,
zim_install=zim_install,
......@@ -506,6 +529,9 @@ class Application:
for lang, button in self.iter_kalite_check_button():
if button.get_active():
used_space += KALITE_SIZES[lang]
for lang, button in self.iter_wikifundi_check_button():
if button.get_active():
used_space += WIKIFUNDI_SIZES[lang]
if self.component.aflatoun_switch.get_active():
used_space += AFLATOUN_SIZE
if self.component.edupi_switch.get_active():
......
......@@ -12,7 +12,7 @@ import data
import sys
import re
def run_installation(name, timezone, language, wifi_pwd, kalite, aflatoun, edupi, zim_install, size, logger, cancel_event, sd_card, favicon, logo, done_callback=None, build_dir="."):
def run_installation(name, timezone, language, wifi_pwd, kalite, aflatoun, wikifundi, edupi, zim_install, size, logger, cancel_event, sd_card, favicon, logo, done_callback=None, build_dir="."):
try:
# Prepare SD Card
......@@ -80,6 +80,7 @@ def run_installation(name, timezone, language, wifi_pwd, kalite, aflatoun, edupi
timezone=timezone,
wifi_pwd=wifi_pwd,
kalite=kalite,
wikifundi=wikifundi,
edupi=edupi,
aflatoun=aflatoun,
ansiblecube_path=ansiblecube_emulation_path,
......@@ -108,6 +109,24 @@ def run_installation(name, timezone, language, wifi_pwd, kalite, aflatoun, edupi
'fa': 'book',
'is_staff': False
})
if "en" in wikifundi:
custom_cards.append({
'category': 'create',
'url': 'http://en.wikifundi.koombook.lan',
'title': 'Wikifundi',
'description': 'Offline editable environment that provides a similar experience to editing Wikipedia online',
'fa': 'wikipedia-w',
'is_staff': False
})
if "fr" in wikifundi:
custom_cards.append({
'category': 'create',
'url': 'http://fr.wikifundi.koombook.lan',
'title': 'Wikifundi',
'description': 'Environnement qui vous permet de créer des articles Wikipédia hors-ligne',
'fa': 'wikipedia-w',
'is_staff': False
})
if edupi == True:
custom_cards.append({
'category': 'manage',
......
......@@ -800,21 +800,6 @@ and digits '0' to '9'</property>
<property name="position">10</property>
</packing>
</child>
<child>
<object class="GtkButton" id="run_installation_button">
<property name="label" translatable="yes">Run installation</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">11</property>
</packing>
</child>
<child>
<object class="GtkBox" id="no_id_21">
<property name="visible">True</property>
......@@ -849,7 +834,22 @@ and digits '0' to '9'</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">12</property>
<property name="position">11</property>
</packing>
</child>
<child>
<object class="GtkButton" id="run_installation_button">
<property name="label" translatable="yes">Run installation</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">11</property>
</packing>
</child>
<child>
......@@ -927,18 +927,19 @@ and digits '0' to '9'</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">14</property>
<property name="position">13</property>
</packing>
</child>
<child>
<object class="GtkBox" id="no_id_13">
<object class="GtkBox" id="no_id_68">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="no_id_25">
<object class="GtkLabel" id="no_id_69">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Aflatoun :</property>
<property name="label" translatable="yes">Wikifundi :</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -947,9 +948,37 @@ and digits '0' to '9'</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="aflatoun_switch">
<object class="GtkBox" id="kalite_box1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckButton" id="wikifundi_en_check_button">
<property name="label" translatable="yes">English</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="wikifundi_fr_check_button">
<property name="label" translatable="yes">French</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......@@ -962,7 +991,7 @@ and digits '0' to '9'</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">15</property>
<property name="position">14</property>
</packing>
</child>
<child>
......@@ -1000,6 +1029,41 @@ and digits '0' to '9'</property>
<property name="position">15</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">15</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</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