feat: initial project commit
commit to push first working snapshot to codeberg
This commit is contained in:
commit
09b1054588
25 changed files with 1405 additions and 0 deletions
47
internal/gui/gui.go
Normal file
47
internal/gui/gui.go
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
package gui
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"jws/internal/dependency"
|
||||
"jws/internal/project"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/data/binding"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
var (
|
||||
// Global variables available to the package
|
||||
mainWindow fyne.Window
|
||||
dependencies []dependency.Dependency
|
||||
projects []project.Project
|
||||
projectsFS embed.FS
|
||||
)
|
||||
|
||||
// Init initializes the GUI package with required dependencies
|
||||
func Init(window fyne.Window, deps []dependency.Dependency, projs []project.Project, fs embed.FS) {
|
||||
mainWindow = window
|
||||
dependencies = deps
|
||||
projects = projs
|
||||
projectsFS = fs
|
||||
}
|
||||
|
||||
// ShowPasswordDialog shows a dialog to enter sudo password for installations
|
||||
func ShowPasswordDialog(index int) {
|
||||
password := binding.NewString()
|
||||
entry := widget.NewEntryWithData(password)
|
||||
entry.Password = true
|
||||
|
||||
dialog.NewForm("Sudo Password", "ok", "cancel",
|
||||
[]*widget.FormItem{widget.NewFormItem("password", entry)},
|
||||
func(b bool) {
|
||||
pass, err := password.Get()
|
||||
if err == nil {
|
||||
if b {
|
||||
dependency.InstallDependency(index, pass, dependencies, mainWindow)
|
||||
}
|
||||
}
|
||||
},
|
||||
mainWindow).Show()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue