The help system is not yet implemented.
diff --git a/src/yasi_applets/main/templates/footer.html b/src/yasi_applets/main/templates/footer.html
deleted file mode 100644
index 6a2d931..0000000
--- a/src/yasi_applets/main/templates/footer.html
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
diff --git a/src/yasi_applets/main/templates/header.html b/src/yasi_applets/main/templates/header.html
deleted file mode 100644
index 87ccfc4..0000000
--- a/src/yasi_applets/main/templates/header.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-{% for item in menu_order %}
-
-{% endfor %}
-
-
-
-
-
-
diff --git a/src/yasi_applets/main/templates/layout.html b/src/yasi_applets/main/templates/layout.html
deleted file mode 100644
index 00a09ed..0000000
--- a/src/yasi_applets/main/templates/layout.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{% include "header.html" %}
-
-
-{% block body %}
-{% endblock %}
-
-
-{% include "footer.html" %}
-
-
-
-
-
diff --git a/src/yasi_applets/summary/routes.py b/src/yasi_applets/summary/routes.py
index 6ed2113..90d0ada 100644
--- a/src/yasi_applets/summary/routes.py
+++ b/src/yasi_applets/summary/routes.py
@@ -19,6 +19,9 @@ def summary_index():
html = (str(current_app.config['CONFIG']['Summary']['welcome']) + "
" + str(current_app.config['CONFIG']['Summary']['software']))
summary = config['Summary']
+ print("Config is: ")
+ print(config)
+
return render_template('summary.html',
menu=current_app.config['CONFIG']['settings']['menu'],
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
diff --git a/src/yasi_applets/welcome/routes.py b/src/yasi_applets/welcome/routes.py
index fe99714..e1fdd0b 100644
--- a/src/yasi_applets/welcome/routes.py
+++ b/src/yasi_applets/welcome/routes.py
@@ -6,6 +6,8 @@ from flask import current_app
import gettext
import dmm.lsblk as lsblk
import dmm.timezone as timezone
+import subprocess
+import socket
# Set up Gettext
def set_language(LANG):
@@ -37,8 +39,9 @@ def welcome_index():
print(request.form["timezone"])
global lang
lang = current_app.config['CONFIG']['settings']['language']
- blkid = lsblk.list_scsi_devices()
+ set_language(lang)
string_dict = build_stringlist()
+ blkid = lsblk.list_scsi_devices()
build_menu()
build_summary()
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
@@ -51,12 +54,11 @@ def welcome_index():
else:
previous_step_url = menu[menu.index("users")-1]
- print("next is: " + next_step_url)
- print("previous is: " , previous_step_url)
- power_button = '
'
- internet_button = '
'
+ power_button = '
'
+ internet_button = '
'
bottom_menu = power_button + internet_button
+
return render_template('welcome.html',
string_dict=string_dict, selected_lang=lang,
menu=current_app.config['CONFIG']['settings']['menu'],
@@ -67,6 +69,66 @@ def welcome_index():
bottom_menu=bottom_menu)
+@bp.route('/welcome/battery',methods=['GET', 'POST', 'PUT'])
+def welcome_battery():
+ """
+ Are we running on battery?
+ How much power do we have?
+ """
+ if "yes" in str(subprocess.check_output("LANG=C upower -d | grep on-battery", shell=True)):
+ on_battery = True
+ else:
+ on_battery = False
+ if on_battery:
+ percentage = str(subprocess.check_output('LANG=C upower -d | grep '
+ 'percentage | head -1 | cut -f 2 -d":" | '
+ 'sed "s/ //g"', shell=True)).strip("'b").strip("%\\n")
+ else:
+ percentage = False
+ status = {}
+ status = {"on_battery": on_battery, "percentage": percentage}
+ return status
+
+
+@bp.route('/welcome/battery/button',methods=['GET', 'POST', 'PUT'])
+def welcome_battery_button():
+ """
+ Returns the html power button.
+ """
+ on_battery, percentage = welcome_battery()['on_battery'], welcome_battery()['percentage']
+ if on_battery:
+ power_button = '
'
+ else:
+ power_button = '
'
+ return str(power_button)
+
+
+@bp.route('/welcome/internet', methods=['GET'])
+def has_internet():
+ """
+ Very rudimentary internet check.
+
+ Check if we can resolve deb.debian.org.
+ """
+ try:
+ socket.getaddrinfo("deb.debian.org", 80, proto=socket.IPPROTO_TCP)
+ canhas = True
+ except socket.gaierror:
+ canhas = False
+ return canhas
+
+
+@bp.route('/welcome/internet/button', methods=['GET'])
+def welcome_internet_button():
+ """
+ Draw updated button depending on internet status.
+ """
+ if has_internet():
+ return('
')
+ else:
+ return('
')
+
+
def build_stringlist():
"""
Return all the strings that is used in this applet."
@@ -88,6 +150,7 @@ def build_stringlist():
string_dict['lang_list'] = lang_dict
return string_dict
+
def build_menu():
"""
Define menu items and paths.