Site: order only blocks whose projections overlap; ordering tests
This commit is contained in:
7 files changed
+172
-37
No files matched your search
+18
-13
@@ -122,10 +122,15 @@ def docx(path):
|
||||
|
||||
|
||||
# XLSX: half-year sales by product line.
|
||||
MONTHS = ["January", "February", "March", "April", "May", "June"]
|
||||
LINES = ["Trail Maps", "Guidebooks", "Prints", "Workshops"]
|
||||
SALES = [[4820, 6150, 2310, 1800], [5140, 5980, 2475, 2100], [6380, 7210, 2890, 2650],
|
||||
[7120, 8040, 3120, 3400], [7950, 8820, 3460, 3900], [8610, 9470, 3780, 4350]]
|
||||
MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
|
||||
SALES = {
|
||||
"Trail Maps": [4820, 5140, 6380, 7120, 7950, 8610],
|
||||
"Guidebooks": [6150, 5980, 7210, 8040, 8820, 9470],
|
||||
"Prints": [2310, 2475, 2890, 3120, 3460, 3780],
|
||||
"Workshops": [1800, 2100, 2650, 3400, 3900, 4350],
|
||||
"Postcards": [940, 870, 1120, 1360, 1580, 1710],
|
||||
"Gift Cards": [1250, 980, 760, 820, 1430, 2050],
|
||||
}
|
||||
|
||||
|
||||
def col(i):
|
||||
@@ -139,18 +144,18 @@ def xlsx(path):
|
||||
def num(ref, value, s):
|
||||
return f'<c r="{ref}" s="{s}"><v>{value}</v></c>'
|
||||
|
||||
rows = ['<row r="1" ht="22" customHeight="1">' + text("A1", "Month", 1)
|
||||
+ "".join(text(f"{col(i + 1)}1", n, 2) for i, n in enumerate(LINES)) + text("F1", "Total", 2) + "</row>"]
|
||||
for r, (month, values) in enumerate(zip(MONTHS, SALES), start=2):
|
||||
cells = text(f"A{r}", month, 3) + "".join(num(f"{col(i + 1)}{r}", v, 4) for i, v in enumerate(values))
|
||||
total = sum(values)
|
||||
cells += f'<c r="F{r}" s="5"><f>SUM(B{r}:E{r})</f><v>{total}</v></c>'
|
||||
rows = ['<row r="1" ht="22" customHeight="1">' + text("A1", "Product", 1)
|
||||
+ "".join(text(f"{col(i + 1)}1", m, 2) for i, m in enumerate(MONTHS)) + text("H1", "Total", 2) + "</row>"]
|
||||
for r, (line, values) in enumerate(SALES.items(), start=2):
|
||||
cells = text(f"A{r}", line, 3) + "".join(num(f"{col(i + 1)}{r}", v, 4) for i, v in enumerate(values))
|
||||
cells += f'<c r="H{r}" s="5"><f>SUM(B{r}:G{r})</f><v>{sum(values)}</v></c>'
|
||||
rows.append(f'<row r="{r}" ht="20" customHeight="1">{cells}</row>')
|
||||
rows.append('<row r="8" ht="22" customHeight="1">' + text("A8", "Half year", 1) + "</row>")
|
||||
rows.append('<row r="9" ht="22" customHeight="1">' + text("A9", "All lines", 1)
|
||||
+ "".join(f'<c r="{col(i + 1)}9" s="5"/>' for i in range(7)) + "</row>")
|
||||
sheet = (f'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="{S}">'
|
||||
'<sheetViews><sheetView workbookViewId="0" showGridLines="1" zoomScale="130" zoomScaleNormal="130"/></sheetViews>'
|
||||
'<sheetViews><sheetView workbookViewId="0" showGridLines="1"/></sheetViews>'
|
||||
'<sheetFormatPr defaultRowHeight="20"/>'
|
||||
'<cols><col min="1" max="1" width="16" customWidth="1"/><col min="2" max="6" width="14" customWidth="1"/></cols>'
|
||||
'<cols><col min="1" max="1" width="16" customWidth="1"/><col min="2" max="8" width="12" customWidth="1"/></cols>'
|
||||
f'<sheetData>{"".join(rows)}</sheetData></worksheet>')
|
||||
styles = (f'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><styleSheet xmlns="{S}">'
|
||||
'<numFmts count="1"><numFmt numFmtId="164" formatCode=""$"#,##0"/></numFmts>'
|
||||
|
||||
@@ -8,23 +8,29 @@ wait_log "lok: first tile drawn" 60
|
||||
wait_log "doc: 3 headings"
|
||||
front
|
||||
sleep 3
|
||||
read -r zx zy < <(where "title=zoom-in")
|
||||
record_start doc
|
||||
snap doc-before
|
||||
# The page's left edge, past the outline column.
|
||||
page=$(first_bright doc-before 600 252 225)
|
||||
x=$((win_x + page))
|
||||
y=$win_y
|
||||
read -r zx zy < <(where "title=zoom-in")
|
||||
record_start doc
|
||||
pause 1.0
|
||||
pause 0.6
|
||||
mark "click end of Purpose paragraph"
|
||||
mouse click $((x + 720)) $((y + 392))
|
||||
pause 0.5
|
||||
mark "typing starts"
|
||||
typed " Every route also gets a printable offline map."
|
||||
mark "typing ends"
|
||||
pause 0.8
|
||||
mark "double-click 'forty'"
|
||||
mouse double $((x + 243)) $((y + 351))
|
||||
pause 0.5
|
||||
keys 'keystroke "b" using command down'
|
||||
mark "bold applied"
|
||||
pause 1.0
|
||||
mouse click "$zx" "$zy"
|
||||
mark "zoom to 125%"
|
||||
pause 0.6
|
||||
mouse move $((x + 760)) $((y + 640)) 0.7
|
||||
pause 2.0
|
||||
|
||||
@@ -146,13 +146,23 @@ record_start() {
|
||||
read -r x y w h < <(frame)
|
||||
[ "$w" = "$win_w" ] && [ "$h" = "$win_h" ] || echo "note: window is ${w}x${h}, not ${win_w}x${win_h}" >&2
|
||||
rm -f "$out/rec/$1.mov"
|
||||
cap_name=$1
|
||||
ffmpeg -hide_banner -loglevel error -f avfoundation -capture_cursor 1 -framerate 60 -pixel_format nv12 -i "0:none" \
|
||||
-vf "crop=$((w * 2)):$((h * 2)):$((x * 2)):$((y * 2))" -c:v h264_videotoolbox -b:v 80M -r 60 \
|
||||
"$out/rec/$1.mov" </dev/null &
|
||||
cap_pid=$!
|
||||
t0=$(now)
|
||||
: >"$out/rec/$1.txt"
|
||||
sleep 1.2
|
||||
}
|
||||
|
||||
now() { perl -MTime::HiRes=time -e 'printf "%.2f\n", time'; }
|
||||
|
||||
# Notes a key moment, in clip seconds, for the editor.
|
||||
mark() {
|
||||
awk -v a="$(now)" -v b="$t0" -v m="$1" 'BEGIN { printf "%5.1f %s\n", a - b - 0.5, m }' >>"$out/rec/$cap_name.txt"
|
||||
}
|
||||
|
||||
# Stops capture; encodes 1920x1080 H.264 60 fps; checks frames.
|
||||
record_stop() {
|
||||
local name=$1
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
# ElyTable: SUM row, sort by total, insert a chart.
|
||||
source "$(dirname "$0")/lib.sh"
|
||||
|
||||
us_input
|
||||
launch ely-table "$demo/Sales 2027.xlsx"
|
||||
wait_log "lok: first tile drawn" 60
|
||||
front
|
||||
sleep 4
|
||||
x=$win_x
|
||||
y=$win_y
|
||||
# Cell centers in window points.
|
||||
cell() { echo $((x + $1)) $((y + $2)); }
|
||||
menu() {
|
||||
osascript -e "tell application \"System Events\" to tell (first process whose unix id is $app_pid) to click menu item \"$2\" of menu \"$1\" of menu bar 1" >/dev/null
|
||||
}
|
||||
record_start table
|
||||
pause 0.8
|
||||
mark "click B9"
|
||||
mouse click $(cell 242 357)
|
||||
pause 0.4
|
||||
mark "typing =SUM(B2:B7)"
|
||||
typed "=SUM(B2:B7)"
|
||||
pause 0.4
|
||||
keys "key code 36"
|
||||
mark "formula entered"
|
||||
pause 0.5
|
||||
mouse click $(cell 242 357)
|
||||
pause 0.4
|
||||
mark "fill handle drag B9 to H9"
|
||||
mouse drag $(cell 295 370) $(cell 880 362) 1.0
|
||||
pause 0.8
|
||||
mark "select A1:H7"
|
||||
mouse drag $(cell 118 145) $(cell 880 305) 0.8
|
||||
pause 0.4
|
||||
menu Data AutoFilter
|
||||
mark "AutoFilter on"
|
||||
pause 0.7
|
||||
mouse click $(cell 921 147)
|
||||
mark "Total filter menu open"
|
||||
pause 0.8
|
||||
read -r sx sy < <(where $'title=Sort Z to A\t')
|
||||
mouse click "$sx" "$sy"
|
||||
mark "sorted Z to A by Total"
|
||||
pause 1.2
|
||||
mouse click $(cell 1100 600)
|
||||
pause 0.3
|
||||
mark "select A1:G7"
|
||||
mouse drag $(cell 118 145) $(cell 774 305) 0.8
|
||||
pause 0.4
|
||||
menu Insert "Chart…"
|
||||
mark "Insert Chart dialog"
|
||||
pause 0.8
|
||||
read -r ix iy < <(where $'AXButton\tvalue=\ttitle=Insert\t')
|
||||
mouse click $((ix - 87)) $((iy - 185))
|
||||
typed "Sales by product"
|
||||
pause 0.4
|
||||
mouse click "$ix" "$iy"
|
||||
mark "chart inserted"
|
||||
pause 1.0
|
||||
mouse drag $(cell 520 300) $(cell 520 610) 0.9
|
||||
mark "chart moved below the table"
|
||||
pause 0.6
|
||||
mouse click $(cell 1100 700)
|
||||
pause 1.5
|
||||
record_stop table
|
||||
Reference in new issue
Block a user