This commit is contained in:
2023-07-28 15:42:37 -05:00
parent 08c2a4de57
commit 6dcdd7875f
4 changed files with 9 additions and 24 deletions

4
.gitignore vendored
View File

@@ -1,4 +1,6 @@
.vscode/ .vscode/
bin/ bin/
examples/ examples/
cpms.exe
cpms.exe
config.yaml

View File

@@ -1,2 +1,2 @@
profiles_root: "" profiles_root: E:/GoWork/cpms/examples/profiles
archive_root: "" archive_root: E:/GoWork/cpms/examples/archive

BIN
cpms.exe

Binary file not shown.

25
main.go
View File

@@ -11,7 +11,6 @@ import (
"fyne.io/fyne/v2/app" "fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container" "fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog" "fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/storage"
"fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget" "fyne.io/fyne/v2/widget"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
@@ -84,7 +83,7 @@ func main() {
container := container.NewVBox( container := container.NewVBox(
widget.NewForm(widget.NewFormItem("Profiles Directory", profilesrootentry)), widget.NewForm(widget.NewFormItem("Profiles Directory", profilesrootentry)),
widget.NewButtonWithIcon("Select", theme.FolderIcon(), func() { widget.NewButtonWithIcon("Select", theme.FolderIcon(), func() {
d := dialog.NewFolderOpen(func(lu fyne.ListableURI, err error) { dialog.NewFolderOpen(func(lu fyne.ListableURI, err error) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
@@ -95,19 +94,11 @@ func main() {
cfg.ProfilesRoot = lu.Path() cfg.ProfilesRoot = lu.Path()
saveConfig(*cfg) saveConfig(*cfg)
fillGrid(grid, wp) fillGrid(grid, wp)
}, wp) }, wp).Show()
l, err := storage.ListerForURI(storage.NewFileURI("."))
if err != nil {
fmt.Println(err)
}
if l != nil {
d.SetLocation(l)
}
d.Show()
}), }),
widget.NewForm(widget.NewFormItem("Archive Directory", archiverootentry)), widget.NewForm(widget.NewFormItem("Archive Directory", archiverootentry)),
widget.NewButtonWithIcon("Select", theme.FolderIcon(), func() { widget.NewButtonWithIcon("Select", theme.FolderIcon(), func() {
d := dialog.NewFolderOpen(func(lu fyne.ListableURI, err error) { dialog.NewFolderOpen(func(lu fyne.ListableURI, err error) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
@@ -118,15 +109,7 @@ func main() {
cfg.ArchiveRoot = lu.Path() cfg.ArchiveRoot = lu.Path()
saveConfig(*cfg) saveConfig(*cfg)
fillGrid(grid, wp) fillGrid(grid, wp)
}, wp) }, wp).Show()
l, err := storage.ListerForURI(storage.NewFileURI("."))
if err != nil {
fmt.Println(err)
}
if l != nil {
d.SetLocation(l)
}
d.Show()
}), }),
widget.NewSeparator(), widget.NewSeparator(),
widget.NewButton("Reload Profiles", func() { widget.NewButton("Reload Profiles", func() {