From 2c4e395dee21ed8398f0d4a2da62329ec29799fd Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Thu, 9 Feb 2017 19:32:08 +0100 Subject: [PATCH] started with layout --- miTask.icl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/miTask.icl b/miTask.icl index e81f47d..151074e 100644 --- a/miTask.icl +++ b/miTask.icl @@ -10,6 +10,7 @@ from Text import class Text(startsWith,concat,split,join), instance Text String from Data.Func import $ import Data.Tuple +import Data.List import System.Directory import iTasks.UI.Definition @@ -78,12 +79,22 @@ withDevice t = withShared ([], [], False) \ch-> prefixes = ["ttyS", "ttyACM", "ttyUSB", "tty.usbserial"] mTaskManager :: Task () -mTaskManager = viewSharedInformation "Devices" [] deviceStore - ||- forever (addDevice >>= \d->upd (\l->[d:l]) deviceStore) @! () +mTaskManager = viewSharedInformation "Devices" [] deviceStore + ||- forever (addDevice >>= \d->upd (\l->[d:l]) deviceStore) + ||- whileUnchanged deviceStore (\l->showTabbed l <<@ ArrangeWithTabs) <<@ ArrangeHorizontal where deviceStore :: Shared [MTaskDevice] deviceStore = sdsFocus "mTaskDevices" $ memoryStore "" (Just []) + showTabbed :: [MTaskDevice] -> Task () + showTabbed [] = viewInformation "" [] "No devices yet" @! () + showTabbed [l:ls] = foldr (\e es->viewInformation "Dev" [] e ||- es) (viewInformation "Dev" [] l @! ()) ls + + mapPar :: (a -> Task a) [a] -> Task () + mapPar f l = foldr1 (\x y->f x ||- y) l <<@ ArrangeWithTabs @! () + allAtOnce t = foldr1 (||-) t @! () + //allAtOnce = (flip (@!) ()) o foldr1 (||-) + addDevice :: Task MTaskDevice addDevice = enterInformation "Enter device type" [] >>= \ty->case ty of -- 2.20.1