Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ned/reduce memory usage #33

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ exclude =
R.py
# external packages added to this package to be independent
utemplate
# result of pre-compiling templates
templates/*_tpl.py

# Provide a comma-separated list of glob patterns to add to the list of excluded ones.
# extend-exclude =
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,9 @@ dmypy.json

# Cython debug symbols
cython_debug/

# compiled templates
templates/*_tpl.py

# VS Code settings
.vscode
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$"
<!-- ## [Unreleased] -->

## Released
## [1.13.0] - 2023-06-12
### Added
- Support for frozen, pre-compiled templates
- Support for frozen static resources
- Garbage collect before every request
- Added aiorepl to run() (if you have aiorepl)
### Changed
- Rendering network list using included template rather than string appending
- Simplified static file serving
- Changed spelling of Passwort to Password throughout
- Moved favicon.ico under static/ico to avoid special-case handling
### Removed
- Removed two unused templates
## [1.12.0] - 2023-06-12
### Added
- Instructions for using this package `boot.py` and `main.py` files
Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"github:brainelectronics/Micropython-ESP-WiFi-Manager/static/css/bootstrap.min.css.gz"
],
[
"static/favicon.ico",
"github:brainelectronics/Micropython-ESP-WiFi-Manager/static/favicon.ico"
"static/ico/favicon.ico",
"github:brainelectronics/Micropython-ESP-WiFi-Manager/static/ico/favicon.ico"
],
[
"static/js/toast.js",
Expand All @@ -79,10 +79,14 @@
[
"templates/select.tpl",
"github:brainelectronics/Micropython-ESP-WiFi-Manager/templates/select.tpl"
],
[
"templates/render_nets.tpl",
"github:brainelectronics/Micropython-ESP-WiFi-Manager/templates/render_nets.tpl"
]
],
"deps": [
["github:brainelectronics/micropython-modules", "develop"]
],
"version": "1.11.0"
}
}
4 changes: 2 additions & 2 deletions simulation/templates/select.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h4>Select a WiFi network</h4>
</div>
<input type="text" class="w-100" name="ssid" id="ssid" placeholder="Custom Network Name">
<br>
<input type="password" class="w-100" name="password" id="password" placeholder="Passwort" onkeydown="if(event.keyCode==13)document.getElementById('save').click()"/>
<input type="password" class="w-100" name="password" id="password" placeholder="Password" onkeydown="if(event.keyCode==13)document.getElementById('save').click()"/>
<div class="list-group">
<button type="submit" id="save" value="Save" class="btn btn-lg btn-primary list-group-item active">Submit</button>
<form>
Expand Down Expand Up @@ -97,4 +97,4 @@ <h4>Select a WiFi network</h4>
}
</script>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion simulation/templates/wifi_select_loader.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h4>Select a WiFi network</h4>
{% endfor %}
</select>
<input type="text" name="ssid" id="ssid" placeholder="Custom Network Name">
<input type="password" name="password" id="password" placeholder="Passwort" onkeydown="if(event.keyCode==13)document.getElementById('save').click()"/>
<input type="password" name="password" id="password" placeholder="Password" onkeydown="if(event.keyCode==13)document.getElementById('save').click()"/>
<input type="submit" class="button" id="save" value="Save">
</form>
<form>
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions templates/render_nets.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% args content %}
{% if len(content) %}
{% for net in content %}
<input class="list-group-item-check" type="radio" name="bssid" id="{{net['bssid']}}" value="{{net['bssid']}}"
onclick="remember_selected_element(this)" {{net['state']}}>
<label class="list-group-item py-3" for="{{net['bssid']}}">
{{net['ssid']}}
<span class="d-block small opacity-50">
Signal quality {{net['quality']}}&#37;, BSSID {{net['bssid']}}
</span>
</label>
{% endfor %}
{% else %}
<div class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
</div>
{% endif %}
6 changes: 3 additions & 3 deletions templates/select.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
<div class="list-group list-group-checkable">
<form action="save_wifi_config" method="post" id="save_wifi_config_form">
<div name="wifi_network" id="wifi_network">
{{ content }}
{% include "render_nets.tpl" content %}
</div>
<input type="text" class="w-100" name="ssid" id="ssid" placeholder="Custom Network Name">
<br>
<input type="password" class="w-100" name="password" id="password" placeholder="Passwort" onkeydown="if(event.keyCode==13)document.getElementById('save').click()"/>
<input type="password" class="w-100" name="password" id="password" placeholder="Password" onkeydown="if(event.keyCode==13)document.getElementById('save').click()"/>
<div class="list-group">
<button type="submit" id="save" value="Save" class="btn btn-lg btn-primary list-group-item active">Submit</button>
<form>
Expand Down Expand Up @@ -95,4 +95,4 @@
}
</script>
</body>
</html>
</html>
94 changes: 0 additions & 94 deletions templates/wifi_configs.tpl

This file was deleted.

118 changes: 0 additions & 118 deletions templates/wifi_select_loader.tpl

This file was deleted.

Loading