From: Mart Lubbers Date: Thu, 9 Feb 2017 18:32:08 +0000 (+0100) Subject: started with layout X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=2c4e395dee21ed8398f0d4a2da62329ec29799fd;p=mTask.git started with layout --- 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