Skip to content

Commit

Permalink
work on remote, add PALETE_DATA_PATH env var in install
Browse files Browse the repository at this point in the history
  • Loading branch information
nosuchtim committed Dec 30, 2023
1 parent 0762181 commit 1d7ab97
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 38 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.91
7.92
12 changes: 6 additions & 6 deletions build/windows/palette_win_setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define MyAppVersion "SUBSTITUTE_VERSION_HERE"
#define MyAppPublisher "Nosuch Media"
#define MyAppURL "https://github.com/vizicist/palette"
#define DataPath "{commoncf64}/Palette/data"

[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
Expand Down Expand Up @@ -51,10 +52,8 @@ Source: "ship\ffgl\*"; DestDir: "{app}\ffgl"; Flags: ignoreversion recursesubdir
; Source: "ship\keykit\*"; DestDir: "{app}\keykit"; Flags: ignoreversion recursesubdirs createallsubdirs

; NOTE - all data_* files go in CommonProgramFiles\Palette
Source: "ship\data\*"; DestDir: "{commoncf64}\{#MyAppName}\data"; Flags: comparetimestamp ignoreversion recursesubdirs createallsubdirs
; Source: "ship\data_surge\*"; DestDir: "{commoncf64}\{#MyAppName}\data_surge"; Flags: comparetimestamp ignoreversion recursesubdirs createallsubdirs
; Source: "ship\data_moldover\*"; DestDir: "{commoncf64}\{#MyAppName}\data_moldover"; Flags: comparetimestamp ignoreversion recursesubdirs createallsubdirs
Source: "logs_readme.txt"; DestDir: "{commoncf64}\{#MyAppName}\data\logs"; DestName: "readme.txt"; Flags: ignoreversion
Source: "ship\data\*"; DestDir: "{#DataPath}"; Flags: comparetimestamp ignoreversion recursesubdirs createallsubdirs
Source: "logs_readme.txt"; DestDir: "{#DataPath}\logs"; DestName: "readme.txt"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

; This specifies the Visual C++ Windows Runtime Redistributable to install, it's put in {app}\bin to help debug things.
Expand All @@ -71,11 +70,12 @@ Filename: taskkill.exe; Parameters: "/F /IM palette_gui.exe"; StatusMsg: "Making
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\Start Palette"; Filename: "{app}\bin\palette.exe"; Parameters: "start"; Flags: runminimized
Name: "{group}\Stop Palette"; Filename: "{app}\bin\palette.exe"; Parameters: "stop"; Flags: runminimized
Name: "{group}\Config Directory"; Filename: "{win}\explorer.exe"; Parameters: "{commoncf64}\{#MyAppName}"

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
ValueType: expandsz; ValueName: "PALETTE"; ValueData: "{app}"
ValueType: expandsz; ValueName: "PALETTE"; ValueData: "{app}"; Flags: preservestringtype
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
ValueType: expandsz; ValueName: "PALETTE_DATA_PATH"; ValueData: "{commoncf64}\Palette\data"; Flags: preservestringtype

[Code]
procedure CurStepChanged(CurStep: TSetupStep);
Expand Down
82 changes: 71 additions & 11 deletions cmd/palette_remote/palette_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,87 @@ import (
"fyne.io/fyne/v2" // Import the base Fyne package
"fyne.io/fyne/v2/app" // Import the Fyne app package
"fyne.io/fyne/v2/container" // Import the Fyne container package for layouts
"fyne.io/fyne/v2/widget" // Import the Fyne widget package for widgets
"fyne.io/fyne/v2/widget" // Import the Fyne widget package for widgets

"github.com/vizicist/palette/kit"
)

var Categories = []string{"global", "quad", "patch", "sound", "visual", "effect"}
var TopButton = map[string]*widget.Button{}
var TopLabel *widget.Label
var SelectGrid *fyne.Container

func SelectSaved(category string, saved string) {
kit.LogInfo("GRID button", "category", category, "saved", saved)
TopLabel.SetText("category=" + category + " file=" + saved)
}

func SelectCategory(category string) {
TopLabel.SetText("category = " + category)
list, err := kit.SavedFileList(category)
if err != nil {
kit.LogError(err)
} else {
SelectGrid.RemoveAll()
for _, savedName := range list {
s := savedName
c := category
SelectGrid.Add(widget.NewButton(s, func() {
SelectSaved(c, s)
}))
}
}
}

func main() {
myApp := app.New() // Create a new app
myWindow := myApp.NewWindow("Hello") // Create a new window

myWindow.Resize(fyne.NewSize(300, 200)) // Resize the window
kit.InitLog("remote")
kit.LogInfo("Creating app")
kit.InitMisc()

type FileList []string
saved := map[string]FileList{}

for _, s := range Categories {
list, err := kit.SavedFileList(s)
if err != nil {
kit.LogError(err)
} else {
saved[s] = list
}
}

myApp := app.New() // Create a new app
myWindow := myApp.NewWindow("Palette Remote") // Create a new window

appSize := fyne.Size{Width: 300, Height: 600}
gridsize := fyne.Size{
Width: 200,
Height: 40,
}

myWindow.Resize(fyne.NewSize(appSize.Width, appSize.Height)) // Resize the window

// Create a label (widget) with initial text
label := widget.NewLabel("Hello, Fyne!")
TopLabel = widget.NewLabel("Palette Remote 2024")

SelectGrid = container.NewGridWrap(gridsize)

// Create a button (widget)
button := widget.NewButton("Click me!", func() {
label.SetText("Button clicked!") // Change the label text when the button is clicked
})
// Create the buttons along the top
container_topbuttons := container.NewHBox()
for _, category := range Categories {
c := category
TopButton[c] = widget.NewButton(c, func() {
SelectCategory(c)
})
container_topbuttons.Add(TopButton[c])
}

// Use a container to arrange the label and button vertically
content := container.NewVBox(
label,
button,
container.NewCenter(TopLabel),
container_topbuttons,
SelectGrid,
)

myWindow.SetContent(content) // Set the window content to be the container
Expand Down
20 changes: 0 additions & 20 deletions kit/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"math/rand"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -39,25 +38,6 @@ type Engine struct {

var TheEngine *Engine
var engineSysex sync.Mutex
var TheRand *rand.Rand

func InitMisc() {

InitParams()

// We first load the current values, but don't actually execute anything that they trigger
err := LoadGlobalParams()
if err != nil {
LogIfError(err)
}

TheProcessManager = NewProcessManager()
TheProcessManager.AddBuiltins()

// Fixed rand sequence, better for testing
TheRand = rand.New(rand.NewSource(1))
TheNats = NewNats()
}

func InitEngine() {

Expand Down
21 changes: 21 additions & 0 deletions kit/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"image"
"image/draw"
"io"
"math/rand"
"net/http"
"os"
"path/filepath"
Expand All @@ -27,6 +28,26 @@ var OscPort = 3333
var EventClientPort = 6666
var GuiPort = 3943
var LocalAddress = "127.0.0.1"
var TheRand *rand.Rand

func InitMisc() {

InitParams()

// We first load the current values, but don't actually execute anything that they trigger
err := LoadGlobalParams()
if err != nil {
LogIfError(err)
}

TheProcessManager = NewProcessManager()
TheProcessManager.AddBuiltins()

// Fixed rand sequence, better for testing
TheRand = rand.New(rand.NewSource(1))
TheNats = NewNats()
}


// fileExists checks if a file exists
func fileExists(filename string) bool {
Expand Down
Binary file added release/palette_7.92_win_setup.exe
Binary file not shown.

0 comments on commit 1d7ab97

Please sign in to comment.