From a63814744159c638206bc224f345d29b3465fc15 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Wed, 11 Sep 2019 07:41:56 +0200 Subject: [PATCH] progress --- test.icl | 121 +++++++++++++------------------------------------------ 1 file changed, 28 insertions(+), 93 deletions(-) diff --git a/test.icl b/test.icl index 8a75a61..5da2a7b 100644 --- a/test.icl +++ b/test.icl @@ -1,104 +1,39 @@ module test - -import Debug.Trace -import iTasks - -import iTasks.Extensions.DateTime -import iTasks.UI.Layout.Minimal - -Start w = doTasksWithOptions opt w2 w -where - t :: Task DateTime - t = waitForTimer 7 - t2 :: Task Int - t2 = enterInformation () [] >>= viewInformation () [] - t3 :: Task String - t3 = withShared 3 \sh-> - withTemporaryDirectory (viewInformation () []) - >>= viewInformation () [] - t4 = updateInformation () [] 42 - - t5 = sequence [return i\\i<-[0..1000]] >>= viewInformation () [] - t6 = waitForTimer 10 - - t7 :: Int -> Task Int - t7 i = viewInformation () [] i >>= \x->t7 (x + 1) - - t8 = viewInformation () [] 1 - >>= \_->(viewInformation () [] 2 - >>= \_->viewInformation () [] 3 - >>= \_->viewInformation () [] 4) - - p = parallel [(Embedded, \_->waitForTimer 5)] [] - p1 = waitForTimer 5 -||- waitForTimer 10 - p2 = withShared 3 \sh->watch sh - - w1 = withShared 0 \sds -> (watch sds @? trace_stdout) -&&- updateInformation () [] 0 -&&- updateSharedInformation () [] sds - - w2 = withShared 0 \sds -> - updateSharedInformation () [] sds - -&&- (whileUnchanged sds (viewInformation () []) @? trace_stdout) - - w3 = forever (viewInformation () [] 32) @? trace_stdout - - opt args eo = Ok eo -// opt args eo = Ok {eo & autoLayout=False} - -/* -//import StdEnv -//import Data.Error -//import Data.Maybe -//import Network.IP -//import System.Socket -//import System.Socket.Ipv4 -////import System.Select // -from Data.Map import singleton -import Data.Map.GenJSON -//import Data.Func -import iTasks - -import iTasks.Extensions.Files - -//Start w = doTasks (onStartup (copyFile "/home/mrl/test.txt" "/home/mrl/test2.txt")) w -//Start w = doTasks (onStartup (workAs SystemUser (return 42))) w -Start w = doTasks t w - -t = viewInformation () [] () - >>* [OnAction ActionOk (always (return ())) - ,OnAction ActionQuit (always (return ())) - ] - +//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 "Int" [] 42) stl -// >>! \i->set (singleton "focus" "true") (sdsFocus i (taskListEntryMeta stl)) -// >>~ \_->viewSharedInformation "Parallel task list" [] +// 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 StdGeneric -// -//generic g a :: a -// -//g{|*|} = 42 - -//Start :: *World -> (MaybeOSError String, *World) -//Start w -// = case socket SocketStream w of -// (Error e, w) = (Error e, w) -// (Ok sockfd, w) -// #! (merr, sockfd) = connect {ipv4_socket_port=8124,ipv4_socket_addr=Just (fromString "127.0.0.1")} sockfd -// | isError merr = (liftError merr, w) -// #! (merr, sockfd) = recv 128 [] sockfd -// | isError merr = (merr, w) -// # (Ok msg) = merr -// # (merr, w) = close sockfd w -// | isError merr = (liftError merr, w) -// = (Ok msg, w) -*/ +import iTasks +Start w = doTasks t w +where + t = viewInformation [ViewUsing id progressBar] (Just 80, Just "bork") + <<@ Title "bork" -- 2.20.1