mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2025-12-12 07:58:51 +01:00
Revert "fix"
This reverts commit ed2454ea646d4cbcfacc763590aeb40b328a4e09.
This commit is contained in:
parent
4eefd21a8b
commit
6a360f5101
@ -414,7 +414,8 @@ func (self *AboutPlugin) Init(main_screen *UI.MainScreen) {
|
||||
func (self *AboutPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushPage(self.Page)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ func (self *AirplanePlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.AirplanePage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -121,7 +121,8 @@ func (self *BluetoothPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.BluetoothPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,8 @@ func (self *BrightnessPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.BrightnessPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ func (self *ButtonsLayoutPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.ButtonsLayoutPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ func (self *GatewayPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.Page1st)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ func (self *LanguagesPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.LanguagesPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ func (self *LimaPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.GPUDriverPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ func (self *PowerOFFPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.PowerOFFPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ func (self *PowerOptionsPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.PowerOptionsPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -307,7 +307,8 @@ func (self *SettingsPlugin) Init(main_screen *UI.MainScreen) {
|
||||
func (self *SettingsPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushPage(self.Page)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,8 @@ func (self *SoundPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.SoundPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,8 @@ func (self *StoragePlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.StoragePage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ func (self *TimeZonePlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.TimeZonePage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,8 @@ func (self *UpdatePlugin) Init(main_screen *UI.MainScreen) {
|
||||
func (self *UpdatePlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushPage(self.Page)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,8 +49,10 @@ func (self *WifiPlugin) Init(main_screen *UI.MainScreen) {
|
||||
|
||||
func (self *WifiPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushPage(self.ScanPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.ScanPage)
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -372,6 +372,7 @@ type WifiList struct {
|
||||
Connecting bool
|
||||
Scanning bool
|
||||
|
||||
ShowingMessageBox bool
|
||||
MsgBox *WifiListMessageBox
|
||||
ConnectTry int
|
||||
|
||||
@ -401,7 +402,14 @@ func NewWifiList() *WifiList {
|
||||
|
||||
func (self *WifiList) ShowBox(msg string) {
|
||||
self.MsgBox.Text = msg
|
||||
self.Screen.ShowMsg(msg,1)
|
||||
self.ShowingMessageBox = true
|
||||
self.Screen.ShowMsg(msg,0)
|
||||
}
|
||||
|
||||
func (self *WifiList) HideBox() {
|
||||
self.Draw()
|
||||
self.ShowingMessageBox = false
|
||||
self.Screen.SwapAndShow()
|
||||
}
|
||||
|
||||
func (self *WifiList) GenNetworkList() {
|
||||
@ -444,7 +452,7 @@ func (self *WifiList) GenNetworkList() {
|
||||
li_idx++
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
self.WifiScanFinished()
|
||||
|
||||
self.PsIndex = 0
|
||||
@ -487,7 +495,9 @@ func (self *WifiList) WifiScanFinished() {
|
||||
self.ResetPageSelector()
|
||||
|
||||
self.Scanning = false
|
||||
self.HideBox()
|
||||
|
||||
self.BlockingUI = false
|
||||
fmt.Println("dbus says scan finished")
|
||||
|
||||
}
|
||||
@ -498,7 +508,8 @@ func (self *WifiList) WifiScanStarted() {
|
||||
}
|
||||
|
||||
self.Scanning = true
|
||||
self.ShowBox("Wifi scanning")
|
||||
self.ShowBox("Wifi scanning...")
|
||||
self.BlockingUI = true
|
||||
fmt.Println("dbus says start scan")
|
||||
}
|
||||
|
||||
@ -591,7 +602,7 @@ func (self *WifiList) ConfigWireless(password string) {
|
||||
ssid := self.MyList[self.PsIndex].Essid
|
||||
fmt.Println(ssid)
|
||||
fmt.Println(password)
|
||||
self.ShowBox("Connecting")
|
||||
self.ShowBox("Connecting...")
|
||||
|
||||
self.Connecting = true
|
||||
cli := fmt.Sprintf("sudo nmcli dev wifi connect %s password \"%s\"", ssid, password)
|
||||
@ -663,6 +674,7 @@ func (self *WifiList) ScrollDown() {
|
||||
}
|
||||
|
||||
func (self *WifiList) AbortedAndReturnToUpLevel() {
|
||||
self.HideBox()
|
||||
self.Screen.FootBar.ResetNavText()
|
||||
self.ReturnToUpLevelPage()
|
||||
|
||||
@ -727,7 +739,6 @@ func (self *WifiList) KeyDown(ev *event.Event) {
|
||||
|
||||
if ev.Data["Key"] == UI.CurKeys["X"] {
|
||||
self.Rescan(false)
|
||||
self.Screen.Refresh()
|
||||
}
|
||||
|
||||
if ev.Data["Key"] == UI.CurKeys["Y"] {
|
||||
|
||||
@ -32,7 +32,8 @@ func (self *WareHousePlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.MainPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,8 @@ func (self *MusicPlayerPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.MusicPlayerPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ func (self *TinyCloudPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.MainPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ func (self *PowerOFFPlugin) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.PowerOFFPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
10
main.go
10
main.go
@ -122,7 +122,8 @@ func RestoreLastBackLightBrightness(main_screen *UI.MainScreen) bool {
|
||||
|
||||
if main_screen.CounterScreen.Counting == true {
|
||||
main_screen.CounterScreen.StopCounter()
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
return false
|
||||
}
|
||||
|
||||
@ -220,7 +221,7 @@ func AutoRedraw(main_screen *UI.MainScreen) {
|
||||
|
||||
for {
|
||||
if main_screen.TitleBar.InLowBackLight < 0 {
|
||||
UI.DisplayFlip()
|
||||
UI.SwapAndShow()
|
||||
}
|
||||
gotime.Sleep(650 * gotime.Millisecond)
|
||||
}
|
||||
@ -323,7 +324,10 @@ func run() int {
|
||||
sound_patch.Parent = main_screen
|
||||
sound_patch.Init()
|
||||
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
|
||||
UI.SwapAndShow()
|
||||
|
||||
//fmt.Println(main_screen)
|
||||
event.AllocEvents(5)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB |
@ -71,6 +71,7 @@ func (self *MyEmulator) Run(main_screen *UI.MainScreen) {
|
||||
if main_screen != nil {
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(self.RomPage)
|
||||
main_screen.Refresh()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,24 +68,24 @@ func Init() {
|
||||
|
||||
for i := 10; i < 41; i++ {
|
||||
keyname := fmt.Sprintf("varela%d", i)
|
||||
Fonts[keyname] = font.FontRW(fonts_path["varela"], i)
|
||||
Fonts[keyname] = font.Font(fonts_path["varela"], i)
|
||||
}
|
||||
|
||||
Fonts["varela120"] = font.FontRW(fonts_path["varela"], 120)
|
||||
Fonts["varela120"] = font.Font(fonts_path["varela"], 120)
|
||||
|
||||
for i := 10; i < 26; i++ {
|
||||
keyname := fmt.Sprintf("veramono%d", i)
|
||||
Fonts[keyname] = font.FontRW(fonts_path["veramono"], i)
|
||||
Fonts[keyname] = font.Font(fonts_path["veramono"], i)
|
||||
}
|
||||
|
||||
for i := 10; i < 28; i++ {
|
||||
keyname := fmt.Sprintf("notosansmono%d", i)
|
||||
Fonts[keyname] = font.FontRW(fonts_path["noto"], i)
|
||||
Fonts[keyname] = font.Font(fonts_path["noto"], i)
|
||||
}
|
||||
|
||||
for i := 10; i < 28; i++ {
|
||||
keyname := fmt.Sprintf("notosanscjk%d", i)
|
||||
Fonts[keyname] = font.FontRW(fonts_path["notocjk"], i)
|
||||
Fonts[keyname] = font.Font(fonts_path["notocjk"], i)
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@ -26,7 +26,7 @@ func (self *FullScreen) SwapAndShow() {
|
||||
if self.HWND != nil {
|
||||
rect_ := rect.Rect(self.PosX, self.PosY, self.Width, self.Height)
|
||||
surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil)
|
||||
DisplayFlip()
|
||||
SwapAndShow()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -281,6 +281,7 @@ func (self *MainScreen) SwapAndShow() {
|
||||
surface.Blit(self.HWND, self.CanvasHWND, &rect_, nil)
|
||||
}
|
||||
|
||||
|
||||
display.Flip()
|
||||
}
|
||||
|
||||
@ -427,7 +428,8 @@ func (self *MainScreen) ShowMsg(content string, blocktime int) {
|
||||
|
||||
if blocktime > 0 {
|
||||
time.BlockDelay(blocktime)
|
||||
self.Refresh()
|
||||
self.CurrentPage.Draw()
|
||||
self.SwapAndShow()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -110,8 +110,6 @@ type TitleBar struct {
|
||||
|
||||
TitleFont *ttf.Font
|
||||
TimeFont *ttf.Font
|
||||
|
||||
updateScreen chan bool
|
||||
}
|
||||
|
||||
func NewTitleBar() *TitleBar {
|
||||
@ -138,16 +136,13 @@ func NewTitleBar() *TitleBar {
|
||||
t.TimeFont = Fonts["varela12"]
|
||||
|
||||
t.InLowBackLight = -1
|
||||
|
||||
t.updateScreen = make(chan bool,1)
|
||||
|
||||
return t
|
||||
|
||||
}
|
||||
|
||||
func (self *TitleBar) Redraw() {
|
||||
self.UpdateDownloadStatus()
|
||||
DisplayFlip()
|
||||
SwapAndShow()
|
||||
}
|
||||
|
||||
func (self *TitleBar) UpdateDownloadStatus() {
|
||||
@ -181,7 +176,7 @@ func (self *TitleBar) RoundRobinCheck() {
|
||||
self.CheckBluetooth()
|
||||
self.UpdateWifiStrength()
|
||||
self.UpdateDownloadStatus()
|
||||
self.Refresh()
|
||||
SwapAndShow()
|
||||
|
||||
} else if self.InLowBackLight >= 0 {
|
||||
self.InLowBackLight += 1
|
||||
@ -192,7 +187,6 @@ func (self *TitleBar) RoundRobinCheck() {
|
||||
self.UpdateWifiStrength()
|
||||
self.UpdateDownloadStatus()
|
||||
self.InLowBackLight = 0 // reset
|
||||
self.Refresh()
|
||||
}
|
||||
|
||||
}
|
||||
@ -299,6 +293,8 @@ func (self *TitleBar) SetSoundVolume(vol int) {
|
||||
func (self *TitleBar) CheckBatteryStat() {
|
||||
bat_segs := [][]int{[]int{0, 6}, []int{7, 15}, []int{16, 20}, []int{21, 30}, []int{31, 50}, []int{51, 60}, []int{61, 80}, []int{81, 90}, []int{91, 100}}
|
||||
|
||||
self.Icons["battery"] = self.Icons["battery_unknown"]
|
||||
|
||||
if FileExists(sysgo.Battery) == false {
|
||||
return
|
||||
}
|
||||
@ -341,11 +337,14 @@ func (self *TitleBar) CheckBatteryStat() {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if val, ok := bat_uevent["POWER_SUPPLY_STATUS"]; ok {
|
||||
if val == "Charging" {
|
||||
self.Icons["battery"].SetIconIndex(1+cap_ge)
|
||||
self.Icons["battery_charging"].SetIconIndex(cap_ge)
|
||||
self.Icons["battery"] = self.Icons["battery_charging"]
|
||||
} else {
|
||||
self.Icons["battery"].SetIconIndex(1+9+cap_ge)
|
||||
self.Icons["battery_discharging"].SetIconIndex(cap_ge)
|
||||
self.Icons["battery"] = self.Icons["battery_discharging"]
|
||||
}
|
||||
}
|
||||
|
||||
@ -393,13 +392,29 @@ func (self *TitleBar) Init(main_screen *MainScreen) {
|
||||
|
||||
self.Icons["wifistatus"] = icon_wifi_status
|
||||
|
||||
battery_charging := NewTitleBarIconItem()
|
||||
battery_charging.MyType = ICON_TYPES["STAT"]
|
||||
battery_charging.Parent = self
|
||||
battery_charging.ImageName = self.icon_base_path + "withcharging.png"
|
||||
battery_charging.Adjust(start_x+self.IconWidth+self.IconWidth+8, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2, self.IconWidth, self.IconHeight, 0)
|
||||
|
||||
self.Icons["battery_charging"] = battery_charging
|
||||
|
||||
battery_discharging := NewTitleBarIconItem()
|
||||
battery_discharging.MyType = ICON_TYPES["STAT"]
|
||||
battery_discharging.Parent = self
|
||||
battery_discharging.ImageName = self.icon_base_path + "without_charging.png"
|
||||
battery_discharging.Adjust(start_x+self.IconWidth+self.IconWidth+8, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2, self.IconWidth, self.IconHeight, 0)
|
||||
|
||||
self.Icons["battery_discharging"] = battery_discharging
|
||||
|
||||
battery_unknown := NewTitleBarIconItem()
|
||||
battery_unknown.MyType = ICON_TYPES["STAT"]
|
||||
battery_unknown.Parent = self
|
||||
battery_unknown.ImageName = self.icon_base_path + "battery.png"
|
||||
battery_unknown.ImageName = self.icon_base_path + "battery_unknown.png"
|
||||
battery_unknown.Adjust(start_x+self.IconWidth+self.IconWidth+8, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2, self.IconWidth, self.IconHeight, 0)
|
||||
|
||||
self.Icons["battery"] = battery_unknown
|
||||
self.Icons["battery_unknown"] = battery_unknown
|
||||
|
||||
self.CheckBatteryStat()
|
||||
|
||||
@ -478,12 +493,6 @@ func (self *TitleBar) ClearCanvas() {
|
||||
self.Icons["round_corners"].SetIconIndex(1)
|
||||
self.Icons["round_corners"].Draw()
|
||||
|
||||
go func() {
|
||||
sdl.Do(func() {
|
||||
self.RefreshLoop()
|
||||
})
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
func (self *TitleBar) UpdateTimeLocation() {
|
||||
@ -567,22 +576,3 @@ func (self *TitleBar) Draw(title string) {
|
||||
title_text_surf.Free()
|
||||
time_text_surf.Free()
|
||||
}
|
||||
|
||||
func (self *TitleBar) Refresh() {
|
||||
self.updateScreen <- true
|
||||
}
|
||||
|
||||
func (self *TitleBar) RefreshLoop() {
|
||||
L:
|
||||
for {
|
||||
select {
|
||||
case v:= <- self.updateScreen:
|
||||
if v == true {
|
||||
DisplayFlip()
|
||||
}
|
||||
if v== false {
|
||||
break L
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,15 +128,10 @@ func ReplaceSuffix(orig_file_str string, new_ext string) string {
|
||||
return orig_file_str // failed just return back where it came
|
||||
}
|
||||
|
||||
func DisplayFlip() {
|
||||
func SwapAndShow() {
|
||||
display.Flip()
|
||||
}
|
||||
|
||||
func AsyncDisplayFlip() {
|
||||
display.ASync(func() {
|
||||
display.Flip()
|
||||
})
|
||||
}
|
||||
func ReadLines(path string) (lines []string, err error) {
|
||||
var (
|
||||
file *os.File
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user