Skip to content

Commit

Permalink
Added Icons support
Browse files Browse the repository at this point in the history
  • Loading branch information
gvrosun committed Apr 3, 2022
1 parent 265c683 commit b7ebe6d
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"github.com/go-gota/gota/dataframe"
"io/ioutil"
"math"
"os"
"strconv"
"strings"
"time"
)

func readCSV(fileName string, ch chan string) (int, dataframe.DataFrame) {
Expand All @@ -33,7 +33,7 @@ func generateRange(min int, max int) []int {
}

func processSplitting(fileName string, option string, numOf int, folder bool, progress *widget.ProgressBar, ch chan string) {
fmt.Println(fileName, option, numOf, folder)

if option == "" {
ch <- "Please select the chunk type"
return
Expand Down Expand Up @@ -72,7 +72,6 @@ func processSplitting(fileName string, option string, numOf int, folder bool, pr
totalChunks = float64(numOf)
}

fmt.Println(totalChunks, chunkRow)
start := 0
end := chunkRow
for i := 1.0; i <= totalChunks; i += 1.0 {
Expand Down Expand Up @@ -129,20 +128,25 @@ func setFileName(fileWidget *widget.Label, ch chan string) {
func main() {
a := app.New()
w := a.NewWindow("Split CSV")
r, _ := fyne.LoadResourceFromPath("./Icon.png")
w.SetIcon(r)
w1 := a.NewWindow("Result")
w1.SetIcon(theme.InfoIcon())
w1.SetMaster()
w.CenterOnScreen()
w.Resize(fyne.Size{Width: 400, Height: 200})
entryOption := ""
isFolder := false
ch := make(chan string)
waitResult := false
CSVFileName := ""

fileName := widget.NewLabel("Detecting...")
go setFileName(fileName, ch)
go func() {
result := <-ch
if strings.Contains(result, "Error") {
time.Sleep(time.Millisecond * 1000)
waitResult = true
w.Close()
w1.SetContent(widget.NewLabel(result))
w1.CenterOnScreen()
Expand Down Expand Up @@ -186,7 +190,11 @@ func main() {
SubmitText: "Split Now",
CancelText: "Close",
}

w.SetContent(container.NewVBox(form, progress))
w.ShowAndRun()
if waitResult {
w1.Show()
} else {
w.Show()
}
a.Run()
}

0 comments on commit b7ebe6d

Please sign in to comment.