Migrate from tview to cview
parent
072595c573
commit
f993690437
|
@ -3,22 +3,22 @@ package main
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"git.sr.ht/~tslocum/cview"
|
||||
"git.sr.ht/~tslocum/gmenu/pkg/gmenu"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/rivo/tview"
|
||||
)
|
||||
|
||||
var (
|
||||
app *tview.Application
|
||||
inputView *tview.InputField
|
||||
app *cview.Application
|
||||
inputView *cview.InputField
|
||||
optionsList *OptionsList
|
||||
appDetailsView *tview.TextView
|
||||
appDetailsView *cview.TextView
|
||||
|
||||
closedGUI bool
|
||||
)
|
||||
|
||||
type OptionsList struct {
|
||||
*tview.TextView
|
||||
*cview.TextView
|
||||
options []string
|
||||
origin int
|
||||
selected int
|
||||
|
@ -27,7 +27,7 @@ type OptionsList struct {
|
|||
|
||||
func NewOptionsList(options []string) *OptionsList {
|
||||
opts := OptionsList{
|
||||
TextView: tview.NewTextView(),
|
||||
TextView: cview.NewTextView(),
|
||||
options: options,
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,9 @@ func (r *OptionsList) Draw(screen tcell.Screen) {
|
|||
r.TextView.SetText(b.String()).Highlight("gmenu").ScrollToBeginning().Draw(screen)
|
||||
}
|
||||
|
||||
func initGUI() (*tview.Application, error) {
|
||||
app = tview.NewApplication()
|
||||
inputView = tview.NewInputField().
|
||||
func initGUI() (*cview.Application, error) {
|
||||
app = cview.NewApplication()
|
||||
inputView = cview.NewInputField().
|
||||
SetLabel("").
|
||||
SetFieldWidth(0).
|
||||
SetFieldBackgroundColor(tcell.ColorDefault).
|
||||
|
@ -77,12 +77,12 @@ func initGUI() (*tview.Application, error) {
|
|||
|
||||
optionsList = NewOptionsList(nil)
|
||||
|
||||
grid := tview.NewGrid().
|
||||
grid := cview.NewGrid().
|
||||
SetBorders(false).
|
||||
SetRows(1, -1)
|
||||
|
||||
appDetailsView = tview.NewTextView().
|
||||
SetTextAlign(tview.AlignLeft).
|
||||
appDetailsView = cview.NewTextView().
|
||||
SetTextAlign(cview.AlignLeft).
|
||||
SetWrap(true).
|
||||
SetWordWrap(true)
|
||||
|
||||
|
|
|
@ -362,9 +362,9 @@ func rowInitFunc(i int, label string, entry *gmenu.ListEntry, lastEntry int, wg
|
|||
|
||||
row.Add(container)
|
||||
listBox.Add(row)
|
||||
row.ShowAll()
|
||||
|
||||
listBox.SelectRow(listBox.GetRowAtIndex(0))
|
||||
row.ShowAll()
|
||||
|
||||
wg.Done()
|
||||
}
|
||||
|
|
12
go.mod
12
go.mod
|
@ -3,15 +3,15 @@ module git.sr.ht/~tslocum/gmenu
|
|||
go 1.12
|
||||
|
||||
require (
|
||||
git.sr.ht/~tslocum/cview v0.2.1-0.20191231040847-3c1736c9c849
|
||||
git.sr.ht/~tslocum/desktop v0.1.3
|
||||
github.com/gdamore/tcell v1.3.0
|
||||
github.com/gotk3/gotk3 v0.0.0-20191027191019-60cba67d4ea4
|
||||
github.com/gotk3/gotk3 v0.0.0-20191204062422-9d4abcb16021
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||
github.com/lithammer/fuzzysearch v1.0.2
|
||||
github.com/lithammer/fuzzysearch v1.1.0
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
|
||||
github.com/mattn/go-isatty v0.0.10
|
||||
github.com/mattn/go-runewidth v0.0.6 // indirect
|
||||
github.com/mattn/go-isatty v0.0.11
|
||||
github.com/mattn/go-runewidth v0.0.7 // indirect
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/rivo/tview v0.0.0-20191018125527-685bf6da76c2
|
||||
golang.org/x/sys v0.0.0-20191115151921-52ab43148777 // indirect
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8 // indirect
|
||||
)
|
||||
|
|
26
go.sum
26
go.sum
|
@ -1,3 +1,5 @@
|
|||
git.sr.ht/~tslocum/cview v0.2.1-0.20191231040847-3c1736c9c849 h1:t18Zd/LG2cxJwAQVSsncquNjAgcn4RpRkCq7EV++Ba8=
|
||||
git.sr.ht/~tslocum/cview v0.2.1-0.20191231040847-3c1736c9c849/go.mod h1:92oD1V0TlLtAeJUruA+p5/P6sVL0p8TMMosPwqz0/gM=
|
||||
git.sr.ht/~tslocum/desktop v0.1.3 h1:0yIUIhAaP8oEaHpKbJ+1L9xGfLaga//fPEimIubFecY=
|
||||
git.sr.ht/~tslocum/desktop v0.1.3/go.mod h1:cUn0Q8ALjkAq40qSei795yN3CfO5pkeYKo2gmzaZ2SI=
|
||||
github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08=
|
||||
|
@ -6,33 +8,31 @@ github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdk
|
|||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
||||
github.com/gdamore/tcell v1.3.0 h1:r35w0JBADPZCVQijYebl6YMWWtHRqVEGt7kL2eBADRM=
|
||||
github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM=
|
||||
github.com/gotk3/gotk3 v0.0.0-20191027191019-60cba67d4ea4 h1:XKmosDfDUElDjCNdtc5SpEArZXi3hOStu0HEOO9fm4Q=
|
||||
github.com/gotk3/gotk3 v0.0.0-20191027191019-60cba67d4ea4/go.mod h1:Eew3QBwAOBTrfFFDmsDE5wZWbcagBL1NUslj1GhRveo=
|
||||
github.com/gotk3/gotk3 v0.0.0-20191204062422-9d4abcb16021 h1:LLebnkC3iiCi0JKWkyWzHKsvwAV+blUJD12GuOVTMc4=
|
||||
github.com/gotk3/gotk3 v0.0.0-20191204062422-9d4abcb16021/go.mod h1:Eew3QBwAOBTrfFFDmsDE5wZWbcagBL1NUslj1GhRveo=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/lithammer/fuzzysearch v1.0.2 h1:AjCE2iwc5y+8K+h2nXVc0Pmrpjvu+JVqMgiZ0oakXDM=
|
||||
github.com/lithammer/fuzzysearch v1.0.2/go.mod h1:bvAJyokfCQ7Vknrd4Kgc+izmMrPj5CiBAu2t6rK1Kak=
|
||||
github.com/lithammer/fuzzysearch v1.1.0 h1:go9v8tLCrNTTlH42OAaq4eHFe81TDHEnlrMEb6R4f+A=
|
||||
github.com/lithammer/fuzzysearch v1.1.0/go.mod h1:Bqx4wo8lTOFcJr3ckpY6HA9lEIOO0H5HrkJ5CsN56HQ=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10=
|
||||
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
||||
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
|
||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
|
||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.6 h1:V2iyH+aX9C5fsYCpK60U8BYIvmhqxuOL3JZcqc1NB7k=
|
||||
github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
|
||||
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/rivo/tview v0.0.0-20191018125527-685bf6da76c2 h1:GVXSfgXOMAeLvFH7IrpY3yYM8H3YekZEFcZ14q9gQXM=
|
||||
github.com/rivo/tview v0.0.0-20191018125527-685bf6da76c2/go.mod h1:/rBeY22VG2QprWnEqG57IBC8biVu3i0DOIjRLc9I8H0=
|
||||
github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191018095205-727590c5006e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191115151921-52ab43148777 h1:wejkGHRTr38uaKRqECZlsCsJ1/TGxIyFbH32x5zUdu4=
|
||||
golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8 h1:JA8d3MPx/IToSyXZG/RhwYEtfrKO1Fxrqe8KrkiLXKM=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
|
|
Loading…
Reference in New Issue