2
0
mirror of https://github.com/OrbTools/OrbBind synced 2024-11-11 01:10:45 +00:00

code cleanup

This commit is contained in:
Minizbot2012 2020-12-08 00:35:41 -05:00
parent ee44c6974f
commit 36cf6bb1d3
6 changed files with 6 additions and 11 deletions

1
go.sum
View File

@ -80,6 +80,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190808195139-e713427fea3f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190808195139-e713427fea3f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200328031815-3db5fc6bac03 h1:XpToik3MpT5iW3iHgNwnh3a8QwugfomvxOlyDnaOils=
golang.org/x/tools v0.0.0-20200328031815-3db5fc6bac03/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200328031815-3db5fc6bac03/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@ -21,7 +21,7 @@ func SaveIntoKeymap(mapped *PKM, file fyne.URIWriteCloser) {
//LoadFile loads an orb //LoadFile loads an orb
func LoadFile(file fyne.URIReadCloser) *PKM { func LoadFile(file fyne.URIReadCloser) *PKM {
mapped := &PKM{} mapped := new(PKM)
binary.Read(file, binary.LittleEndian, mapped) binary.Read(file, binary.LittleEndian, mapped)
file.Close() file.Close()
return mapped return mapped

View File

@ -16,7 +16,7 @@ func main() {
window := ap.NewWindow("Orbweaver Rebinding") window := ap.NewWindow("Orbweaver Rebinding")
window.SetMaster() window.SetMaster()
omap := &orbweaver.PKM{} omap := new(orbweaver.PKM)
pages := make(map[string]baseui.PageWithBindings) pages := make(map[string]baseui.PageWithBindings)
pages["main"] = mainpage.NewMainPage(window, omap) pages["main"] = mainpage.NewMainPage(window, omap)
pages["side"] = sidepage.NewSidePage(window, omap) pages["side"] = sidepage.NewSidePage(window, omap)

View File

@ -6,7 +6,6 @@ import (
"fyne.io/fyne/layout" "fyne.io/fyne/layout"
"fyne.io/fyne/widget" "fyne.io/fyne/widget"
"github.com/minizbot2012/orbbind/keys" "github.com/minizbot2012/orbbind/keys"
"github.com/minizbot2012/orbbind/ui/baseui"
) )
//BindingInfo Genral data to use in a channel //BindingInfo Genral data to use in a channel
@ -17,7 +16,6 @@ type BindingInfo struct {
//Page Binding UI //Page Binding UI
type Page struct { type Page struct {
baseui.DialogPage
dev map[string]fyne.CanvasObject dev map[string]fyne.CanvasObject
Bind BindingInfo Bind BindingInfo
window fyne.Window window fyne.Window
@ -59,7 +57,7 @@ func (bp *Page) Create(bid string) fyne.CanvasObject {
//NewBindPage Create a new bind popup //NewBindPage Create a new bind popup
func NewBindPage(bid int, w fyne.Window, def uint16) *Page { func NewBindPage(bid int, w fyne.Window, def uint16) *Page {
p := &Page{} p := new(Page)
p.window = w p.window = w
p.Bind.Bindid = bid p.Bind.Bindid = bid
p.Bind.Bound = def p.Bind.Bound = def

View File

@ -8,13 +8,11 @@ import (
"fyne.io/fyne/layout" "fyne.io/fyne/layout"
"fyne.io/fyne/widget" "fyne.io/fyne/widget"
"github.com/minizbot2012/orbbind/keymap/orbweaver" "github.com/minizbot2012/orbbind/keymap/orbweaver"
"github.com/minizbot2012/orbbind/ui/baseui"
"github.com/minizbot2012/orbbind/ui/bind" "github.com/minizbot2012/orbbind/ui/bind"
) )
//Page is a basic page //Page is a basic page
type Page struct { type Page struct {
baseui.PageWithBindings
binds *orbweaver.PKM binds *orbweaver.PKM
dev map[string]fyne.CanvasObject dev map[string]fyne.CanvasObject
parent fyne.Window parent fyne.Window
@ -53,7 +51,7 @@ func (mp *Page) Create() *widget.TabItem {
//NewMainPage Creates a new main page //NewMainPage Creates a new main page
func NewMainPage(parent fyne.Window, pkm *orbweaver.PKM) *Page { func NewMainPage(parent fyne.Window, pkm *orbweaver.PKM) *Page {
mp := &Page{} mp := new(Page)
mp.binds = pkm mp.binds = pkm
mp.parent = parent mp.parent = parent
return mp return mp

View File

@ -8,13 +8,11 @@ import (
"fyne.io/fyne/layout" "fyne.io/fyne/layout"
"fyne.io/fyne/widget" "fyne.io/fyne/widget"
"github.com/minizbot2012/orbbind/keymap/orbweaver" "github.com/minizbot2012/orbbind/keymap/orbweaver"
"github.com/minizbot2012/orbbind/ui/baseui"
"github.com/minizbot2012/orbbind/ui/bind" "github.com/minizbot2012/orbbind/ui/bind"
) )
//Page Overweave side button configs //Page Overweave side button configs
type Page struct { type Page struct {
baseui.PageWithBindings
binds *orbweaver.PKM binds *orbweaver.PKM
dev map[string]fyne.CanvasObject dev map[string]fyne.CanvasObject
parent fyne.Window parent fyne.Window
@ -46,7 +44,7 @@ func (p *Page) Create() *widget.TabItem {
//NewSidePage Creates a new side configuration page //NewSidePage Creates a new side configuration page
func NewSidePage(parent fyne.Window, pkm *orbweaver.PKM) *Page { func NewSidePage(parent fyne.Window, pkm *orbweaver.PKM) *Page {
p := &Page{} p := new(Page)
p.binds = pkm p.binds = pkm
p.parent = parent p.parent = parent
return p return p