things
[clean-tests.git] / test.icl
index 600f4d6..88f470b 100644 (file)
--- a/test.icl
+++ b/test.icl
@@ -1,57 +1,48 @@
 module test
-//
-//import Data.Func, StdFunctions, iTasks
-//
-//derive gDefault ChoiceNode
-//
-//Start w = flip doTasks w $
-//     withShared 5 \sharedInt->
-//     withShared [] \sharedSel->
-//     (editSharedSelectionWithShared 
-//             [SelectInTree
-//                     (\l->[{defaultValue & id=i,label=toString i}\\i<-[0..l]])
-//                     (\_ s->s)
-//             ] sharedInt sharedSel <<@ Title "Selection" <<@ multipleAttr False)
-//     -|| (updateSharedInformation [] sharedInt <<@ Title "Number of items")
-//     -|| (updateSharedInformation [] sharedSel <<@ Title "Current selection")
-//     >&> \sh->(viewSharedInformation [] (mapRead toSingleLineText sh) <<@ Title "Current task value" )
-//
-//from Data.Map import singleton
-//import Data.Map.GenJSON
-//import iTasks
-//
-//Start w = doTasks t w
-//
-//t :: Task [(Int, TaskValue Int)]
-//t = parallel
-//     [(Embedded, \stl->
-//             appendTask Embedded (\_->viewInformation [] 42) stl
-//             >>! \i->set (singleton "focus" (JSONBool True)) (sdsFocus i (taskListEntryMeta stl))
-//             >>~ \_->viewSharedInformation []
-//                     (sdsFocus {onlyIndex=Nothing,onlyTaskId=Nothing,onlySelf=False,includeValue=True,includeProgress=True,includeAttributes=True} stl)
-//             @! 42
-//     )] []
-
-//import iTasks
-//Start w = doTasks t w
-//where
-//     t = viewInformation [ViewUsing id progressBar] (Just 80, Just long) <<@ Title "bork"
-//     long = "borkueaohutenhuaostuehasunethuaosnuhtesuhaotsuehtausneohtusoauhtesauhtesnuhtasuhetauhosunehtoauesnhtaueshautesnhutaonsuhetaonsuhetansuhetansuhetaosnuehtaosnuhetaosunhaoetsunehatounsoehtasunhteunaoshuteoasnuhteaosuhnaoetsnuheotasunehotasunhetusnahotueaou"
-
 
+import Data.Func
+import qualified Data.Map as DM
 import iTasks
 
-:: R = { x :: !String, y :: !String }
-derive class iTask R
+/*
+Start w = doTasksWithOptions
+//     (\a o->Ok o)
+       (\a o->Ok {o & autoLayout=False})
+       (parallel
+               [(Embedded, tab "tab1")
+               ,(Embedded, tab "tab2")
+               ]
+               [ OnAction (Action "New") (always (Embedded, tab "New tab"))
+               , OnAction (Action " ") (always (Embedded, tab "New tab"))
+               , OnAction (Action "Close") (never (Embedded, \_->treturn ()))
+               , OnAction (Action "Dis no icon") (never (Embedded, \_->treturn ()))
+               , OnAction (Action "+") (always (Embedded, \_->treturn ()))
+               ]
+//     <<@ ArrangeWithTabs True
+       <<@ ApplyLayout (setActionIcon ('DM'.put " " "new" 'DM'.newMap))
+       ) w
+
+tab title _ = tune (Title title)
+       $   viewInformation [] title
+       >>* [OnAction (Action "Close") (always (treturn ()))]
+*/
 
-Start w = doTasks (t -&&- u) w
+import StdDebug, Text.GenPrint
+Start w = doTasks (onStartup t) w
 
-t = updateSharedInformation
-       [ UpdateSharedAs
-               (\r -> r.x)
-               (\r x -> {r & x=x})
-               const
-       ] s
-u = updateSharedInformation [] s
+null :: SDSSource () () ()
+null = nullShare
 
-s = sharedStore "x" {x="",y=""}
+t = tcpconnect "localhost" 9999 (Just 500) null
+//t = tcpconnect "localhost" 9999 Nothing null
+       { onConnect     = \cid host   r = trace_n (printToString ("onConnect: ", cid, host, r))
+               (Ok (), Nothing, [], False)
+       , onData        = \    data l r = trace_n (printToString ("onData: ", data, l, r))
+               (Ok (), Nothing, [], False)
+       , onShareChange = \         l r = trace_n (printToString ("onShareChange: ", l, r))
+               (Ok (), Nothing, [], False)
+       , onDisconnect  = \         l r = trace_n (printToString ("onDisconnect: ", l, r))
+               (Ok (), Nothing)
+       , onDestroy     = \         l   = trace_n (printToString ("onDestroy: ", l))
+               (Ok (), [])
+       }