-
Notifications
You must be signed in to change notification settings - Fork 0
/
fdl.go
63 lines (49 loc) · 1.22 KB
/
fdl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"fyne.io/fyne"
"fyne.io/fyne/app"
"fyne.io/fyne/layout"
"fyne.io/fyne/widget"
"github.com/sqweek/dialog"
"log"
//"Rename/rename"
"./rename"
)
func main() {
app := app.New()
window := app.NewWindow("Rename")
window.Resize(fyne.NewSize(400, 80))
setDirPath := widget.NewEntry() //Entry for Selected Directory
setDirPath.SetText(" Select a Directory ")
setDirPath.Disable()
var dir string
var err error
browseBtn := widget.NewButton("Browse", func() { //Browse Directory
dir, err = dialog.Directory().Title("Open Dialog").Browse()
log.Print("Browse...")
if err != nil {
log.Println("Directory Select Cancelled")
}
setDirPath.SetText(dir)
log.Println(dir)
})
execBtn := widget.NewButton("Exec", func() { //Execute Rename
if dir == "" {
log.Println("Directory Not Selected")
} else {
log.Print("Rename...")
rename.Rename(dir)
window.Close()
}
})
window.SetContent( //Layout Contents
fyne.NewContainerWithLayout(
layout.NewVBoxLayout(),
fyne.NewContainerWithLayout(layout.NewHBoxLayout(), setDirPath, layout.NewSpacer(),fyne.NewContainerWithLayout(
layout.NewVBoxLayout(), browseBtn,execBtn,
),
),
),
)
window.ShowAndRun()
}