From 9e32d21b598d67e19396eec1afe14f9e608e8445 Mon Sep 17 00:00:00 2001 From: Alexander Roidl Date: Wed, 30 Nov 2022 16:52:05 +0100 Subject: [PATCH] minor fixes --- app/__init__.py | 2 +- app/static/css/style.css | 135 ++++---- app/templates/home.html | 726 +++++++++++++++++++-------------------- app/views.py | 3 - 4 files changed, 414 insertions(+), 452 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 8c6f89e..c4ba15f 100755 --- a/app/__init__.py +++ b/app/__init__.py @@ -24,7 +24,7 @@ app.config['SECRET_KEY'] = 'super secret key' #app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/mydatabase.db' app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER #app.config['SQLALCHEMY_DATABASE_URI'] = 'rqlite+pyrqlite://localhost:4001/' -app.config['DEBUG'] = True +app.config['DEBUG'] = False app.config['PORT'] = 80 app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'mydatabase.db') diff --git a/app/static/css/style.css b/app/static/css/style.css index bf3e93e..0f5cae9 100755 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -1,18 +1,18 @@ @font-face { font-family: 'metaaccanthisalternaalternate'; src: url('../fonts/metaaccanthisalternate-webfont.woff2') format('woff2'), - url('../fonts/metaaccanthisalternate-webfont.woff') format('woff'); + url('../fonts/metaaccanthisalternate-webfont.woff') format('woff'); font-weight: normal; font-style: normal; } -*{ -font-family: "metaaccanthisalternaalternate"; -box-sizing: border-box; +* { + font-family: "metaaccanthisalternaalternate"; + box-sizing: border-box; } -body{ +body { background-color: #f1f1f1; font-size: clamp(12px, 1.2vw, 25px); box-sizing: border-box; @@ -20,36 +20,36 @@ body{ padding: 0; } -p{ +p { font-size: 1.5em; } -a{ +a { text-decoration: underline; color: inherit; } -a:hover{ +a:hover { text-decoration: inherit; color: inherit; } -audio{ +audio { width: 100%; } -.navigation ul{ +.navigation ul { list-style-type: none; padding: 0; display: flex; justify-content: right; } -.navigation ul li{ +.navigation ul li { padding: 0.5em; } -#map { +#map { position: absolute; top: 0; left: 0; @@ -58,17 +58,17 @@ audio{ z-index: -1; } -.locations_list{ +.locations_list { width: 100%; } -.locations_list .row{ +.locations_list .row { display: flex; justify-content: space-between; border-bottom: 1px solid black; } -.locations_list .row img{ +.locations_list .row img { max-height: 2em; } @@ -81,11 +81,9 @@ audio{ width: 10%; } -.locations_list .row div:last-of-type{ - -} +.locations_list .row div:last-of-type {} -.locations_list .row div{ +.locations_list .row div { width: 20%; padding: 1em; white-space: wrap; @@ -93,11 +91,11 @@ audio{ text-overflow: ellipsis; } -.locations_list .row div audio{ +.locations_list .row div audio { width: 100%; } -.locations_list .row .delete_btn{ +.locations_list .row .delete_btn { text-decoration: none; background-color: black; color: white; @@ -106,29 +104,29 @@ audio{ } -.content_container{ +.content_container { padding: 1em; } /* FROM */ -.form-control{ +.form-control { width: 100%; height: 20vh; box-sizing: border-box; } -#audio{ -margin: 4em 0; +#audio { + margin: 4em 0; } -.record_controls{ +.record_controls { display: flex; justify-content: space-between; } -.audio_btn{ +.audio_btn { font-size: 2em; padding: 0.5em; text-decoration: none; @@ -141,16 +139,16 @@ margin: 4em 0; min-width: 25%; } -.audio_btn:hover{ +.audio_btn:hover { color: white; } -.stop_btn{ +.stop_btn { display: none; - flex-grow:1; + flex-grow: 1; } -.record_btn .icon{ +.record_btn .icon { display: inline-block; background-color: white; width: 0.5em; @@ -159,7 +157,7 @@ margin: 4em 0; margin-right: 0.5em; } -.stop_btn .icon{ +.stop_btn .icon { display: inline-block; background-color: white; width: 0.5em; @@ -167,19 +165,19 @@ margin: 4em 0; margin-right: 0.5em; } -.record_btn{ +.record_btn { background-color: red; - flex-grow:1; + flex-grow: 1; } -.play_btn{ +.play_btn { display: none; flex-grow: 1; position: relative; overflow: hidden; } -.play_btn .icon_p{ +.play_btn .icon_p { display: inline-block; position: relative; top: 0px; @@ -193,26 +191,26 @@ margin: 4em 0; } -.play_btn .icon_b{ +.play_btn .icon_b { box-sizing: border-box; - position: relative; - display: inline-block; - /* transform: scale(var(--ggs,1)); */ - width: 0.5em; - height: 0.5em; - border-left: 0.15em solid; - border-right: 0.15em solid; - margin-right: 0.5em; - z-index: 99; -} - -.play_btn .text{ + position: relative; + display: inline-block; + /* transform: scale(var(--ggs,1)); */ + width: 0.5em; + height: 0.5em; + border-left: 0.15em solid; + border-right: 0.15em solid; + margin-right: 0.5em; + z-index: 99; +} + +.play_btn .text { display: inline-block; position: relative; z-index: 99; } -.play_btn .progress_bar{ +.play_btn .progress_bar { display: block; background-color: rgb(115, 115, 115); position: absolute; @@ -224,24 +222,24 @@ margin: 4em 0; z-index: 0; } -.redo_btn{ +.redo_btn { display: none; } /* POPUP ON FRONTSCREEN */ -.close{ - float:right; +.close { + float: right; font-size: 2em; padding: 0; cursor: pointer; } -.locations_popup .row div:nth-of-type(2){ +.locations_popup .row div:nth-of-type(2) { margin-bottom: 2em; font-size: 2em; } -.locations_popup .row{ +.locations_popup .row { position: fixed; bottom: 0; background-color: black; @@ -256,7 +254,7 @@ margin: 4em 0; padding-bottom: 2em; } -#position{ +#position { position: fixed; display: inline-block; top: 0; @@ -265,7 +263,7 @@ margin: 4em 0; margin: 1em; } -#button_group{ +#button_group { position: fixed; display: inline-block; bottom: 0; @@ -273,13 +271,14 @@ margin: 4em 0; box-sizing: border-box; } -#distance_close{ +#distance_close { font-family: "metaaccanthisalternaalternate"; } -#button_group button, #button_group select{ +#button_group button, +#button_group select { background-color: grey; color: white; font-size: 0.9em; @@ -291,28 +290,28 @@ margin: 4em 0; cursor: pointer; } -#button_group select{ - height:2.8em; +#button_group select { + height: 2.8em; margin: 0; padding-top: 0; padding-bottom: 0; } -#button_group select option{ +#button_group select option { vertical-align: middle; margin: 0; padding-top: 0; padding-bottom: 0; } -#button_group img{ +#button_group img { width: 1em; margin-right: 0.2em; vertical-align: middle; } -button[type="submit"]{ +button[type="submit"] { background-color: grey; color: white; font-size: 1em; @@ -340,9 +339,9 @@ button[type="submit"]{ -.compass > .compass-circle, -.compass > .arrow, -.compass > .compass-goal { +.compass>.compass-circle, +.compass>.arrow, +.compass>.compass-goal { position: absolute; width: 90%; height: 90%; @@ -354,7 +353,7 @@ button[type="submit"]{ pointer-events: none; } -.compass > .compass-circle svg{ +.compass>.compass-circle svg { width: 100%; height: 100%; pointer-events: none; diff --git a/app/templates/home.html b/app/templates/home.html index a1ae83d..b34622b 100755 --- a/app/templates/home.html +++ b/app/templates/home.html @@ -2,56 +2,70 @@ {% block main %}
-

+

-
-
-
-
-
+
+
+ +
+
+ + + + + + +
+
+
- +
(distance to mosquito)
- - + + - +
- - -
{% for location in locations %} -
-
×
-
{{location.longitude}}, {{location.latitude}}
-
{{location.message if location.loc_type == "message"}}
-
- {% if location.loc_type == "audio" %} - - {% endif %} -
+
+
×
+
{{location.longitude}}, {{location.latitude}}
+
{{location.message if location.loc_type == "message"}}
+
+ {% if location.loc_type == "audio" %} + + {% endif %}
+
{% endfor %}
@@ -59,391 +73,343 @@ {% block js %} + const point = { + lat: closest.layer.getLatLng().lat, + lng: closest.layer.getLatLng().lng + }; + + const phiK = (point.lat * Math.PI) / 180.0; + const lambdaK = (point.lng * Math.PI) / 180.0; + const phi = (latitude * Math.PI) / 180.0; + const lambda = (longitude * Math.PI) / 180.0; + const psi = + (180.0 / Math.PI) * + Math.atan2( + Math.sin(lambdaK - lambda), + Math.cos(phi) * Math.tan(phiK) - + Math.sin(phi) * Math.cos(lambdaK - lambda) + ); + return Math.round(psi); + } + + init(); + // + {% endblock js %} \ No newline at end of file diff --git a/app/views.py b/app/views.py index 9b1990a..caec8fa 100755 --- a/app/views.py +++ b/app/views.py @@ -117,8 +117,6 @@ def addtext(lng, lat): upload_form = UploadText() longitude = lng latitude = lat - print(longitude) - print(latitude) if request.method == 'POST': if upload_form.validate_on_submit(): @@ -147,7 +145,6 @@ def addaudio(lng, lat): longitude = upload_form.longitude.data latitude = upload_form.latitude.data file = request.files['file'] - print(file.filename) locations = db.session.query(Location).all() id = len(locations)+1 # Getting the current date and time