Split up GUI code some and modularize it

This commit is contained in:
KemoNine 2020-09-02 20:40:28 -04:00
parent a506546f1e
commit 1841b19211
5 changed files with 443 additions and 430 deletions

View File

@ -1,3 +1,3 @@
# ui
# gui
This is the main source code for the custom UI used by PiFrame. This is responsible for things like restart, WiFi config, ensuring the slide show is running and more.

10
cmd/gui/gui.go Normal file
View File

@ -0,0 +1,10 @@
package main
import (
"git.kemonine.info/PiFrame/ui"
)
func main() {
ui.Slideshow()
ui.ConfigGui()
}

3
ui/README.md Normal file
View File

@ -0,0 +1,3 @@
# ui
This is the main implementation for various aspects of the main PiFrame [G]UI

View File

@ -1,4 +1,4 @@
package main
package ui
import (
"fmt"
@ -35,7 +35,7 @@ const (
PAGE_POWEROFF = "PAGE_POWEROFF"
)
func main() {
func ConfigGui() {
// Memory info for status panel
meminfo := &procmeminfo.MemInfo{}
err := meminfo.Update()

View File

@ -100,13 +100,13 @@ func Slideshow() {
}(keyboardCtx)
// Run fim
// if err := fim.Run(); err != nil {
// // Unwrap the error a bit so we can find out if a signal killed fim or something else
// // An exit code of -1 means the program didn't exit in time or was terminated by a signal (per the docs)
// if exitError, ok := err.(*exec.ExitError); ok && exitError.ExitCode() != -1 {
// log.Fatalf("Error running fim : %s", err)
// }
// }
if err := fim.Run(); err != nil {
// Unwrap the error a bit so we can find out if a signal killed fim or something else
// An exit code of -1 means the program didn't exit in time or was terminated by a signal (per the docs)
if exitError, ok := err.(*exec.ExitError); ok && exitError.ExitCode() != -1 {
log.Fatalf("Error running fim : %s", err)
}
}
// Stop fim slideshow advancing go routine
close(stop_ticker)