mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2026-03-19 10:22:41 +01:00
add 99_PowerOFF
This commit is contained in:
@@ -186,8 +186,8 @@ func (self *SoundSlider) StepBack() {
|
||||
if self.Value < 0 {
|
||||
self.Value = 0
|
||||
}
|
||||
|
||||
vol := self.snd_segs[self.Value][0]
|
||||
|
||||
vol := self.snd_segs[self.Value][0] + (self.snd_segs[self.Value][1]-self.snd_segs[self.Value][0])/2
|
||||
|
||||
if self.OnChangeCB != nil {
|
||||
self.OnChangeCB(vol)
|
||||
|
||||
5
Menu/GameShell/99_PowerOFF/plugin.json
Normal file
5
Menu/GameShell/99_PowerOFF/plugin.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"SO_FILE":"",
|
||||
"NAME":"PowerOFF"
|
||||
}
|
||||
|
||||
39
Menu/GameShell/99_PowerOFF/plugin_init.go
Normal file
39
Menu/GameShell/99_PowerOFF/plugin_init.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package PowerOFF
|
||||
|
||||
import (
|
||||
/*
|
||||
"github.com/veandco/go-sdl2/ttf"
|
||||
|
||||
"github.com/cuu/gogame/surface"
|
||||
"github.com/cuu/gogame/event"
|
||||
"github.com/cuu/gogame/rect"
|
||||
"github.com/cuu/gogame/color"
|
||||
*/
|
||||
"github.com/cuu/LauncherGoDev/sysgo/UI"
|
||||
//"github.com/cuu/LauncherGoDev/sysgo/DBUS"
|
||||
)
|
||||
|
||||
/******************************************************************************/
|
||||
type PowerOFFPlugin struct {
|
||||
UI.Plugin
|
||||
PowerOFFPage *PowerOFFConfirmPage
|
||||
}
|
||||
|
||||
|
||||
func (self *PowerOFFPlugin) Init( main_screen *UI.MainScreen ) {
|
||||
self.PowerOFFPage = NewPowerOFFConfirmPage()
|
||||
self.PowerOFFPage.SetScreen( main_screen)
|
||||
self.PowerOFFPage.SetName("PowerOFF")
|
||||
self.PowerOFFPage.Init()
|
||||
}
|
||||
|
||||
func (self *PowerOFFPlugin) Run( main_screen *UI.MainScreen ) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.PowerOFFPage)
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
var APIOBJ PowerOFFPlugin
|
||||
64
Menu/GameShell/99_PowerOFF/poweroff_confirm_page.go
Normal file
64
Menu/GameShell/99_PowerOFF/poweroff_confirm_page.go
Normal file
@@ -0,0 +1,64 @@
|
||||
package PowerOFF
|
||||
|
||||
import (
|
||||
|
||||
"github.com/cuu/gogame/event"
|
||||
"github.com/cuu/LauncherGoDev/sysgo/UI"
|
||||
|
||||
)
|
||||
|
||||
type PowerOFFConfirmPage struct {
|
||||
UI.ConfirmPage
|
||||
|
||||
}
|
||||
|
||||
func NewPowerOFFConfirmPage() *PowerOFFConfirmPage {
|
||||
|
||||
p := &PowerOFFConfirmPage{}
|
||||
p.ListFont = UI.Fonts["veramono20"]
|
||||
p.ConfirmText = "Awaiting Input"
|
||||
p.FootMsg = [5]string{ "Nav","Reboot","","Cancel","Shutdown" }
|
||||
|
||||
p.ConfirmPage.ConfirmText = p.ConfirmText
|
||||
p.ConfirmPage.FootMsg = p.FootMsg
|
||||
p.ConfirmPage.ListFont = p.ListFont
|
||||
|
||||
return p
|
||||
|
||||
}
|
||||
|
||||
func (self *PowerOFFConfirmPage) KeyDown(ev *event.Event) {
|
||||
|
||||
if ev.Data["Key"] == UI.CurKeys["Menu"] || ev.Data["Key"] == UI.CurKeys["A"] {
|
||||
self.ReturnToUpLevelPage()
|
||||
self.Screen.Draw()
|
||||
self.Screen.SwapAndShow()
|
||||
|
||||
}
|
||||
|
||||
if ev.Data["Key"] == UI.CurKeys["B"] {
|
||||
cmdpath := ""
|
||||
|
||||
if UI.CheckBattery() < 20 {
|
||||
cmdpath = "feh --bg-center sysgo/gameshell/wallpaper/gameover.png;"
|
||||
}else {
|
||||
cmdpath = "feh --bg-center sysgo/gameshell/wallpaper/seeyou.png;"
|
||||
}
|
||||
|
||||
cmdpath = cmdpath + "sleep 3;"
|
||||
|
||||
cmdpath = cmdpath + "sudo halt -p"
|
||||
|
||||
event.Post(UI.RUNSYS,cmdpath)
|
||||
|
||||
}
|
||||
|
||||
if ev.Data["Key"] == UI.CurKeys["X"] {
|
||||
cmdpath := "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
||||
cmdpath += "sleep 3;"
|
||||
cmdpath += "sudo reboot"
|
||||
|
||||
event.Post(UI.RUNSYS,cmdpath)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user