Skip to content

Commit 077517c

Browse files
authored
Merge pull request #198 from smj-edison/groups-without-other-commits
Add support for groups
2 parents 204730a + 5b0c0d5 commit 077517c

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

virtual-programs/group.folk

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# load all programs
2+
When group /group/ contains /...programs/ {
3+
Wish tag $group is stabilized
4+
foreach program $programs {
5+
# HACK: claim 'tag' specifically so it doesn't run twice
6+
Claim tag $program has a program
7+
}
8+
}
9+
10+
# figure out the text to display below
11+
When group /group/ contains /...programs/ &\
12+
the collected matches for [list /someone/ wishes /program/ is titled /title/] are /matches/ {
13+
set programTitles [dict create]
14+
15+
foreach match $matches {
16+
set programId [dict get $match program]
17+
18+
if {[lsearch $programs $programId] != -1} {
19+
dict set programTitles $programId [dict get $match title]
20+
}
21+
}
22+
23+
set programTitleText ""
24+
25+
foreach program $programs {
26+
set title [dict_getdef $programTitles $program "(no title)"]
27+
append programTitleText \n $program ": " $title
28+
}
29+
30+
Claim group $group has program titles $programTitleText
31+
}
32+
33+
# display said text
34+
When group /group/ has program titles /programTitles/ &\
35+
/group/ has region /r/ {
36+
set radians [region angle $r]
37+
set pos [region topleft [region move $r down 40px right 15px]]
38+
Wish to draw text with position $pos text $programTitles scale 0.7 radians $radians anchor topleft
39+
}

0 commit comments

Comments
 (0)