added gui for file-trees
parent
7d020d8f2f
commit
0ca6a6c63f
|
@ -1,10 +1,10 @@
|
||||||
USING: accessors delegate delegate.protocols io.pathnames
|
USING: accessors arrays delegate delegate.protocols
|
||||||
kernel locals namespaces sequences vectors
|
io.pathnames kernel locals namespaces prettyprint sequences
|
||||||
tools.annotations prettyprint ;
|
ui.frp vectors ;
|
||||||
IN: file-trees
|
IN: file-trees
|
||||||
|
|
||||||
TUPLE: tree node children ;
|
TUPLE: tree node children ;
|
||||||
CONSULT: sequence-protocol tree children>> [ node>> ] map ;
|
CONSULT: sequence-protocol tree children>> ;
|
||||||
|
|
||||||
: <tree> ( start -- tree ) V{ } clone
|
: <tree> ( start -- tree ) V{ } clone
|
||||||
[ tree boa dup children>> ] [ ".." swap tree boa ] bi swap push ;
|
[ tree boa dup children>> ] [ ".." swap tree boa ] bi swap push ;
|
||||||
|
@ -20,4 +20,9 @@ DEFER: (tree-insert)
|
||||||
path-rest [ path-head tree-insert ] unless-empty
|
path-rest [ path-head tree-insert ] unless-empty
|
||||||
] if* ;
|
] if* ;
|
||||||
: create-tree ( file-list -- tree ) [ path-components ] map
|
: create-tree ( file-list -- tree ) [ path-components ] map
|
||||||
t <tree> [ [ tree-insert ] curry each ] keep ;
|
t <tree> [ [ tree-insert ] curry each ] keep ;
|
||||||
|
|
||||||
|
: <dir-table> ( tree-model -- table )
|
||||||
|
<frp-list*> [ node>> 1array ] >>quot
|
||||||
|
[ selected-value>> <switch> ]
|
||||||
|
[ swap >>model ] bi ;
|
Loading…
Reference in New Issue