Compare commits
2 Commits
9544463bd6
...
088bf495f5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
088bf495f5 | ||
|
|
c0aa82241b |
@@ -14,7 +14,7 @@ def on_closed():
|
||||
window = webview.create_window('System Installer', LOCATION,
|
||||
transparent=True, easy_drag=True, frameless=True,
|
||||
width=1050, focus=True, zoomable=True,
|
||||
confirm_close=True, resizable=True,
|
||||
confirm_close=True, resizable=True, shadow=True
|
||||
)
|
||||
|
||||
webview.settings = {
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
<div class="radios">
|
||||
<label class="radio">
|
||||
<input type="radio" name="rsvp" />
|
||||
Preconfigured partitioning
|
||||
<input selected type="radio" name="rsvp" />
|
||||
Preconfigured partitioning
|
||||
<!-- Let's hide these babies for the initial release.
|
||||
<label class="radio">
|
||||
<input type="radio" name="rsvp" disabled />
|
||||
Erase entire disk
|
||||
@@ -24,9 +25,10 @@
|
||||
Edit existing partitions
|
||||
</label>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="columns" width="100%">
|
||||
<div class="column"><p> <br>Proposed layout: </p></div>
|
||||
<div class="column"><p> <br>Current layout: </p></div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
@@ -136,17 +138,26 @@ fssize: {{ child['fssize'] }}
|
||||
{% endfor %}
|
||||
-->
|
||||
|
||||
<br>
|
||||
{% endfor %}
|
||||
|
||||
<!-- Add Undetected Disk
|
||||
Add Virtual Filesystem
|
||||
Add Network Filesystem -->
|
||||
|
||||
|
||||
</div>
|
||||
<div class="columns" width="100%">
|
||||
<div class="column"><p> <br>Proposed partitioning: </p></div>
|
||||
</div>
|
||||
|
||||
{% for partition in partitions %}
|
||||
<ul>
|
||||
<li> {{ partition }} </li>
|
||||
<ul>
|
||||
|
||||
<!-- {% set commands = partition.split(' ') %} -->
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -21,14 +21,18 @@ def disks():
|
||||
add_disks_button = ' <button class="button iis-info"> <i class="fa fa-hdd-o" aria-hidden="true"></i> Add Disk or Filesystem </button>'
|
||||
add_swap_button = ' <button class="button iis-info"> <i class="fa fa-object-group" aria-hidden="true"></i> Swap Configuration </button>'
|
||||
bottom_menu = add_disks_button + add_swap_button
|
||||
# no bottom menu for this release
|
||||
bottom_menu = ""
|
||||
build_summary()
|
||||
|
||||
return render_template('disks.html', blockdevs=blockdevs,
|
||||
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)
|
||||
next_step=next_step_url,
|
||||
partitions=current_app.config['CONFIG']['recipe']['create_partitions']['commands'],
|
||||
format_partitions=current_app.config['CONFIG']['recipe']['format_partitions'],
|
||||
bottom_menu=bottom_menu)
|
||||
|
||||
|
||||
@bp.route('/disks/partition/<part>')
|
||||
|
||||
@@ -4,7 +4,16 @@
|
||||
<!-- drag region class: -->
|
||||
<div id="titlebar" class="pywebview-drag-region" style="padding: 15px; margin: -15px; padding-bottom: 30px;">
|
||||
|
||||
<a hx-get="/main/menu" hx-swap="outerHTML"/> <button class="button is-link"> <i class="fa fa-bars" aria-hidden="true"></i> </button> </a>
|
||||
|
||||
<!--
|
||||
You might be tempted to replace the unicode character by a fa-code as in the
|
||||
alternate commend below. Don't do it, it causes all kinds of artifacts and
|
||||
glitches as the page reloads (and makes it feel much more like an old website
|
||||
than a proper webapp.
|
||||
-->
|
||||
<a hx-get="/main/menu" hx-swap="outerHTML"/> <button class="button is-link"> ☰ </button> </a>
|
||||
<!--
|
||||
<a hx-get="/main/menu" hx-swap="outerHTML"/> <button class="button is-link"> <i class="fa fa-bars" aria-hidden="true"></i> </button> </a> -->
|
||||
|
||||
{% for item in menu_order %}
|
||||
<a href="{{ menu[item][1]}}"> <button class="button is-{% if request.path == menu[item][1] %}info{% else %}dark{% endif %}"> {{ menu[item][0]}} </button></a>
|
||||
|
||||
@@ -4,12 +4,18 @@
|
||||
|
||||
<div style="background-color: #424242; padding: 15px; border-radius: 15px; boders: none; color: white;">
|
||||
<h1 class="is-size-4"> Help </h1>
|
||||
<br/><p class="title is-6"><span class="tag is-danger">The help system is not yet implemented.</span>
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
<p>The help system is not yet implemented.</p>
|
||||
<br>
|
||||
<p>Some keyboard tips:<p>
|
||||
<br>
|
||||
<ul>
|
||||
<li>ALT+n or CTRL+PGDn moves to the next page.</li>
|
||||
<li>ALT+p or CTRL+PGUp moves to the previous page.</li>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
<div class="columns">
|
||||
<a href="/welcome"><div class="column"><button class="button is-link">Continue</button></div></a>
|
||||
</div>
|
||||
|
||||
@@ -29,11 +29,17 @@ html, body {margin: 0; height: 100%; overflow: hidden;}
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.applet::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.applet {
|
||||
width: 100%;
|
||||
height: 442px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
overflow: -moz-scrollbars-none;
|
||||
}
|
||||
|
||||
.radio:hover {
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<!-- Buttons on the left -->
|
||||
<div style="position: absolute; bottom: 15px; left: 15px;">
|
||||
|
||||
{% if previous_step %}
|
||||
<!-- Why two of these? So that we can use two different keyboard shortcuts for back. -->
|
||||
<button style="display: none;" hx-get="/{{ previous_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[altKey&&key=='b'] from:body"></button>
|
||||
<a href="/{{ previous_step }}"><button hx-get="/{{ previous_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[ctrlKey&&code=='PageUp'] from:body" class="button is-light">Back</button></a>
|
||||
{% endif %}
|
||||
|
||||
{% if bottom_menu %}
|
||||
{{ bottom_menu | safe }}
|
||||
{% endif %}
|
||||
|
||||
</div> <!-- end buttons on the left -->
|
||||
|
||||
|
||||
<!-- Buttons on the right -->
|
||||
<div style="position: absolute; bottom: 15px; right: 15px;">
|
||||
|
||||
{% if next_step %}
|
||||
|
||||
{% if next_step == "install" %}
|
||||
<a href="/{{ next_step }}"><button hx-get="/{{ next_step }}" hx-target="body"
|
||||
hx-trigger="click, keyup[altKey&&key=='i'] from:body" class="button is-link">Install</button></a>
|
||||
{% else %}
|
||||
<!-- Why two of these? So that we can use two different keyboard shortcuts for next. -->
|
||||
<a href="/{{ next_step }}"<button hx-get="/{{ next_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[ctrlKey&&code=='PageDown'] from:body" class=""></button></a>
|
||||
<a href="/{{ next_step }}"<button hx-get="/{{ next_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[altKey&&key=='n'] from:body" class="button is-link">Next</button></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
</div> <!-- end buttons on the right -->
|
||||
@@ -1,20 +0,0 @@
|
||||
<!-- Header -->
|
||||
<div id="titlebar" style="padding: 15px; margin: -15px; padding-bottom: 30px;">
|
||||
|
||||
<!-- drag region class: -->
|
||||
<div id="titlebar" class="pywebview-drag-region" style="padding: 15px; margin: -15px; padding-bottom: 30px;">
|
||||
|
||||
<a hx-get="/main/menu" hx-swap="outerHTML"/> <button class="button is-link"> ☰ </button </a>
|
||||
|
||||
{% for item in menu_order %}
|
||||
<a href="{{ menu[item][1]}}"> <button class="button is-{% if request.path == menu[item][1] %}info{% else %}dark{% endif %}"> {{ menu[item][0]}} </button></a>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<div style="position: absolute; top: 15px; right: 15px;">
|
||||
<a hx-get="/main/help" hx-swap="outerHTML"/> <button class="button is-light"> <b> ? </b> </button></a>
|
||||
<a hx-get="/main/quit" hx-swap="outerHTML"/><button onclick="closeApp()" class="button is-danger" > 🗙 </button></a>
|
||||
</div>
|
||||
|
||||
</div> <!-- end pywebview-drag-region -->
|
||||
<!-- End Header -->
|
||||
@@ -1,27 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="/main/static/bulma.css" rel="stylesheet">
|
||||
<link href="/main/static/system-installer.css" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="/main/static/icons/blippie.png" type="image/x-icon">
|
||||
<link rel="stylesheet" href="/main/static/fork-awesome.css">
|
||||
<script src="/main/static/htmx.min.js" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="frame">
|
||||
{% include "header.html" %}
|
||||
|
||||
<div class="applet">
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
{% include "footer.html" %}
|
||||
|
||||
</div> <!-- class "frame" -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -19,6 +19,9 @@ def summary_index():
|
||||
html = (str(current_app.config['CONFIG']['Summary']['welcome']) + "<br>" + 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(),
|
||||
|
||||
@@ -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 = '<button class="button is-dark"> <i class="fa fa-check" aria-hidden="true"></i> Power: AC </button>'
|
||||
internet_button = ' <button class="button is-dark"> <i class="fa fa-check" aria-hidden="true"></i> Internet </button>'
|
||||
power_button = '<button id="powerbutton" hx-get="/welcome/battery/button" hx-trigger="load, every 1s" hx-target="#powerbutton" class="button is-dark"> <span style="color: #ffffff;"> <i class="fa fa-question" aria-hidden="true"></i></span> Power </button>'
|
||||
internet_button = ' <button id="internetbutton" class="button is-dark" hx-get="/welcome/internet/button" hx-trigger="load, every 1s" hx-target="#internetbutton"><span style="color: #ffffff;"> <i class="fa fa-question" aria-hidden="true"></i></span> 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 = '<button id="powerbutton hx-get="/welcome/battery/button" hx-trigger="load, every 1s" hx-target="#powerbutton" class="button is-dark"> <span style="color: #ffa45c;"> <i class="fa fa-warning" aria-hidden="true"></i></span> Power: Battery: ' + percentage + '%</button>'
|
||||
else:
|
||||
power_button = '<button id="powerbutton hx-get="/welcome/battery/button" hx-trigger="load, every 1s" hx-target="#powerbutton" class="button is-dark"> <span style="color: #a0ff98;"> <i class="fa fa-check" aria-hidden="true"></i></span> 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(' <button id="internetbutton" class="button is-dark" hx-get="/welcome/internet/button" hx-trigger="load, every 1s" hx-target="#internetbutton"><span style="color: #a0ff98;"> <i class="fa fa-check" aria-hidden="true"></i></span> Internet </button>')
|
||||
else:
|
||||
return(' <button id="internetbutton" class="button is-dark" hx-get="/welcome/internet/button" hx-trigger="load, every 1s" hx-target="#internetbutton"><span style="color: #ffa45c;"> <i class="fa fa-warning" aria-hidden="true"></i></span> Internet </button>')
|
||||
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user