Flaskwebgui works as expected

1123
ZhangGe6 4 years ago
parent c58afa99ee
commit c269500e8c

Binary file not shown.

@ -0,0 +1,4 @@
from flaskwebgui import FlaskUI
from app import app
FlaskUI(app, width=1200, height=800).run()

@ -354,6 +354,34 @@ host.BrowserHost = class {
});
this._view.show('welcome');
// informs flaskwebgui to keep server running while gui is running
// as illusrated in https://github.com/ClimenteA/flaskwebgui#install
// and here: https://stackoverflow.com/questions/39993676/code-inside-domcontentloaded-event-not-working
async function getRequest(url='') {
const response = await fetch(url, {
method: 'GET',
cache: 'no-cache'
})
return response.json()
}
if (this.document.readyState !== 'loading') {
console.log('document is already ready, just execute code here');
let url = this.document.location
let route = "/flaskwebgui-keep-server-alive"
let interval_request = 3 * 1000 //sec
function keep_alive_server(){
getRequest(url + route)
.then(data => console.log(data))
}
setInterval(keep_alive_server, interval_request)
}
}
environment(name) {

@ -66,6 +66,9 @@ view.View = class {
container.addEventListener('touchstart', (e) => this._touchStartHandler(e), { passive: true });
break;
}
}).catch((err) => {
this.error(err, null, null);
});

@ -9,6 +9,8 @@
<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='view-grapher.css')}}">
<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='view-sidebar.css')}}">
<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='sweetalert.css')}}">
<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='sweetalert.css')}}">
<link rel="shortcut icon" type="image/x-icon" href="{{url_for('static', filename='favicon.ico')}}">
<script src="{{url_for('static', filename='sweetalert.min.js')}}"></script>
<script src="{{url_for('static', filename='dagre.js')}}"></script>
<script src="{{url_for('static', filename='base.js')}}"></script>

Loading…
Cancel
Save