mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2025-12-12 16:08:52 +01:00
add Caller in keyboard ,add OnKdbReturnBackCb on Page interface
This commit is contained in:
parent
efd46d3a35
commit
4ac7debfb4
@ -23,6 +23,7 @@ type WifiPlugin struct {
|
|||||||
|
|
||||||
|
|
||||||
func (self *WifiPlugin) Init( main_screen *UI.MainScreen ) {
|
func (self *WifiPlugin) Init( main_screen *UI.MainScreen ) {
|
||||||
|
|
||||||
self.PasswordPage = UI.NewKeyboard()
|
self.PasswordPage = UI.NewKeyboard()
|
||||||
self.PasswordPage.Name = "Enter wifi password"
|
self.PasswordPage.Name = "Enter wifi password"
|
||||||
self.PasswordPage.Screen= main_screen
|
self.PasswordPage.Screen= main_screen
|
||||||
@ -35,6 +36,8 @@ func (self *WifiPlugin) Init( main_screen *UI.MainScreen ) {
|
|||||||
|
|
||||||
self.ScanPage.Screen = main_screen
|
self.ScanPage.Screen = main_screen
|
||||||
|
|
||||||
|
self.PasswordPage.Caller = self.ScanPage
|
||||||
|
|
||||||
self.ScanPage.Init()
|
self.ScanPage.Init()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
|||||||
@ -42,13 +42,15 @@ func NewWifiDisconnectConfirmPage() *WifiDisconnectConfirmPage {
|
|||||||
|
|
||||||
func (self *WifiDisconnectConfirmPage) KeyDown(ev *event.Event ) {
|
func (self *WifiDisconnectConfirmPage) KeyDown(ev *event.Event ) {
|
||||||
|
|
||||||
|
|
||||||
if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] {
|
if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] {
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self.Screen.Draw()
|
self.Screen.Draw()
|
||||||
self.Screen.SwapAndShow()
|
self.Screen.SwapAndShow()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ev.Data["key"] == UI.CurKeys["B"] {
|
if ev.Data["Key"] == UI.CurKeys["B"] {
|
||||||
|
fmt.Println("Disconnecting..")
|
||||||
self.SnapMsg("Disconnecting...")
|
self.SnapMsg("Disconnecting...")
|
||||||
self.Screen.Draw()
|
self.Screen.Draw()
|
||||||
self.Screen.SwapAndShow()
|
self.Screen.SwapAndShow()
|
||||||
@ -248,6 +250,7 @@ func (self *WifiInfoPage) TryDisconnect() {
|
|||||||
self.Screen.Draw()
|
self.Screen.Draw()
|
||||||
self.Screen.SwapAndShow()
|
self.Screen.SwapAndShow()
|
||||||
}else {
|
}else {
|
||||||
|
fmt.Println("WifiInfoPage TryDisconnect cur_network_id != self.NetworkId ")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -605,7 +608,14 @@ func (self *WifiList) UpdateNetList(state int,info []string ,force_check bool,fi
|
|||||||
if len(info) > 3 {
|
if len(info) > 3 {
|
||||||
_id,_ := strconv.Atoi(info[3])
|
_id,_ := strconv.Atoi(info[3])
|
||||||
if _id < len(self.MyList) {
|
if _id < len(self.MyList) {
|
||||||
self.MyList[_id].UpdateStrenLabel(info[2])
|
var strength_str string
|
||||||
|
strength,err := strconv.Atoi(info[2])
|
||||||
|
if err == nil {
|
||||||
|
self.Daemon.Get(self.Daemon.Method("FormatSignalForPrinting",strength),&strength_str)
|
||||||
|
self.MyList[_id].UpdateStrenLabel(strength_str)
|
||||||
|
}else {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -900,13 +910,17 @@ func (self *WifiList) AbortedAndReturnToUpLevel() {
|
|||||||
self.Screen.SwapAndShow()
|
self.Screen.SwapAndShow()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *WifiList) OnReturnBackCb() {
|
func (self *WifiList) OnKbdReturnBackCb() {
|
||||||
password_inputed := strings.Join(APIOBJ.PasswordPage.Textarea.MyWords,"")
|
password_inputed := strings.Join(APIOBJ.PasswordPage.Textarea.MyWords,"")
|
||||||
if self.Screen.DBusManager.IsWifiConnectedNow() == false {
|
if self.Screen.DBusManager.IsWifiConnectedNow() == false {
|
||||||
self.ConfigWireless(password_inputed)
|
self.ConfigWireless(password_inputed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *WifiList) OnReturnBackCb() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (self *WifiList) KeyDown( ev *event.Event ) {
|
func (self *WifiList) KeyDown( ev *event.Event ) {
|
||||||
if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] {
|
if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] {
|
||||||
if self.Wireless != nil {
|
if self.Wireless != nil {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package UI
|
package UI
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
//"fmt"
|
||||||
"github.com/veandco/go-sdl2/ttf"
|
"github.com/veandco/go-sdl2/ttf"
|
||||||
|
|
||||||
// "github.com/cuu/gogame/surface"
|
// "github.com/cuu/gogame/surface"
|
||||||
@ -144,7 +144,7 @@ func (self *ConfirmPage) Init() {
|
|||||||
|
|
||||||
|
|
||||||
func (self *ConfirmPage) KeyDown( ev *event.Event ) {
|
func (self *ConfirmPage) KeyDown( ev *event.Event ) {
|
||||||
|
|
||||||
if ev.Data["Key"] == CurKeys["A"] || ev.Data["Key"] == CurKeys["Menu"] {
|
if ev.Data["Key"] == CurKeys["A"] || ev.Data["Key"] == CurKeys["Menu"] {
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self.Screen.Draw()
|
self.Screen.Draw()
|
||||||
|
|||||||
@ -89,7 +89,7 @@ type Keyboard struct {
|
|||||||
Textarea *Textarea
|
Textarea *Textarea
|
||||||
Selector *KeyboardSelector
|
Selector *KeyboardSelector
|
||||||
|
|
||||||
|
Caller PageInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewKeyboard() *Keyboard {
|
func NewKeyboard() *Keyboard {
|
||||||
@ -466,6 +466,9 @@ func (self *Keyboard) KeyDown( ev *event.Event) {
|
|||||||
fmt.Println(strings.Join(self.Textarea.MyWords,""))
|
fmt.Println(strings.Join(self.Textarea.MyWords,""))
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self.Screen.SwapAndShow()
|
self.Screen.SwapAndShow()
|
||||||
|
if self.Caller != nil {
|
||||||
|
self.Caller.OnKbdReturnBackCb()
|
||||||
|
}
|
||||||
//Uplevel/Parent page invoke OnReturnBackCb,eg: ConfigWireless
|
//Uplevel/Parent page invoke OnReturnBackCb,eg: ConfigWireless
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -207,6 +207,7 @@ type PageInterface interface {
|
|||||||
|
|
||||||
OnLoadCb()
|
OnLoadCb()
|
||||||
OnReturnBackCb()
|
OnReturnBackCb()
|
||||||
|
OnKbdReturnBackCb()
|
||||||
OnExitCb()
|
OnExitCb()
|
||||||
|
|
||||||
// IconClick()
|
// IconClick()
|
||||||
@ -921,6 +922,10 @@ func (self *Page) OnLoadCb() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Page) OnKbdReturnBackCb() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (self *Page) OnReturnBackCb() {
|
func (self *Page) OnReturnBackCb() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user