2
0
mirror of https://github.com/edouardparis/lntop synced 2024-11-16 00:12:44 +00:00
lntop/ui/ui.go
Edouard f72c5ca099
V0.1.0 (#10)
* config: add Views

* refac views channels

* fix config default

* views: menu

* config default: add comment

* fix config default

* README: enhance config section

* fix README

* controller: F2 Menu

* views: transactions

* fix views: set current in layout

* fix menu

* ft transactions

* fix Help

* fix controller Menu

* view: transaction

* refac controller

* fix ui controller

* try some bold

* fix cursor

* refac color

* focus column transactions

* controller: add keyBinding Menu m

* help view: add menu

* fix cursor: push to the right

* refac remove current model

* ui: txs and channels sortable

* fix focus column

* view transaction: transaction dest addresses

* fix menu

* refac controller

* channels: sort

* rename current column

* refac cursor

* refac currentColumnIndex

* set cursor if view deleted

* remove previous

* clean view.View

* controller: ToggleView

* fix menu

* view txs: add config

* feat order

* fix channels sort
* feat transactions sort
* feat help: add asc/desc
* fix README
* color: magenta
* fix color
* fix views menu
* fix views help
* network backend: SubscribeTransactions
* pubsub: transactions
* controller.Listen: refresh transactions
* fix controller
* fix controller pubsub: no need for wallet ticker
* fix models transactions
* views channels: column SENT and RECEIVED
* update version
* fix README
* fix README
* fix models sort
* fix readme and default config
* fix readme
2019-05-14 18:13:59 +02:00

41 lines
638 B
Go

package ui
import (
"context"
"github.com/jroimartin/gocui"
"github.com/pkg/errors"
"github.com/edouardparis/lntop/app"
"github.com/edouardparis/lntop/events"
)
func Run(ctx context.Context, app *app.App, sub chan *events.Event) error {
g, err := gocui.NewGui(gocui.OutputNormal)
if err != nil {
return err
}
defer g.Close()
g.Cursor = true
ctrl := newController(app)
err = ctrl.SetModels(ctx)
if err != nil {
return err
}
g.SetManagerFunc(ctrl.layout)
err = setKeyBinding(ctrl, g)
if err != nil {
return err
}
go ctrl.Listen(ctx, g, sub)
err = g.MainLoop()
close(sub)
return errors.WithStack(err)
}