Browse Source

displaying nicely, still working on details, highlighting and capturing input data

bscheibel 4 years ago
parent
commit
0c759310af
4 changed files with 43 additions and 50 deletions
  1. 15 43
      app/static/css/style.css
  2. 12 0
      app/templates/display_results.html
  3. 11 6
      app/templates/show_image.html
  4. 5 1
      app/views.py

+ 15 - 43
app/static/css/style.css

@@ -1,47 +1,8 @@
 body {
   background-color: #f2f2f2;
 }
-/*.column {
-  float: left;
-  width: 50%;
-}'/
-/* Split the screen in half */
-/*.split {
-  height: 100%;
-  width: 50%;
-  position: fixed;
-  z-index: 1;
-  top: 0;
-  overflow-x: hidden;
-  padding-top: 20px;
-}
-
-/* Control the left side */
-/*.left {
-  left: 0;
-  background-color: white;
-}
-
-/* Control the right side */
-/*.right {
-  right: 0;
-  background-color: white;
-}
-.column {
-  float: left;
-  width: 33.33%;
-}
-.top {
-  height: 50vh;
-  background-color: #f1f1f1;
-}
-
-.bottom {
-  height: 50vh;
-  background-color: #f1f1f1;
-}*/
 /* If you want the content centered horizontally and vertically */
-.centered {
+/*.centered {
   position: absolute;
   top: 50%;
   left: 40%;
@@ -61,15 +22,22 @@ body {
 .thick-border {
         border: 3px solid black;
         border-collapse: collapse;
-}
+}*/
 
 /* Style the image inside the centered container, if needed */
-.centered img {
-  max-width: 140%;
+img {
+  max-width: 100%;
+}
+
+.images{
+  flex: 1 1 auto;
+  min-width: 15em;
+  max-width: 800px;
 }
 
 .container {
     display: flex;
+    flex-wrap: row wrap;
 }
 
 .column {
@@ -89,3 +57,7 @@ body {
 .column-three {
     order: 3;
 }
+
+@media (max-width: 50em) { /* 2 x 15em (.text & .images) + 2em  (left & right margin of the body element) + 1em (.text margin-right)  */
+  .container {flex-wrap: wrap}
+}

+ 12 - 0
app/templates/display_results.html

@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Title</title>
+
+    {{ text }}
+</head>
+<body>
+
+</body>
+</html>

+ 11 - 6
app/templates/show_image.html

@@ -11,7 +11,9 @@
             <h1>Drawing</h1>
             <p> <a href="http://localhost:5000/"> Upload another drawing </a> </p>
         {% if filename %}
-        <img src="{{ url_for('send_file', filename=filename) }}"/>
+        <div class="images">
+            <img src="{{ url_for('send_file', filename=filename) }}"/>
+        </div>
         {% else %}
         <h1>no image for whatever reason</h1>
         {% endif %}
@@ -20,7 +22,7 @@
     <div class="column column-two">
             <h1>Extracted Measurements</h1>
                 <font size="3" face="Courier New" >
-                <form method="post" action="">
+                <form method="post" action="{{ url_for('form_post') }}">
                 <table>
                     <tr>
                         <td style="text-align:center"><h3>Key Value</h3></td>
@@ -28,18 +30,21 @@
                         <td style="text-align:center"><h3>Correct</h3></td>
                         <td style="text-align:center"><h3>Actual Value</h3></td>
                     </tr>
-                    {% for d in dims %}
+                    {% for key in dims %}
+                    <td><h4> {{key}} </h4></td>
+                        {% for d in dims[key][4] %}
                     <tr>
-                        <td style="text-align:center"><input type="checkbox" name="check" value="checked"></td>
+                        <td style="text-align:center"><input type="checkbox" name="relevant" value="checked"></td>
                         <td style="text-align:center"> {{ d }}</td>
-                        <td style="text-align:center"><input type="checkbox" name="check" value="checked"></td>
+                        <td style="text-align:center"><input type="checkbox" name="correct" value="checked"></td>
                         <td style="text-align:center"><input type="text" name="actual" size="10"></td>
                     </tr>
+                        {% endfor %}
                     {% endfor %}
 
 
                 </table>
-                    <button type="button" >Submit</button>
+                    <input type="submit" value="Submit"/>
                 </form>
                 </font>
     </div>

+ 5 - 1
app/views.py

@@ -26,7 +26,7 @@ def convert_pdf(filename):
 
 def extract_all(uuid, filename):
     order_bounding_boxes_in_each_block.main(uuid, UPLOAD_FOLDER + "/" + filename)
-    subprocess.call(['python3','/home/bscheibel/PycharmProjects/dxf_reader/clustering_precomputed_dbscan.py', str(uuid), str(uuid)+"out.html",'localhost'])
+    subprocess.call(['python3','/home/bscheibel/PycharmProjects/dxf_reader/main.py', str(uuid), str(uuid)+"out.html",'localhost'])
 
 @app.route('/', methods=['GET', 'POST'])
 def upload_file():
@@ -90,3 +90,7 @@ def generate(name):
     except:
         return"Sorry file not found"
 
+@app.route('/show_results', methods=['POST'])
+def form_post():
+    text = request.args.get("form")
+    return render_template('display_results.html', text=text)