Skip to content

Commit 114ff7a

Browse files
authored
Merge pull request odwdinc#12 from hankhank10/master
Front end web server now running
2 parents 9440ab3 + 7ad6fbf commit 114ff7a

File tree

7 files changed

+771
-273
lines changed

7 files changed

+771
-273
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,4 @@ dmypy.json
139139
.idea/workspace.xml
140140
.DS_Store
141141
.idea/inspectionProfiles/Project_Default.xml
142+
.idea/CodeStyles/codeStyleConfig.xml

flask_server.py

Lines changed: 0 additions & 247 deletions
This file was deleted.

glass_dummy_server.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#
2+
# This is a dummy server which does not connect to MSFS2020
3+
# It just serves up random data which allows testing of the front end without MSFS2020 running
4+
# If you want to connect to MSFS2020 then you are looking for glass_server.py
5+
6+
7+
from flask import Flask, jsonify, render_template, request
8+
from time import sleep
9+
import random
10+
11+
app = Flask(__name__)
12+
13+
latitude = 47.606209
14+
longitude = -122.332069
15+
16+
def thousandify(x):
17+
return f"{x:,}"
18+
19+
20+
@app.route('/ajaxtest')
21+
def ajax_test():
22+
return render_template("ajaxtest3.html")
23+
24+
25+
@app.route ('/glass')
26+
def glass():
27+
return render_template("glass.html")
28+
29+
@app.route('/ui')
30+
def output_ui_variables():
31+
global latitude, longitude
32+
33+
ui_friendly_dictionary = {}
34+
ui_friendly_dictionary["STATUS"] = "success"
35+
ui_friendly_dictionary["ALTITUDE"] = thousandify(random.randint(5000,35000))
36+
ui_friendly_dictionary["LATITUDE"] = latitude
37+
ui_friendly_dictionary["LONGITUDE"] = longitude
38+
ui_friendly_dictionary["AIRSPEED_INDICATE"] = random.randint(50,400)
39+
ui_friendly_dictionary["MAGNETIC_COMPASS"] = random.randint(1,360)
40+
ui_friendly_dictionary["VERTICAL_SPEED"] = random.randint(-2000,2000)
41+
ui_friendly_dictionary["FUEL_PERCENTAGE"] = random.randint(0,100)
42+
43+
longitude = longitude + 0.01
44+
45+
return jsonify(ui_friendly_dictionary)
46+
47+
48+
app.run(host='0.0.0.0', port=5000, debug=True)

glass_server.py

Lines changed: 345 additions & 0 deletions
Large diffs are not rendered by default.

reporter.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

static/img/plane.png

1.86 KB
Loading

0 commit comments

Comments
 (0)