Skip to content

Commit

Permalink
FIX: add icon and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Haeberle-STAMA committed Feb 16, 2025
1 parent b889041 commit 2ddae57
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 2 deletions.
Binary file added tools/nice123d_run/app.ico
Binary file not shown.
Binary file added tools/nice123d_run/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions tools/nice123d_run/create_icon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from PIL import Image

# Open the original image
icon = Image.open('app.png')

# Define the sizes for the new icons
sizes = [(16, 16), (32, 32), (48, 48), (256, 256)]

# Create and save the .ico file with multiple sizes
icon.save('app.ico', format='ICO', sizes=sizes)

print("app.ico created successfully.")
7 changes: 7 additions & 0 deletions tools/nice123d_run/generate_resource.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
python create_icon.py

go install github.com/akavel/rsrc@latest'
rsrc -arch 386 -ico app.ico
rsrc -arch amd64 -ico app.ico

go build -o nice123d_run.exe
2 changes: 2 additions & 0 deletions tools/nice123d_run/icon.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// icon.rc
1 ICON "app.ico"
2 changes: 2 additions & 0 deletions tools/nice123d_run/icon_for_build.url.url
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://hjr265.me/blog/adding-icons-for-go-built-windows-executable/
10 changes: 8 additions & 2 deletions tools/nice123d_run/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ package main

import (
"log"
"os"
"os/exec"
)

func main() {
cmd := exec.Command("./python/python.exe", "-m", "cadviewer")
output, err := cmd.CombinedOutput()

// Redirect the command's standard output and standard error to the Go program's standard output and standard error
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

// Run the command
err := cmd.Run()
if err != nil {
log.Fatalf("Command execution failed: %v", err)
}
log.Printf("Command output: %s", output)
}
Binary file modified tools/nice123d_run/nice123d_run.exe
Binary file not shown.
Binary file added tools/nice123d_run/rsrc_windows_386.syso
Binary file not shown.
Binary file added tools/nice123d_run/rsrc_windows_amd64.syso
Binary file not shown.

0 comments on commit 2ddae57

Please sign in to comment.