mirror of
https://github.com/Apologieze/Benri.git
synced 2026-01-18 17:17:21 +01:00
add package theme img
This commit is contained in:
BIN
asset/icon.jpg
Normal file
BIN
asset/icon.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 188 KiB |
BIN
asset/img.png
BIN
asset/img.png
Binary file not shown.
|
Before Width: | Height: | Size: 601 KiB |
BIN
asset/meme.jpg
BIN
asset/meme.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 226 KiB |
8
main.go
8
main.go
@@ -29,12 +29,13 @@ var animeSelected *verniy.MediaList
|
||||
var episodeNumber = widget.NewLabelWithStyle("", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
|
||||
|
||||
func main() {
|
||||
dowloadMPV()
|
||||
startCurdInteg()
|
||||
fmt.Println(localAnime)
|
||||
a := app.New()
|
||||
//a.Settings().SetTheme(&myTheme{})
|
||||
a.Settings().SetTheme(&forcedVariant{Theme: theme.DefaultTheme(), variant: theme.VariantDark})
|
||||
|
||||
window = a.NewWindow("AnimeGui")
|
||||
window = a.NewWindow("AnimeGUI")
|
||||
window.Resize(fyne.NewSize(1000, 700))
|
||||
|
||||
debounced := debounce.New(400 * time.Millisecond)
|
||||
@@ -78,6 +79,9 @@ func main() {
|
||||
)
|
||||
|
||||
var grayScaleList uint8 = 35
|
||||
/*if themeVariant == theme.VariantDark {
|
||||
grayScaleList = 220
|
||||
}*/
|
||||
listContainer := container.NewStack(canvas.NewRectangle(color.RGBA{R: grayScaleList, G: grayScaleList, B: grayScaleList, A: 255}), listDisplay)
|
||||
|
||||
leftSide := container.NewBorder(vbox, nil, nil, nil, listContainer)
|
||||
|
||||
61
mpvInstall.go
Normal file
61
mpvInstall.go
Normal file
@@ -0,0 +1,61 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/charmbracelet/log"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func dowloadMPV() {
|
||||
log.Info(runtime.GOOS)
|
||||
if runtime.GOOS != "windows" {
|
||||
return
|
||||
}
|
||||
exePath, err := os.Executable()
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
exeDir := filepath.Dir(exePath)
|
||||
mpvPath := filepath.Join(exeDir, "bin", "mpv.exe")
|
||||
log.Info(mpvPath)
|
||||
if _, err := os.Stat(mpvPath); os.IsNotExist(err) {
|
||||
log.Info("mpv.exe does not exist")
|
||||
} else if err != nil {
|
||||
log.Error(err)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
log.Info("Downloading mpv")
|
||||
resp, err := http.Get("http://apologize.fr/mpv.exe")
|
||||
if err != nil {
|
||||
log.Error("Error downloading mpv.exe:", err)
|
||||
return
|
||||
}
|
||||
defer func(Body io.ReadCloser) {
|
||||
_ = Body.Close()
|
||||
}(resp.Body)
|
||||
|
||||
mpvDir := filepath.Join(exeDir, "bin")
|
||||
if err := os.MkdirAll(mpvDir, os.ModePerm); err != nil {
|
||||
log.Error("Error creating directories:", err)
|
||||
return
|
||||
}
|
||||
|
||||
out, err := os.Create(mpvPath)
|
||||
if err != nil {
|
||||
log.Error("Error creating mpv.exe file:", err)
|
||||
return
|
||||
}
|
||||
defer out.Close()
|
||||
|
||||
_, err = io.Copy(out, resp.Body)
|
||||
if err != nil {
|
||||
log.Error("Error saving mpv.exe:", err)
|
||||
return
|
||||
}
|
||||
log.Info("mpv.exe downloaded successfully")
|
||||
}
|
||||
28
theme.go
28
theme.go
@@ -2,33 +2,15 @@ package main
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"image/color"
|
||||
)
|
||||
|
||||
type myTheme struct{}
|
||||
type forcedVariant struct {
|
||||
fyne.Theme
|
||||
|
||||
var _ fyne.Theme = (*myTheme)(nil)
|
||||
|
||||
func (m myTheme) Font(style fyne.TextStyle) fyne.Resource {
|
||||
return theme.DefaultTheme().Font(style)
|
||||
variant fyne.ThemeVariant
|
||||
}
|
||||
|
||||
func (m myTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
|
||||
return theme.DefaultTheme().Icon(name)
|
||||
}
|
||||
|
||||
func (m myTheme) Size(name fyne.ThemeSizeName) float32 {
|
||||
return theme.DefaultTheme().Size(name)
|
||||
}
|
||||
|
||||
func (m myTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
|
||||
if name == theme.ColorNameBackground {
|
||||
if variant == theme.VariantLight {
|
||||
return color.White
|
||||
}
|
||||
return theme.DefaultTheme().Color(name, variant)
|
||||
}
|
||||
|
||||
return theme.DefaultTheme().Color(name, variant)
|
||||
func (f *forcedVariant) Color(name fyne.ThemeColorName, _ fyne.ThemeVariant) color.Color {
|
||||
return f.Theme.Color(name, f.variant)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user