v0.7.7 - Icone PNG embarquee dans l'en-tete GUI
Changements : - Icone icon.png embarquee dans l'exe via go:embed - Affichage de l'icone a gauche du titre dans l'interface - Mise a jour CLAUDE.md pour refleter la migration Go Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
22
gui.go
22
gui.go
@@ -1,7 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"image/png"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -14,6 +17,9 @@ import (
|
||||
. "github.com/lxn/walk/declarative"
|
||||
)
|
||||
|
||||
//go:embed icon.png
|
||||
var iconPNG []byte
|
||||
|
||||
// ── Modèle TableView ──────────────────────────────────────────────────────────
|
||||
|
||||
type RepoItem struct {
|
||||
@@ -206,6 +212,7 @@ func (m *RepoModel) hasUpdates() bool {
|
||||
|
||||
type App struct {
|
||||
mw *walk.MainWindow
|
||||
iconView *walk.ImageView
|
||||
statusLabel *walk.Label
|
||||
tv *walk.TableView
|
||||
model *RepoModel
|
||||
@@ -242,6 +249,12 @@ func (a *App) buildAndRun() error {
|
||||
Composite{
|
||||
Layout: HBox{MarginsZero: true},
|
||||
Children: []Widget{
|
||||
ImageView{
|
||||
AssignTo: &a.iconView,
|
||||
MinSize: Size{Width: 24, Height: 24},
|
||||
MaxSize: Size{Width: 24, Height: 24},
|
||||
Mode: ImageViewModeIdeal,
|
||||
},
|
||||
Label{
|
||||
Text: "Git Update Checker v" + VERSION,
|
||||
Font: Font{Bold: true, PointSize: 12},
|
||||
@@ -322,13 +335,20 @@ func (a *App) buildAndRun() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Icône fenêtre
|
||||
// Icône fenêtre (depuis fichier .ico externe)
|
||||
if icoPath := filepath.Join(exeDir(), "icon.ico"); fileExists(icoPath) {
|
||||
if icon, err := walk.NewIconFromFile(icoPath); err == nil {
|
||||
a.mw.SetIcon(icon)
|
||||
}
|
||||
}
|
||||
|
||||
// Icône dans l'en-tête (depuis PNG embarqué dans l'exe)
|
||||
if img, err := png.Decode(bytes.NewReader(iconPNG)); err == nil {
|
||||
if bmp, err := walk.NewBitmapFromImageForDPI(img, 96); err == nil {
|
||||
a.iconView.SetImage(bmp)
|
||||
}
|
||||
}
|
||||
|
||||
// Lancer la vérification au démarrage
|
||||
go func() {
|
||||
time.Sleep(150 * time.Millisecond)
|
||||
|
||||
Reference in New Issue
Block a user