-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #377 from refaktor/allin
improving spreadsheet refed functions and tests
- Loading branch information
Showing
14 changed files
with
411 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
rye .needs { fyne } | ||
|
||
Data: context { | ||
|
||
add!: fn { task } { tasks .add-rows! task } | ||
remove!: fn { idx } { tasks .remove-row! idx + 1 } | ||
check!: fn { idx val } { tasks .update-row! idx + 1 dict [ "done" val ] } | ||
make-spreadsheet!: fn { texts } { .map { ::x [ 0 x ] } |unpack |spreadsheet* { "done" "text" } |ref |change! 'tasks } | ||
|
||
tasks: ref spreadsheet { "done" "text" } { } | ||
} | ||
|
||
rye .args\raw .split "," |Data/make-spreadsheet! | ||
|
||
do\par fyne { | ||
|
||
win: app .window "Adhocest TODO app" | ||
|
||
lst: list | ||
does { length? deref Data/tasks } | ||
does { | ||
idx: hide label "idx" | ||
h-box [ | ||
check "" fn\par { v } current | ||
{ Data/check! to-integer idx .text? v , lst .refresh } | ||
label "" | ||
idx | ||
layout-spacer | ||
button-with-icon "" delete-icon fn\par { } current | ||
{ Data/remove! to-integer idx .text? , lst .refresh } | ||
] | ||
} | ||
fn { i box } { | ||
set! box .objects? { chk lbl hdn xo btn } | ||
chk .set-checked 0 <- i <- deref Data/tasks | ||
lbl .set-text 1 <- i <- deref Data/tasks | ||
hdn .set-text to-string i | ||
} | ||
|
||
input: entry | ||
|place-holder! "Add to list here ..." | ||
|on-submitted! fn { x } { | ||
Data/add! [ 0 x ] | ||
input .set-text "" | ||
lst .refresh | ||
} | ||
|
||
cont: border nil input nil nil [ lst ] | ||
|
||
with win { | ||
.resize size 300.0 300.0 , | ||
.set-content cont , | ||
.show-and-run | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
section "spreadsheet ref" | ||
"Functions that mutate refed spreadsheets" | ||
{ | ||
|
||
group "ref" "" | ||
{ { block } } | ||
{ | ||
equal { | ||
spreadsheet { "a" "b" } { 1 10 2 20 3 30 } |is-ref | ||
} false | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.