From bf1d3931fe685a97ae038f50f2e251a5c08e6f71 Mon Sep 17 00:00:00 2001
From: Jacob Wikmark <jacob@wikmark.se>
Date: Thu, 8 Mar 2018 12:39:14 +0100
Subject: [PATCH] nicer layout

---
 src/tankgraphic.jl | 7 -------
 src/tanklabgui.jl  | 8 ++++++--
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/tankgraphic.jl b/src/tankgraphic.jl
index 952b429..a0ffaa7 100644
--- a/src/tankgraphic.jl
+++ b/src/tankgraphic.jl
@@ -30,9 +30,6 @@ function stream(width, height, x, y)
     anim2 = dom"svg:animate"(attributes=animate2)
     stline1 = Node(instanceof(dom"svg:rect"()), anim1, style = smallstyle, attributes = attr_small)
     stline2 = Node(instanceof(dom"svg:rect"()), anim2, style = smallstyle, attributes = attr_small)
-    #stlines = (svg_rect(width, thickness, x, y+(speed*time() + i)%ht, smallstyle) 
-    #for i in 0:ht/lines:ht)
-    #(svg_rect(width, height, x, y, bigstyle), stlines...)
     (svg_rect(width, height, x, y, bigstyle), stline1, stline2)
 end
 
@@ -40,7 +37,6 @@ end
 function water_container(width, height, fill, x=0, y=0)
     #Produces an SVG water container of size height, width, filled from the
     #bottom to the height fill (as a proportion of height
-    #fill_level = fill*height
     fill_level = fill*height
     water_style = Dict(:fill => "rgb$s_blue")
     wall_style  = Dict(:fill => "rgb$s_black")
@@ -48,7 +44,6 @@ function water_container(width, height, fill, x=0, y=0)
                            "y" => "$y",
                            "width" => "$width",
                           "height" => "$height")
-    #svg_rect(width, fill_level, height-fill_level, water_style)
     Node(svgsvg_symb, 
          svg_rect(width, fill_level, 0, height-fill_level, water_style),
          svg_rect(wall_thickness, height, 0, 0, wall_style),
@@ -65,7 +60,6 @@ function tank_construct(upper, lower, pump_speed = 1, tnum = 0, r = -1)
 
     arrowwidth = 0
     arrowheight= 20
-    arrowtext = ""
     upper_x = 75
     upper_y = 100
     lower_x = 75
@@ -91,7 +85,6 @@ function tank_construct(upper, lower, pump_speed = 1, tnum = 0, r = -1)
                           (tank_width/2+pipe_thickness*2, 4*pt)], s_black)
 
 
-    #remove constraints later when controller is bug free
     w1 = mouth_width*sqrt(max(0,pump_speed))
     w2 = mouth_width*sqrt(max(0, upper))
     w3 = mouth_width*sqrt(max(0, lower))
diff --git a/src/tanklabgui.jl b/src/tanklabgui.jl
index c1e2699..40f0395 100644
--- a/src/tanklabgui.jl
+++ b/src/tanklabgui.jl
@@ -49,7 +49,7 @@ function makegui(P, plottingframerate = 10, guiframerate = 10)
         else
             tankg = tank_construct(measure(P)..., obs(u)[]*ptfr)
         end
-        Node(:div, tankg, id="tanks")
+        Node(:div, tankg, id="tanks", attributes=tankattr)
     end
 
     w2, graphic2 = @construct for 
@@ -130,7 +130,11 @@ function makegui(P, plottingframerate = 10, guiframerate = 10)
     left_element = setindex_(left_element, corner_element, 1, 1)
     left_element = setindex_(left_element, graphic2, 2, 1)
     layout = setindex_(layout, left_element, 1, 1)
-    layout = setindex_(layout, Node(:div, graphic1, dummygraphic1, dummygraphic2, io_element), 1, 2)
+    layout = setindex_(layout, Node(:div, graphic1, dummygraphic1, dummygraphic2, io_element,
+                                   attributes = tankattr), 1, 2)
+
+    #This makes it look a bit nicer, reducing the width of the right column
+    layout[1][2].props[:style][:width] = "25%"
 
 
     LabGUI.set!(gui, layout)
-- 
GitLab