diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 682ab74..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 35410ca..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# 默认忽略的文件 -/shelf/ -/workspace.xml -# 基于编辑器的 HTTP 客户端请求 -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/CoverCrawler.iml b/.idea/CoverCrawler.iml deleted file mode 100644 index 5e764c4..0000000 --- a/.idea/CoverCrawler.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/MarsCodeWorkspaceAppSettings.xml b/.idea/MarsCodeWorkspaceAppSettings.xml deleted file mode 100644 index 05ed8ba..0000000 --- a/.idea/MarsCodeWorkspaceAppSettings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/elasticsearchSettings.xml b/.idea/elasticsearchSettings.xml deleted file mode 100644 index b796368..0000000 --- a/.idea/elasticsearchSettings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 24486a4..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/__debug_bin3905452747 b/__debug_bin3905452747 deleted file mode 100755 index 61daee3..0000000 Binary files a/__debug_bin3905452747 and /dev/null differ diff --git a/fyne-cross/.DS_Store b/fyne-cross/.DS_Store deleted file mode 100644 index c20349c..0000000 Binary files a/fyne-cross/.DS_Store and /dev/null differ diff --git a/fyne-cross/bin/.DS_Store b/fyne-cross/bin/.DS_Store deleted file mode 100644 index 7141c2c..0000000 Binary files a/fyne-cross/bin/.DS_Store and /dev/null differ diff --git a/fyne-cross/bin/windows-amd64/CoverCrawler.exe b/fyne-cross/bin/windows-amd64/CoverCrawler.exe deleted file mode 100755 index bb9c468..0000000 Binary files a/fyne-cross/bin/windows-amd64/CoverCrawler.exe and /dev/null differ diff --git a/fyne-cross/dist/windows-amd64/CoverCrawler.exe.zip b/fyne-cross/dist/windows-amd64/CoverCrawler.exe.zip deleted file mode 100644 index 18fa433..0000000 Binary files a/fyne-cross/dist/windows-amd64/CoverCrawler.exe.zip and /dev/null differ diff --git a/fyne-cross/tmp/windows-amd64/Icon.png b/fyne-cross/tmp/windows-amd64/Icon.png deleted file mode 100644 index 2365791..0000000 Binary files a/fyne-cross/tmp/windows-amd64/Icon.png and /dev/null differ diff --git a/main.go b/main.go index c63f57e..ad12af7 100644 --- a/main.go +++ b/main.go @@ -17,58 +17,78 @@ func main() { myWindow.Resize(fyne.NewSize(640, 480)) // 创建显示框 - sourceDirLabel := widget.NewLabel("未选择") - targetDirLabel := widget.NewLabel("未选择") + displayBox1 := widget.NewLabel("未选择") + displayBox2 := widget.NewLabel("未选择") displayBoxInfo := canvas.NewText("", colornames.Blue) // 创建目录选择框 - selectSourceDir := widget.NewButton("选择作品存放目录", func() { - dialog.ShowFolderOpen(func(uri fyne.ListableURI, err error) { - if err != nil { - sourceDirLabel.SetText("选择目录失败: " + err.Error()) - return - } - if uri != nil { - sourceDirLabel.SetText(uri.Path()) + dirSelect1 := widget.NewButton("选择作品存放目录", func() { + dirDialog := dialog.NewFolderOpen(func(d fyne.ListableURI, err error) { + if err == nil && d != nil { + displayBox1.SetText(d.Path()) } }, myWindow) + dirDialog.Show() }) - selectTargetDir := widget.NewButton("选择输出目录", func() { - dialog.ShowFolderOpen(func(uri fyne.ListableURI, err error) { - if err != nil { - targetDirLabel.SetText("选择目录失败: " + err.Error()) - return - } - if uri != nil { - targetDirLabel.SetText(uri.Path()) + dirSelect2 := widget.NewButton("选择输出目录", func() { + dirDialog := dialog.NewFolderOpen(func(d fyne.ListableURI, err error) { + if err == nil && d != nil { + displayBox2.SetText(d.Path()) } }, myWindow) + dirDialog.Show() }) - // 创建主布局 - content := container.NewVBox( - container.NewHBox(selectSourceDir, sourceDirLabel), - container.NewHBox(selectTargetDir, targetDirLabel), - container.NewCenter(displayBoxInfo), + // 创建确定按钮 + okButton := widget.NewButton("确 定", func() { + dir1 := displayBox1.Text + dir2 := displayBox2.Text + + displayBoxInfo.Color = colornames.Blue + displayBoxInfo.Text = "处理中ing..." + + crawler := NewCrawler(dir1, dir2) + if err := crawler.Handle(); err != nil { + displayBoxInfo.Color = colornames.Red + displayBoxInfo.Text = err.Error() + } else { + displayBoxInfo.Color = colornames.Green + displayBoxInfo.Text = "处理完成" + } + }) + + // 创建水平布局,将目录选择框和显示框并排排列 + dirSelect1WithDisplay := container.NewHBox( + dirSelect1, + displayBox1, + ) + + dirSelect2WithDisplay := container.NewHBox( + dirSelect2, + displayBox2, + ) + + dirSelect3WithDisplay := container.NewHBox( layout.NewSpacer(), - container.NewCenter( - widget.NewButton("开始处理", func() { - displayBoxInfo.Text = "处理中..." - displayBoxInfo.Color = colornames.Blue - displayBoxInfo.Refresh() + displayBoxInfo, + layout.NewSpacer(), + ) - crawler := NewCrawler(sourceDirLabel.Text, targetDirLabel.Text) - if err := crawler.Handle(); err != nil { - displayBoxInfo.Text = "处理失败: " + err.Error() - displayBoxInfo.Color = colornames.Red - } else { - displayBoxInfo.Text = "处理完成" - displayBoxInfo.Color = colornames.Green - } - displayBoxInfo.Refresh() - }), - ), + // 创建水平布局,将确定按钮居中 + okButtonContainer := container.NewHBox( + layout.NewSpacer(), + okButton, + layout.NewSpacer(), + ) + + // 创建垂直布局,将上述水平布局和确定按钮垂直排列 + content := container.NewVBox( + dirSelect1WithDisplay, + dirSelect2WithDisplay, + dirSelect3WithDisplay, + layout.NewSpacer(), + okButtonContainer, ) myWindow.SetContent(content)