mirror of https://github.com/OrbTools/OrbBind
Initial commit, contains initial mapping save/load/en/decode
commit
de92635caf
@ -0,0 +1,61 @@
|
||||
package orbweaver
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/Minizbot2012/orbbind/keys"
|
||||
)
|
||||
|
||||
//PKM format for altering the keymap
|
||||
type PKM struct {
|
||||
MIP [20]int
|
||||
SIP [6]int
|
||||
COL [3]int
|
||||
}
|
||||
|
||||
//SaveIntoKeymap saves an orb
|
||||
func SaveIntoKeymap(mapped *PKM, path string) {
|
||||
fil, _ := os.OpenFile(path, os.O_RDWR, 0)
|
||||
for i := 0; i < 26; i++ {
|
||||
if i < 26 {
|
||||
buf := make([]byte, 2)
|
||||
if i < 20 {
|
||||
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.MIP[i])))))
|
||||
} else {
|
||||
binary.LittleEndian.PutUint16(buf, uint16(keys.GetSCForASCII(int(byte(mapped.SIP[i-20])))))
|
||||
}
|
||||
fil.Write(buf)
|
||||
} else {
|
||||
arr := []byte{byte(mapped.COL[0]), byte(mapped.COL[1]), byte(mapped.COL[2])}
|
||||
fil.Write(arr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//LoadFile loads an orb
|
||||
func LoadFile(file string) *PKM {
|
||||
mapped := &PKM{}
|
||||
inf, _ := os.Open(file)
|
||||
for i := 0; i < 26; i++ {
|
||||
b := make([]byte, 2)
|
||||
inf.Read(b)
|
||||
Asc := keys.GetASCIIForSC(int(binary.LittleEndian.Uint16(b)))
|
||||
log.Println(Asc)
|
||||
if i < 26 {
|
||||
if i < 20 {
|
||||
mapped.MIP[i] = Asc
|
||||
} else {
|
||||
mapped.SIP[i-20] = Asc
|
||||
}
|
||||
}
|
||||
}
|
||||
b := make([]byte, 3)
|
||||
inf.Read(b)
|
||||
mapped.COL[0] = int(b[0])
|
||||
mapped.COL[1] = int(b[1])
|
||||
mapped.COL[2] = int(b[2])
|
||||
inf.Close()
|
||||
return mapped
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
Orbweaver Mapping utility for orbmap
|
||||
```go get github.com/Minizbot2012/orbbind```
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,34 @@
|
||||
//go:generate boxy
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/app"
|
||||
"fyne.io/fyne/dialog"
|
||||
"fyne.io/fyne/widget"
|
||||
"github.com/Minizbot2012/orbbind/keymap/orbweaver"
|
||||
"github.com/Minizbot2012/orbbind/ui/mainpage"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ap := app.NewWithID("com.minizbot2012.orbbind")
|
||||
window := ap.NewWindow("Orbweaver Rebinding")
|
||||
window.Resize(fyne.NewSize(480, 480))
|
||||
omap := &orbweaver.PKM{}
|
||||
nmp := mainpage.NewMainPage(window, omap)
|
||||
tabs := widget.NewTabContainer(nmp.Create())
|
||||
tabs.Resize(window.Content().Size())
|
||||
window.SetMainMenu(fyne.NewMainMenu(fyne.NewMenu("File", fyne.NewMenuItem("Save", func() {
|
||||
dialog.ShowFileSave(func(p string) {
|
||||
orbweaver.SaveIntoKeymap(omap, p)
|
||||
}, window)
|
||||
}), fyne.NewMenuItem("Load", func() {
|
||||
dialog.ShowFileOpen(func(p string) {
|
||||
omap = orbweaver.LoadFile(p)
|
||||
nmp.SetBindings(omap)
|
||||
}, window)
|
||||
}))))
|
||||
window.SetContent(tabs)
|
||||
window.ShowAndRun()
|
||||
}
|
@ -0,0 +1 @@
|
||||
{"KEY_0":48,"KEY_1":49,"KEY_2":50,"KEY_3":51,"KEY_4":52,"KEY_5":53,"KEY_6":54,"KEY_7":55,"KEY_8":56,"KEY_9":57,"KEY_A":65,"KEY_APOSTROPHE":39,"KEY_B":66,"KEY_BACKSLASH":92,"KEY_BACKSPACE":8,"KEY_C":67,"KEY_CAPSLOCK":300,"KEY_COMMA":44,"KEY_D":68,"KEY_DELETE":232,"KEY_DOT":46,"KEY_DOWN":239,"KEY_E":69,"KEY_END":233,"KEY_ENTER":10,"KEY_EQUAL":61,"KEY_ESC":27,"KEY_F":70,"KEY_F1":208,"KEY_F10":217,"KEY_F11":218,"KEY_F12":219,"KEY_F13":220,"KEY_F14":221,"KEY_F15":222,"KEY_F16":223,"KEY_F17":224,"KEY_F18":225,"KEY_F19":226,"KEY_F2":209,"KEY_F20":227,"KEY_F21":228,"KEY_F22":229,"KEY_F23":230,"KEY_F24":231,"KEY_F3":210,"KEY_F4":211,"KEY_F5":212,"KEY_F6":213,"KEY_F7":214,"KEY_F8":215,"KEY_F9":216,"KEY_G":71,"KEY_GRAVE":96,"KEY_H":72,"KEY_HOME":234,"KEY_I":73,"KEY_INSERT":235,"KEY_J":74,"KEY_K":75,"KEY_KP0":48,"KEY_KP1":49,"KEY_KP2":50,"KEY_KP3":51,"KEY_KP4":52,"KEY_KP5":53,"KEY_KP6":54,"KEY_KP7":55,"KEY_KP8":56,"KEY_KP9":57,"KEY_KPASTERISK":46,"KEY_KPDOT":46,"KEY_KPENTER":10,"KEY_KPMINUS":45,"KEY_KPPLUS":43,"KEY_KPSLASH":47,"KEY_L":76,"KEY_LEFT":240,"KEY_LEFTALT":200,"KEY_LEFTBRACE":201,"KEY_LEFTCTRL":202,"KEY_LEFTMETA":243,"KEY_LEFTSHIFT":203,"KEY_LINEFEED":236,"KEY_M":77,"KEY_MINUS":45,"KEY_N":78,"KEY_NUMLOCK":69,"KEY_O":79,"KEY_P":80,"KEY_PAGEDOWN":237,"KEY_PAGEUP":238,"KEY_Q":81,"KEY_R":82,"KEY_RESERVED":0,"KEY_RIGHT":241,"KEY_RIGHTALT":204,"KEY_RIGHTBRACE":205,"KEY_RIGHTCTRL":206,"KEY_RIGHTMETA":244,"KEY_RIGHTSHIFT":206,"KEY_S":83,"KEY_SCROLLLOCK":207,"KEY_SEMICOLON":59,"KEY_SLASH":47,"KEY_SPACE":32,"KEY_T":84,"KEY_TAB":9,"KEY_U":85,"KEY_UP":242,"KEY_V":86,"KEY_W":87,"KEY_X":88,"KEY_Y":89,"KEY_Z":90}
|
@ -0,0 +1 @@
|
||||
{"KEY_0":11,"KEY_1":2,"KEY_2":3,"KEY_3":4,"KEY_4":5,"KEY_5":6,"KEY_6":7,"KEY_7":8,"KEY_8":9,"KEY_9":10,"KEY_A":30,"KEY_APOSTROPHE":40,"KEY_B":48,"KEY_BACKSLASH":43,"KEY_BACKSPACE":14,"KEY_C":46,"KEY_CAPSLOCK":58,"KEY_COMMA":51,"KEY_D":32,"KEY_DELETE":111,"KEY_DOT":52,"KEY_DOWN":108,"KEY_E":18,"KEY_END":107,"KEY_ENTER":28,"KEY_EQUAL":13,"KEY_ESC":1,"KEY_F":33,"KEY_F1":59,"KEY_F10":68,"KEY_F11":87,"KEY_F12":88,"KEY_F13":183,"KEY_F14":184,"KEY_F15":185,"KEY_F16":186,"KEY_F17":187,"KEY_F18":188,"KEY_F19":189,"KEY_F2":60,"KEY_F20":190,"KEY_F21":191,"KEY_F22":192,"KEY_F23":193,"KEY_F24":194,"KEY_F3":61,"KEY_F4":62,"KEY_F5":63,"KEY_F6":64,"KEY_F7":65,"KEY_F8":66,"KEY_F9":67,"KEY_G":34,"KEY_GRAVE":41,"KEY_H":35,"KEY_HOME":102,"KEY_I":23,"KEY_INSERT":110,"KEY_J":36,"KEY_K":37,"KEY_KP0":82,"KEY_KP1":79,"KEY_KP2":80,"KEY_KP3":81,"KEY_KP4":75,"KEY_KP5":76,"KEY_KP6":77,"KEY_KP7":71,"KEY_KP8":72,"KEY_KP9":73,"KEY_KPASTERISK":55,"KEY_KPDOT":83,"KEY_KPENTER":96,"KEY_KPMINUS":74,"KEY_KPPLUS":78,"KEY_KPSLASH":98,"KEY_L":38,"KEY_LEFT":105,"KEY_LEFTALT":56,"KEY_LEFTBRACE":26,"KEY_LEFTCTRL":29,"KEY_LEFTMETA":125,"KEY_LEFTSHIFT":42,"KEY_LINEFEED":101,"KEY_M":50,"KEY_MINUS":12,"KEY_N":49,"KEY_NUMLOCK":69,"KEY_O":24,"KEY_P":25,"KEY_PAGEDOWN":109,"KEY_PAGEUP":104,"KEY_Q":16,"KEY_R":19,"KEY_RESERVED":0,"KEY_RIGHT":106,"KEY_RIGHTALT":100,"KEY_RIGHTBRACE":27,"KEY_RIGHTCTRL":97,"KEY_RIGHTMETA":126,"KEY_RIGHTSHIFT":54,"KEY_S":31,"KEY_SCROLLLOCK":70,"KEY_SEMICOLON":39,"KEY_SLASH":53,"KEY_SPACE":57,"KEY_T":20,"KEY_TAB":15,"KEY_U":22,"KEY_UP":103,"KEY_V":47,"KEY_W":17,"KEY_X":45,"KEY_Y":21,"KEY_Z":44}
|
@ -0,0 +1,117 @@
|
||||
package keys
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/driver/desktop"
|
||||
)
|
||||
|
||||
//CKIFyneKeyMap Control Keys interop
|
||||
func CKIFyneKeyMap(e fyne.KeyName) int {
|
||||
fmt.Println(e)
|
||||
switch e {
|
||||
case fyne.KeyUp:
|
||||
return CommonToASCII["KEY_UP"]
|
||||
case fyne.KeyDown:
|
||||
return CommonToASCII["KEY_DOWN"]
|
||||
case fyne.KeyLeft:
|
||||
return CommonToASCII["KEY_LEFT"]
|
||||
case fyne.KeyRight:
|
||||
return CommonToASCII["KEY_RIGHT"]
|
||||
case fyne.KeyEnd:
|
||||
return CommonToASCII["KEY_END"]
|
||||
case fyne.KeyHome:
|
||||
return CommonToASCII["KEY_HOME"]
|
||||
case fyne.KeyInsert:
|
||||
return CommonToASCII["KEY_INSERT"]
|
||||
case fyne.KeyDelete:
|
||||
return CommonToASCII["KEY_DELETE"]
|
||||
case fyne.KeyEnter:
|
||||
return CommonToASCII["KEY_ENTER"]
|
||||
case fyne.KeyTab:
|
||||
return CommonToASCII["KEY_TAB"]
|
||||
case fyne.KeyEscape:
|
||||
return CommonToASCII["KEY_ESC"]
|
||||
case fyne.KeyF1:
|
||||
return CommonToASCII["KEY_F1"]
|
||||
case fyne.KeyF2:
|
||||
return CommonToASCII["KEY_F2"]
|
||||
case fyne.KeyF3:
|
||||
return CommonToASCII["KEY_F3"]
|
||||
case fyne.KeyF4:
|
||||
return CommonToASCII["KEY_F4"]
|
||||
case fyne.KeyF5:
|
||||
return CommonToASCII["KEY_F5"]
|
||||
case fyne.KeyF6:
|
||||
return CommonToASCII["KEY_F6"]
|
||||
case fyne.KeyF7:
|
||||
return CommonToASCII["KEY_F7"]
|
||||
case fyne.KeyF8:
|
||||
return CommonToASCII["KEY_F8"]
|
||||
case fyne.KeyF9:
|
||||
return CommonToASCII["KEY_F9"]
|
||||
case fyne.KeyF10:
|
||||
return CommonToASCII["KEY_F10"]
|
||||
case fyne.KeyF11:
|
||||
return CommonToASCII["KEY_F11"]
|
||||
case fyne.KeyF12:
|
||||
return CommonToASCII["KEY_F12"]
|
||||
case fyne.KeyPageDown:
|
||||
return CommonToASCII["KEY_PAGEDOWN"]
|
||||
case fyne.KeyPageUp:
|
||||
return CommonToASCII["KEY_PAGEUP"]
|
||||
case desktop.KeyAltLeft:
|
||||
return CommonToASCII["KEY_LEFTALT"]
|
||||
case desktop.KeyAltRight:
|
||||
return CommonToASCII["KEY_RIGHTALT"]
|
||||
case desktop.KeyControlLeft:
|
||||
return CommonToASCII["KEY_LEFTCTRL"]
|
||||
case desktop.KeyControlRight:
|
||||
return CommonToASCII["KEY_RIGHTCTRL"]
|
||||
case desktop.KeyShiftLeft:
|
||||
return CommonToASCII["KEY_LEFTSHIFT"]
|
||||
case desktop.KeyShiftRight:
|
||||
return CommonToASCII["KEY_RIGHTSHIFT"]
|
||||
default:
|
||||
return 0x0
|
||||
}
|
||||
}
|
||||
|
||||
//CKIDetName Determines CTRL key status and returns ascii or name for it
|
||||
func CKIDetName(e fyne.KeyName) string {
|
||||
i := CKIFyneKeyMap(e)
|
||||
if i != 0 {
|
||||
return ASCIIToCommon[i]
|
||||
}
|
||||
return "UNK"
|
||||
}
|
||||
|
||||
//CKIDetControl Determines if this is a control key
|
||||
func CKIDetControl(e fyne.KeyName) bool {
|
||||
i := CKIFyneKeyMap(e)
|
||||
if i != 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
//CKICommonName returns common name for ascii
|
||||
func CKICommonName(r int) string {
|
||||
return ASCIIToCommon[r]
|
||||
}
|
||||
|
||||
//CKIASCIIIsPrintable returns true if the ascii is in the printable range
|
||||
func CKIASCIIIsPrintable(r int) bool {
|
||||
return r > 32 && r < 127
|
||||
}
|
||||
|
||||
//CKIName returns the character name, or character if printable for item r
|
||||
func CKIName(r int) string {
|
||||
if r == CommonToASCII["KEY_SPACE"] {
|
||||
return ASCIIToCommon[r]
|
||||
} else if CKIASCIIIsPrintable(r) {
|
||||
return string(r)
|
||||
}
|
||||
return ASCIIToCommon[r]
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package keys
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Minizbot2012/orbbind/box"
|
||||
)
|
||||
|
||||
//Key Codes Map
|
||||
var (
|
||||
ScanToCommon map[int]string
|
||||
ASCIIToCommon map[int]string
|
||||
|
||||
CommonToScan map[string]int
|
||||
CommonToASCII map[string]int
|
||||
)
|
||||
|
||||
func genMap() {
|
||||
ASCII := box.Get("ascii.json")
|
||||
SC := box.Get("scancodes.json")
|
||||
json.Unmarshal(ASCII, &CommonToASCII)
|
||||
json.Unmarshal(SC, &CommonToScan)
|
||||
for k, v := range CommonToASCII {
|
||||
ASCIIToCommon[v] = k
|
||||
}
|
||||
for k, v := range CommonToScan {
|
||||
ScanToCommon[v] = k
|
||||
}
|
||||
}
|
||||
|
||||
//GetASCIIForSC Returns Ascii for Scancode
|
||||
func GetASCIIForSC(r int) int {
|
||||
return CommonToASCII[ScanToCommon[r]]
|
||||
}
|
||||
|
||||
//GetSCForASCII Returns scancode For Ascii
|
||||
func GetSCForASCII(r int) int {
|
||||
return CommonToScan[ASCIIToCommon[r]]
|
||||
}
|
||||
|
||||
func init() {
|
||||
ScanToCommon = make(map[int]string)
|
||||
ASCIIToCommon = make(map[int]string)
|
||||
|
||||
CommonToScan = make(map[string]int)
|
||||
CommonToASCII = make(map[string]int)
|
||||
genMap()
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package baseui
|
||||
|
||||
import (
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/widget"
|
||||
"github.com/Minizbot2012/orbbind/keymap/orbweaver"
|
||||
)
|
||||
|
||||
//BasicPage creates a very basic Page
|
||||
type BasicPage interface {
|
||||
Create() *widget.TabItem
|
||||
}
|
||||
|
||||
//PageWithBindings defines a page with bindings
|
||||
type PageWithBindings interface {
|
||||
BasicPage
|
||||
SetBinding(*orbweaver.PKM)
|
||||
}
|
||||
|
||||
//DialogPage is a dialog popup
|
||||
type DialogPage interface {
|
||||
Create() *fyne.CanvasObject
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package bind
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/driver/desktop"
|
||||
"fyne.io/fyne/layout"
|
||||
"fyne.io/fyne/widget"
|
||||
"github.com/Minizbot2012/orbbind/keys"
|
||||
"github.com/Minizbot2012/orbbind/ui/baseui"
|
||||
)
|
||||
|
||||
//BindingInfo Genral data to use in a channel
|
||||
type BindingInfo struct {
|
||||
Bindid int
|
||||
Bound int
|
||||
}
|
||||
|
||||
//Page Binding UI
|
||||
type Page struct {
|
||||
baseui.DialogPage
|
||||
dev map[string]fyne.CanvasObject
|
||||
Bind BindingInfo
|
||||
window fyne.Window
|
||||
}
|
||||
|
||||
//TypeKey event on key
|
||||
func (bp *Page) TypeKey(e *fyne.KeyEvent) {
|
||||
if keys.CKIDetControl(e.Name) {
|
||||
kp := keys.CKIDetName(e.Name)
|
||||
bp.Bind.Bound = keys.CKIFyneKeyMap(e.Name)
|
||||
bp.dev["BL"].(*widget.Label).SetText(kp)
|
||||
}
|
||||
}
|
||||
|
||||
//TypeRune event one rune type
|
||||
func (bp *Page) TypeRune(key rune) {
|
||||
kp := int(string(strings.ToUpper(string(key)))[0])
|
||||
bp.Bind.Bound = kp
|
||||
bp.dev["BL"].(*widget.Label).SetText(keys.CKIName(bp.Bind.Bound))
|
||||
}
|
||||
|
||||
func (bp *Page) createGrid() *fyne.Container {
|
||||
cont := fyne.NewContainerWithLayout(layout.NewGridLayoutWithColumns(3))
|
||||
cont.AddObject(widget.NewButton("Clear", func() {
|
||||
bp.dev["BL"].(*widget.Label).SetText(keys.CKIName(0))
|
||||
bp.Bind.Bound = 0x0
|
||||
}))
|
||||
k1 := widget.NewButton("Tab", func() { bp.TypeKey(&fyne.KeyEvent{Name: fyne.KeyTab}) })
|
||||
k2 := widget.NewButton("Left Alt", func() { bp.TypeKey(&fyne.KeyEvent{Name: desktop.KeyAltLeft}) })
|
||||
k3 := widget.NewButton("Right Alt", func() { bp.TypeKey(&fyne.KeyEvent{Name: desktop.KeyAltRight}) })
|
||||
k4 := widget.NewButton("Left Control", func() { bp.TypeKey(&fyne.KeyEvent{Name: desktop.KeyControlLeft}) })
|
||||
k5 := widget.NewButton("Right Contorl", func() { bp.TypeKey(&fyne.KeyEvent{Name: desktop.KeyControlRight}) })
|
||||
k6 := widget.NewButton("Left Shift", func() { bp.TypeKey(&fyne.KeyEvent{Name: desktop.KeyShiftLeft}) })
|
||||
k7 := widget.NewButton("Right Shift", func() { bp.TypeKey(&fyne.KeyEvent{Name: desktop.KeyShiftRight}) })
|
||||
cont.AddObject(k1)
|
||||
cont.AddObject(k2)
|
||||
cont.AddObject(k3)
|
||||
cont.AddObject(k4)
|
||||
cont.AddObject(k5)
|
||||
cont.AddObject(k6)
|
||||
cont.AddObject(k7)
|
||||
return cont
|
||||
}
|
||||
|
||||
//Create the binding page popup
|
||||
func (bp *Page) Create(bid string) fyne.CanvasObject {
|
||||
bp.dev = make(map[string]fyne.CanvasObject)
|
||||
bp.dev["BL"] = widget.NewLabel(keys.CKIName(bp.Bind.Bound))
|
||||
pop := widget.NewVBox(bp.dev["BL"], bp.createGrid())
|
||||
bp.window.Canvas().SetOnTypedRune(bp.TypeRune)
|
||||
bp.window.Canvas().SetOnTypedKey(bp.TypeKey)
|
||||
return pop
|
||||
}
|
||||
|
||||
//NewBindPage Create a new bind popup
|
||||
func NewBindPage(bid int, w fyne.Window, def int) *Page {
|
||||
p := &Page{}
|
||||
p.window = w
|
||||
p.Bind.Bindid = bid
|
||||
p.Bind.Bound = def
|
||||
return p
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package mainpage
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"fyne.io/fyne"
|
||||
"fyne.io/fyne/dialog"
|
||||
"fyne.io/fyne/layout"
|
||||
"fyne.io/fyne/widget"
|
||||
"github.com/Minizbot2012/orbbind/keymap/orbweaver"
|
||||
"github.com/Minizbot2012/orbbind/ui/baseui"
|
||||
"github.com/Minizbot2012/orbbind/ui/bind"
|
||||
)
|
||||
|
||||
//Page is a basic page
|
||||
type Page struct {
|
||||
baseui.PageWithBindings
|
||||
binds *orbweaver.PKM
|
||||
dev map[string]fyne.CanvasObject
|
||||
parent fyne.Window
|
||||
}
|
||||
|
||||
func (mp *Page) createButtons() {
|
||||
for i := 0; i < 4; i++ {
|
||||
for j := 0; j < 5; j++ {
|
||||
id := (j + i*5 + 1)
|
||||
mp.dev["B"+strconv.Itoa(id)] = widget.NewButton(strconv.Itoa((j+i*5)+1), func() {
|
||||
popup := bind.NewBindPage(id, mp.parent, mp.binds.MIP[id-1])
|
||||
dialog.ShowCustomConfirm("Binding", "Set", "Cancel", popup.Create(string(id)), func(b bool) {
|
||||
if b {
|
||||
mp.binds.MIP[popup.Bind.Bindid-1] = popup.Bind.Bound
|
||||
}
|
||||
}, mp.parent)
|
||||
})
|
||||
mp.dev["V"].(*fyne.Container).AddObject(mp.dev["B"+strconv.Itoa(id)])
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//SetBindings Sets the binding Map
|
||||
func (mp *Page) SetBindings(o *orbweaver.PKM) {
|
||||
mp.binds = o
|
||||
}
|
||||
|
||||
//Create Creates the main binding page
|
||||
func (mp *Page) Create() *widget.TabItem {
|
||||
mp.dev = make(map[string]fyne.CanvasObject)
|
||||
layout := layout.NewGridLayout(5)
|
||||
mp.dev["V"] = fyne.NewContainerWithLayout(layout)
|
||||
mp.createButtons()
|
||||
return widget.NewTabItem("Main Bindings", mp.dev["V"])
|
||||
}
|
||||
|
||||
//NewMainPage Creates a new main page
|
||||
func NewMainPage(parent fyne.Window, pkm *orbweaver.PKM) *Page {
|
||||
mp := &Page{}
|
||||
mp.binds = pkm
|
||||
mp.parent = parent
|
||||
return mp
|
||||
}
|
Loading…
Reference in New Issue