diff --git a/.gitignore b/.gitignore index ae80c16..7943741 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +<<<<<<< HEAD # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies @@ -32,4 +33,8 @@ yarn-error.log* .env.production.local # vercel -.vercel \ No newline at end of file +.vercel +======= +**.pyc +**/__pycache__/** +>>>>>>> 4d16d24a15497db48f449576d1265580e4116827 diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..44b333d --- /dev/null +++ b/Pipfile @@ -0,0 +1,11 @@ +[[source]] +url = 'https://pypi.python.org/simple' +verify_ssl = true + +[requires] +python_version = '3.9.0' + +[packages] +Flask='>2.0.0' + +[dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..a8dc362 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,99 @@ +{ + "_meta": { + "hash": { + "sha256": "ad0305bd6dab81dd0e2295d7d7823599f37728b39fc196878662188a9b74ea86" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.9.0" + }, + "sources": [ + { + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "click": { + "hashes": [ + "sha256:8c04c11192119b1ef78ea049e0a6f0463e4c48ef00a30160c704337586f3ad7a", + "sha256:fba402a4a47334742d782209a7c79bc448911afe1149d07bdabdf480b3e2f4b6" + ], + "markers": "python_version >= '3.6'", + "version": "==8.0.1" + }, + "flask": { + "hashes": [ + "sha256:1c4c257b1892aec1398784c63791cbaa43062f1f7aeb555c4da961b20ee68f55", + "sha256:a6209ca15eb63fc9385f38e452704113d679511d9574d09b2cf9183ae7d20dc9" + ], + "version": "==2.0.1" + }, + "itsdangerous": { + "hashes": [ + "sha256:5174094b9637652bdb841a3029700391451bd092ba3db90600dea710ba28e97c", + "sha256:9e724d68fc22902a1435351f84c3fb8623f303fffcc566a4cb952df8c572cff0" + ], + "markers": "python_version >= '3.6'", + "version": "==2.0.1" + }, + "jinja2": { + "hashes": [ + "sha256:1f06f2da51e7b56b8f238affdd6b4e2c61e39598a378cc49345bc1bd42a978a4", + "sha256:703f484b47a6af502e743c9122595cc812b0271f661722403114f71a79d0f5a4" + ], + "markers": "python_version >= '3.6'", + "version": "==3.0.1" + }, + "markupsafe": { + "hashes": [ + "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298", + "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64", + "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b", + "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567", + "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff", + "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74", + "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35", + "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26", + "sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7", + "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75", + "sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f", + "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135", + "sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8", + "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a", + "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914", + "sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18", + "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8", + "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2", + "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d", + "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b", + "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f", + "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb", + "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833", + "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415", + "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902", + "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9", + "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d", + "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066", + "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f", + "sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5", + "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94", + "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509", + "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51", + "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872" + ], + "markers": "python_version >= '3.6'", + "version": "==2.0.1" + }, + "werkzeug": { + "hashes": [ + "sha256:1de1db30d010ff1af14a009224ec49ab2329ad2cde454c8a708130642d579c42", + "sha256:6c1ec500dcdba0baa27600f6a22f6333d8b662d22027ff9f6202e3367413caa8" + ], + "markers": "python_version >= '3.6'", + "version": "==2.0.1" + } + }, + "develop": {} +} diff --git a/README.md b/README.md index 765c41e..419b8c5 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,4 @@ Unless you are making *major* changes to a page, you likely will want to edit th ### CSS -It's also likely that if you're editing data and components, you'll want to change the theming and styles of things. This project uses [XP.css](https://botoxparty.github.io/XP.css/). \ No newline at end of file +It's also likely that if you're editing data and components, you'll want to change the theming and styles of things. This project uses [XP.css](https://botoxparty.github.io/XP.css/). diff --git a/app.py b/app.py new file mode 100644 index 0000000..9bf2f77 --- /dev/null +++ b/app.py @@ -0,0 +1,29 @@ +from flask import Flask, render_template +from src.powerpanel_manage import get_status_dict +app = Flask(__name__) + +def format_status_dict(): + status_dict = get_status_dict() + info_dict = { + 'Rating Voltage': status_dict['Rating Voltage'], + 'Rating Power': status_dict['Rating Power'], + 'State': status_dict['State'] + } + title_dict = { + 'Model Name': status_dict['Model Name'], + 'Firmware Number': status_dict['Firmware Number'], + 'Power Supply by': status_dict['Power Supply by'] + } + for key in info_dict.keys(): + status_dict.pop(key) + for key in title_dict.keys(): + status_dict.pop(key) + return (title_dict, info_dict, status_dict) + +@app.route('/') +def main_page(): + title_dict, info_dict, status_dict = format_status_dict() + return render_template('index.html', title_dict=title_dict, info_dict=info_dict, status_dict=status_dict) + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=9090) diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..ba602e5 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,33 @@ + + + + + PowerPanel Webview + + + + +
+
+
PowerPanel Info | Power Supply by: {{ title_dict['Power Supply by'] }} | Model: {{ title_dict['Model Name'] }} | Firmware: {{ title_dict['Firmware Number'] }}
+
+ + + +
+
+
+ {% for item in status_dict.keys() %} +

{{ item }}

+

{{ status_dict[item] }}

+ {% endfor %} +
+
+ {% for item in info_dict.keys() %} +

{{ item }}: {{ info_dict[item] }}

+ {% endfor %} +
+
+ + + \ No newline at end of file