re-add yasi-applets
This commit is contained in:
9
src/yasi_applets/software/__init__.py
Normal file
9
src/yasi_applets/software/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from flask import Blueprint
|
||||
|
||||
bp = Blueprint('software', __name__,
|
||||
template_folder='',
|
||||
static_folder='static',
|
||||
static_url_path='/software/static')
|
||||
|
||||
from yasi_applets.software import routes
|
||||
|
||||
81
src/yasi_applets/software/routes.py
Normal file
81
src/yasi_applets/software/routes.py
Normal file
@@ -0,0 +1,81 @@
|
||||
from yasi_applets.software import bp
|
||||
from flask import Flask, request, session, redirect, \
|
||||
url_for, render_template, flash, Blueprint
|
||||
from flask import current_app
|
||||
|
||||
@bp.route('/software')
|
||||
def webui_software():
|
||||
"""
|
||||
Software screen for the webui.
|
||||
"""
|
||||
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
|
||||
next_step_url = menu[menu.index("software")+1]
|
||||
if menu[menu.index("software")] == 1:
|
||||
previous_step_url = False
|
||||
else:
|
||||
previous_step_url = menu[menu.index("software")-1]
|
||||
|
||||
sources_button = ' <button class="button iis-info"> <i class="fa fa-cloud-download" aria-hidden="true"></i> Edit Sources </button>'
|
||||
blends_button = ' <button class="button iis-info"> <i class="fa fa-download" aria-hidden="true"></i> Install a Blend </button>'
|
||||
bottom_menu = sources_button + blends_button
|
||||
# Leave out useless buttons until they do more
|
||||
bottom_menu = ''
|
||||
build_summary()
|
||||
|
||||
return render_template('software.html',
|
||||
menu=current_app.config['CONFIG']['settings']['menu'],
|
||||
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
|
||||
previous_step = previous_step_url,
|
||||
next_step = next_step_url,
|
||||
bottom_menu = bottom_menu,
|
||||
popcon=current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'],
|
||||
desktop=current_app.config['CONFIG']['recipe']['install_desktop_environment']['packages'])
|
||||
|
||||
|
||||
@bp.route('/software/settings', methods=['GET', 'POST'])
|
||||
def software_settings():
|
||||
"""
|
||||
Receive settings for the software applet.
|
||||
"""
|
||||
if request.method == 'POST':
|
||||
popcon = "popcon" in request.form
|
||||
current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'] = popcon
|
||||
print(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'])
|
||||
build_summary()
|
||||
return ('', 204)
|
||||
|
||||
|
||||
@bp.route('/software/select-desktop', methods=['GET', 'POST'])
|
||||
def software_select_desktop():
|
||||
"""
|
||||
Select a desktop environment for installation
|
||||
"""
|
||||
if request.method == 'POST':
|
||||
desktop = request.form['software-desktop']
|
||||
print(desktop)
|
||||
current_app.config['CONFIG']['recipe']['install_desktop_environment']['packages'] = desktop
|
||||
build_summary()
|
||||
return ('', 204)
|
||||
|
||||
|
||||
def build_menu():
|
||||
"""
|
||||
Define menu items and paths.
|
||||
"""
|
||||
# proper one once translations are done:
|
||||
#current_app.config['CONFIG']['settings']['menu']['welcome'] = (build_stringlist()['menu_item'], "/welcome", 10)
|
||||
current_app.config['CONFIG']['settings']['menu']['software'] = ("Software", "/software", 40)
|
||||
|
||||
|
||||
def build_summary():
|
||||
"""
|
||||
Write up a summary of what this module will do.
|
||||
"""
|
||||
current_app.config['CONFIG']['Summary']['software'] = {}
|
||||
current_app.config['CONFIG']['Summary']['software']['heading'] = "Software"
|
||||
current_app.config['CONFIG']['Summary']['software']['bleh'] = current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']
|
||||
current_app.config['CONFIG']['Summary']['software']['text'] = "Participate in Popularity Contest: " + str(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']) + "<br/>Desktop environment selected: " + str(current_app.config['CONFIG']['recipe']['install_desktop_environment']['packages'])
|
||||
return("ok?")
|
||||
|
||||
|
||||
build_menu()
|
||||
80
src/yasi_applets/software/software.html
Normal file
80
src/yasi_applets/software/software.html
Normal file
@@ -0,0 +1,80 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
|
||||
<p> <b> Would you like fries with that? </b></p>
|
||||
|
||||
<br>
|
||||
<big> Popularity Contest </big>
|
||||
<br><br>
|
||||
<p>The Popularity Contest (popcon) is a programme where anonymous data is sent back to Debian, tracking the number of packages installed. More information can be obtained at https://popcon.debian.org.</p> <br>
|
||||
|
||||
<input style="background-color: #777777;" type="checkbox" id="popcon"
|
||||
name="popcon" hx-post="/software/settings" hx-trigger="change"
|
||||
{% if popcon %} checked {% endif %}>
|
||||
<label for="popcon"> Participate in PopCon </label><br>
|
||||
|
||||
<br>
|
||||
<big><h3> Desktop Environment </h3></big>
|
||||
<br>
|
||||
<p>Would you like to install a graphical environment for this system?</p>
|
||||
|
||||
<br>
|
||||
|
||||
<form>
|
||||
<div class="control is-link">
|
||||
<div class="select">
|
||||
<select hx-post="/software/select-desktop" hx-target="body" name="software-desktop" style="width: 220px">
|
||||
<option value="" {% if desktop == "None" %} selected=selected {% endif %}> None</option>
|
||||
<option value="task-gnome-desktop" {% if desktop == "task-gnome-desktop" %} selected=selected {% endif %} >GNOME</option>
|
||||
<option value="task-kde-desktop" {% if desktop == "task-kde-desktop" %} selected=selected {% endif %}>KDE Plasma</option>
|
||||
<option value="task-xfce-desktop" {% if desktop == "task-xfce-desktop" %} selected=selected {% endif %}>Xfce</option>
|
||||
<option value="task-lxde-desktop" {% if desktop == "task-lxde-desktop" %} selected=selected {% endif %}>LXDE</option>
|
||||
<option value="task-lxqt-desktop" {% if desktop == "task-lxqt-desktop" %} selected=selected {% endif %}>LXQt</option>
|
||||
<option value="task-mate-desktop" {% if desktop == "task-mate-desktop" %} selected=selected {% endif %}>MATE</option>
|
||||
<option value="lomiri" {% if desktop == "lomiri" %} selected=selected {% endif %}>Lomiri</option>
|
||||
<option value="task-cinnamon-desktop" {% if desktop == "task-cinnamon-desktop" %} selected=selected {% endif %}>Cinnamon</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px;">
|
||||
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">
|
||||
Desktop Environment</span>
|
||||
<div style="padding: 15px; padding-top: 10px; padding-bottom: 5px; background-color: #fff; color: #000;">
|
||||
<p>
|
||||
<img src="/static/icons/console.png" width="48px" alt="" style="padding-right: 10px;" />
|
||||
<img src="/static/icons/gnome.jpeg" width="48px" alt="" style="padding-right: 10px;" />
|
||||
<img src="/static/icons/kde.jpeg" width="48px" alt="" style="padding-right: 10px;" />
|
||||
<img src="/static/icons/xfce.jpeg" width="48px" alt="" style="padding-right: 10px;" />
|
||||
<img src="/static/icons/mate.jpeg" width="48px" alt="" style="padding-right: 10px;" />
|
||||
<img src="/static/icons/lxde.jpeg" width="48px" alt="" style="padding-right: 10px;" />
|
||||
<p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px; margin-bottom: 20px;">
|
||||
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">
|
||||
Select software from Debian archives</span>
|
||||
<div style="padding-left: 15px; padding-right: 15px; padding-bottom: 5px; background-color: #fff; color: #000;">
|
||||
<p><b>Select packages or selections of packages from the Debian archives.</b></p>
|
||||
<button class="button is-dark">Games</button>
|
||||
<button class="button is-dark">Productivity</button>
|
||||
<button class="button is-dark">Creativity</button>
|
||||
<button class="button is-dark">Server</button>
|
||||
<button class="button is-dark">Development</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
{% endblock %}
|
||||
BIN
src/yasi_applets/software/static/img/console.png
Normal file
BIN
src/yasi_applets/software/static/img/console.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
src/yasi_applets/software/static/img/gnome.jpeg
Normal file
BIN
src/yasi_applets/software/static/img/gnome.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
src/yasi_applets/software/static/img/kde.jpeg
Normal file
BIN
src/yasi_applets/software/static/img/kde.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
src/yasi_applets/software/static/img/lxde.jpeg
Normal file
BIN
src/yasi_applets/software/static/img/lxde.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
src/yasi_applets/software/static/img/mate.jpeg
Normal file
BIN
src/yasi_applets/software/static/img/mate.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
BIN
src/yasi_applets/software/static/img/xfce.jpeg
Normal file
BIN
src/yasi_applets/software/static/img/xfce.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Reference in New Issue
Block a user