Skip to content

Commit ae07550

Browse files
committed
Use flex layout for top div
1 parent 865cab9 commit ae07550

File tree

4 files changed

+62
-42
lines changed

4 files changed

+62
-42
lines changed

InteractiveHtmlBom/ecad/kicad.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,9 @@ def parse_footprints(self):
572572
return footprints
573573

574574
def parse_tracks(self, tracks):
575-
tent_vias = self.board.GetTentVias()
575+
tent_vias = True
576+
if hasattr(self.board, "GetTentVias"):
577+
tent_vias = self.board.GetTentVias()
576578
result = {pcbnew.F_Cu: [], pcbnew.B_Cu: []}
577579
for track in tracks:
578580
if track.GetClass() in ["VIA", "PCB_VIA"]:

InteractiveHtmlBom/web/ibom.css

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ textarea.clipboard-temp {
140140

141141
.button-container {
142142
font-size: 0;
143-
margin: 10px 10px 10px 0px;
143+
margin: 0.4rem 0.4rem 0.4rem 0;
144144
}
145145

146146
.dark .button-container {
@@ -171,7 +171,7 @@ canvas:active {
171171
width: 100%;
172172
max-width: 1000px;
173173
border: none;
174-
padding: 5px;
174+
padding: 3px;
175175
}
176176

177177
.fileinfo .title {
@@ -531,7 +531,7 @@ mark.highlight {
531531
.menu {
532532
position: relative;
533533
display: inline-block;
534-
margin: 10px 10px 10px 0px;
534+
margin: 0.4rem 0.4rem 0.4rem 0;
535535
}
536536

537537
.menu-content {
@@ -605,17 +605,35 @@ mark.highlight {
605605
}
606606

607607
.topmostdiv {
608+
display: flex;
609+
flex-direction: column;
608610
width: 100%;
609-
height: 100%;
610611
background-color: white;
611612
transition: background-color 0.3s;
612613
}
613614

614615
#top {
615-
height: 78px;
616+
display: flex;
617+
flex-wrap: wrap;
618+
justify-content: flex-end;
619+
align-items: center;
616620
border-bottom: 2px solid black;
617621
}
618622

623+
#fileinfodiv {
624+
flex: 20rem 1 0;
625+
overflow: auto;
626+
}
627+
628+
#bomcontrols {
629+
display: flex;
630+
flex-direction: row-reverse;
631+
}
632+
633+
#bomcontrols>* {
634+
flex-shrink: 0;
635+
}
636+
619637
.dark #top {
620638
border-bottom: 2px solid #ccc;
621639
}

InteractiveHtmlBom/web/ibom.html

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,30 @@
5656
///USERHEADER///
5757
<div id="topmostdiv" class="topmostdiv">
5858
<div id="top">
59-
<div style="float: right; height: 100%;">
60-
<div class="hideonprint menu" style="float: right; top: 8px;">
59+
<div id="fileinfodiv">
60+
<table class="fileinfo">
61+
<tbody>
62+
<tr>
63+
<td id="title" class="title" style="width: 70%">
64+
Title
65+
</td>
66+
<td id="revision" class="title" style="width: 30%">
67+
Revision
68+
</td>
69+
</tr>
70+
<tr>
71+
<td id="company">
72+
Company
73+
</td>
74+
<td id="filedate">
75+
Date
76+
</td>
77+
</tr>
78+
</tbody>
79+
</table>
80+
</div>
81+
<div id="bomcontrols">
82+
<div class="hideonprint menu">
6183
<button class="menubtn"></button>
6284
<div class="menu-content">
6385
<label class="menu-label menu-label-top" style="width: calc(50% - 18px)">
@@ -152,8 +174,7 @@
152174
</label>
153175
</div>
154176
</div>
155-
<div class="button-container hideonprint"
156-
style="float: right; position: relative; top: 8px">
177+
<div class="button-container hideonprint">
157178
<button id="fl-btn" class="left-most-button" onclick="changeCanvasLayout('F')"
158179
title="Front only">F
159180
</button>
@@ -164,25 +185,23 @@
164185
title="Back only">B
165186
</button>
166187
</div>
167-
<div class="button-container hideonprint"
168-
style="float: right; position: relative; top: 8px">
188+
<div class="button-container hideonprint">
169189
<button id="bom-btn" class="left-most-button" onclick="changeBomLayout('bom-only')"
170190
title="BOM only"></button>
171191
<button id="lr-btn" class="middle-button" onclick="changeBomLayout('left-right')"
172192
title="BOM left, drawings right"></button>
173193
<button id="tb-btn" class="right-most-button" onclick="changeBomLayout('top-bottom')"
174194
title="BOM top, drawings bot"></button>
175195
</div>
176-
<div class="button-container hideonprint"
177-
style="float: right; position: relative; top: 8px">
196+
<div class="button-container hideonprint">
178197
<button id="bom-grouped-btn" class="left-most-button" onclick="changeBomMode('grouped')"
179198
title="Grouped BOM"></button>
180199
<button id="bom-ungrouped-btn" class="middle-button" onclick="changeBomMode('ungrouped')"
181200
title="Ungrouped BOM"></button>
182201
<button id="bom-netlist-btn" class="right-most-button" onclick="changeBomMode('netlist')"
183202
title="Netlist"></button>
184203
</div>
185-
<div class="hideonprint menu" style="float: right; top: 8px;">
204+
<div class="hideonprint menu">
186205
<button class="statsbtn"></button>
187206
<div class="menu-content">
188207
<table class="stats">
@@ -227,7 +246,7 @@
227246
</table>
228247
</div>
229248
</div>
230-
<div class="hideonprint menu" style="float: right; top: 8px;">
249+
<div class="hideonprint menu">
231250
<button class="iobtn"></button>
232251
<div class="menu-content">
233252
<div class="menu-label menu-label-top">
@@ -266,30 +285,8 @@
266285
</div>
267286
</div>
268287
</div>
269-
<div id="fileinfodiv" style="overflow: auto;">
270-
<table class="fileinfo">
271-
<tbody>
272-
<tr>
273-
<td id="title" class="title" style="width: 70%">
274-
Title
275-
</td>
276-
<td id="revision" class="title" style="width: 30%">
277-
Revision
278-
</td>
279-
</tr>
280-
<tr>
281-
<td id="company">
282-
Company
283-
</td>
284-
<td id="filedate">
285-
Date
286-
</td>
287-
</tr>
288-
</tbody>
289-
</table>
290-
</div>
291288
</div>
292-
<div id="bot" class="split" style="height: calc(100% - 80px)">
289+
<div id="bot" class="split" style="flex: 1 1">
293290
<div id="bomdiv" class="split split-horizontal">
294291
<div style="width: 100%">
295292
<input id="reflookup" class="textbox searchbox reflookup hideonprint" type="text" placeholder="Ref lookup"

InteractiveHtmlBom/web/ibom.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,13 +921,15 @@ function changeBomLayout(layout) {
921921
}
922922
document.getElementById("frontcanvas").style.display = "none";
923923
document.getElementById("backcanvas").style.display = "none";
924-
document.getElementById("bot").style.height = "";
924+
document.getElementById("topmostdiv").style.height = "";
925+
document.getElementById("topmostdiv").style.display = "block";
925926
break;
926927
case 'top-bottom':
927928
document.getElementById("tb-btn").classList.add("depressed");
928929
document.getElementById("frontcanvas").style.display = "";
929930
document.getElementById("backcanvas").style.display = "";
930-
document.getElementById("bot").style.height = "calc(100% - 80px)";
931+
document.getElementById("topmostdiv").style.height = "100%";
932+
document.getElementById("topmostdiv").style.display = "flex";
931933
document.getElementById("bomdiv").classList.remove("split-horizontal");
932934
document.getElementById("canvasdiv").classList.remove("split-horizontal");
933935
document.getElementById("frontcanvas").classList.add("split-horizontal");
@@ -954,7 +956,8 @@ function changeBomLayout(layout) {
954956
document.getElementById("lr-btn").classList.add("depressed");
955957
document.getElementById("frontcanvas").style.display = "";
956958
document.getElementById("backcanvas").style.display = "";
957-
document.getElementById("bot").style.height = "calc(100% - 80px)";
959+
document.getElementById("topmostdiv").style.height = "100%";
960+
document.getElementById("topmostdiv").style.display = "flex";
958961
document.getElementById("bomdiv").classList.add("split-horizontal");
959962
document.getElementById("canvasdiv").classList.add("split-horizontal");
960963
document.getElementById("frontcanvas").classList.remove("split-horizontal");

0 commit comments

Comments
 (0)