@@ -12,42 +12,34 @@ import Relude
1212
1313
1414import Potato.Flow
15- import Potato.Flow.Controller
1615import Potato.Flow.TestStates
17- import Potato.Flow.Vty.Attrs
1816import Potato.Flow.Vty.Canvas
19- import Potato.Flow.Vty.Info
2017import Potato.Flow.Vty.Input
2118import Potato.Flow.Vty.Layer
2219import Potato.Flow.Vty.Params
2320import Potato.Flow.Vty.PotatoReader
2421import Potato.Flow.Vty.Tools
2522import Potato.Flow.Vty.Left
26- import Potato.Flow.Vty.Common
2723import Potato.Reflex.Vty.Helpers
2824import Potato.Reflex.Vty.Widget.Popup
29- import Potato.Reflex.Vty.Widget.FileExplorer
3025import Potato.Reflex.Vty.Widget
3126import qualified Potato.Reflex.Vty.Host
3227import Potato.Flow.Vty.SaveAsWindow
3328import Potato.Flow.Vty.Alert
3429import Potato.Flow.Vty.AppKbCmd
3530
36- import System.IO (stderr , stdout , hFlush )
31+ import System.IO (hFlush )
3732import System.Console.ANSI (hSetTitle )
3833import qualified System.FilePath as FP
3934import qualified System.Directory as FP
4035
4136import Control.Concurrent
42- import Control.Monad.Fix
4337import Control.Monad.NodeId
4438import Control.Exception (handle )
4539import qualified Data.Aeson as Aeson
4640import qualified Data.Aeson.Encode.Pretty as PrettyAeson
4741import Data.Maybe
48- import Data.Monoid (Any )
4942import Data.Default
50- import qualified Data.Text as T
5143import qualified Data.Text.Encoding as T
5244import qualified Data.Text.Lazy as LT
5345import qualified Data.Text.Lazy.Encoding as LT
@@ -60,10 +52,8 @@ import Data.These
6052import Network.HTTP.Simple
6153
6254import qualified Graphics.Vty as V
63- import qualified Graphics.Vty.Input.Events as V
64- import qualified Graphics.Vty.UnicodeWidthTable.IO as V
55+ -- import qualified Graphics.Vty.UnicodeWidthTable.IO as V
6556import Reflex
66- import Reflex.Host.Class
6757import Reflex.Potato.Helpers
6858import Reflex.Vty
6959
@@ -89,7 +79,7 @@ potatoMainWidgetWithHandle vty child =
8979 let inp' = fforMaybe inp $ \ case
9080 V. EvResize {} -> Nothing
9181 x -> Just x
92- (shutdown, images ) <- runThemeReader (constant V. defAttr) $
82+ (shutdown, imgs ) <- runThemeReader (constant V. defAttr) $
9383 runFocusReader (pure True ) $
9484 runDisplayRegion (fmap (\ (w, h) -> Region 0 0 w h) size) $
9585 runImageWriter $
@@ -98,7 +88,7 @@ potatoMainWidgetWithHandle vty child =
9888 tellImages . ffor (current size) $ \ (w, h) -> [V. charFill V. defAttr ' ' w h]
9989 child
10090 return $ Potato.Reflex.Vty.Host. VtyResult
101- { _vtyResult_picture = fmap (V. picForLayers . reverse ) images
91+ { _vtyResult_picture = fmap (V. picForLayers . reverse ) imgs
10292 , _vtyResult_shutdown = shutdown
10393 }
10494
@@ -133,7 +123,7 @@ potatoMainWidget child = do
133123
134124
135125-- | tick once (redraw widgets) upon event firing
136- tickOnEvent :: (Reflex t , Adjustable t m ) => Event t a -> m ()
126+ tickOnEvent :: (Adjustable t m ) => Event t a -> m ()
137127tickOnEvent ev = void $ runWithReplace (return () ) (ev $> return () )
138128
139129-- | TODO move to ReflexHelpers
@@ -189,6 +179,10 @@ welcomeWidget = do
189179 (grout . stretch) 1 $ text (current welcomeMessageDyn)
190180 (grout . fixed) 3 $ textButton def (constant " bye" )
191181
182+
183+
184+
185+ -- TODO DELETE OR MOVE UNUSED
192186-- | toggle the focus of a widget
193187-- also forces unfocused widget to ignore mouse inputs
194188focusWidgetNoMouse :: forall t m a . (MonadWidget t m )
@@ -200,6 +194,7 @@ focusWidgetNoMouse f child = do
200194 localInput (gate (current f)) $
201195 child
202196
197+ -- TODO DELETE OR MOVE UNUSED
203198-- | ignores mouse input unless widget is focused
204199ignoreMouseUnlessFocused :: forall t m a . (MonadWidget t m )
205200 => m a
@@ -208,6 +203,8 @@ ignoreMouseUnlessFocused child = do
208203 f <- focus
209204 focusWidgetNoMouse f child
210205
206+
207+
211208-- | block all or some input events, always focused if parent is focused
212209captureInputEvents :: forall t m a . (MonadWidget t m )
213210 => These (Event t () ) (Behavior t Bool ) -- ^ This ev is event indicating input should be capture. That beh is behavior gating input (true means captured)
@@ -244,7 +241,7 @@ mainPFWidgetWithBypass :: forall t m. (MonadWidget t m)
244241 -> m (Event t () )
245242mainPFWidgetWithBypass MainPFWidgetConfig {.. } bypassEvent = mdo
246243 -- external inputs
247- currentTime <- liftIO $ getCurrentTime
244+ -- currentTime <- liftIO $ getCurrentTime
248245
249246 -- note tickEv triggers 2 ticks
250247 -- tickEv <- tickLossy 1 currentTime
@@ -330,6 +327,9 @@ mainPFWidgetWithBypass MainPFWidgetConfig {..} bypassEvent = mdo
330327 , _goatWidgetConfig_setPotatoDefaultParameters = _paramsWidget_setDefaultParamsEvent (_leftWidget_paramsW leftW)
331328 , _goatWidgetConfig_markSaved = void performSaveEv
332329
330+ -- TODO
331+ -- , _goatWidgetConfig_unicodeWidthFn =
332+
333333 -- debugging stuff
334334 , _goatWidgetConfig_setDebugLabel = never
335335 , _goatWidgetConfig_bypassEvent = bypassEvent
0 commit comments