parent
							
								
									7425097611
								
							
						
					
					
						commit
						4ffb9faaff
					
				
							
								
								
									
										8
									
								
								.idea/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.idea/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,8 +0,0 @@ | |||||||
| # 默认忽略的文件 |  | ||||||
| /shelf/ |  | ||||||
| /workspace.xml |  | ||||||
| # 基于编辑器的 HTTP 客户端请求 |  | ||||||
| /httpRequests/ |  | ||||||
| # Datasource local storage ignored files |  | ||||||
| /dataSources/ |  | ||||||
| /dataSources.local.xml |  | ||||||
| @ -1,9 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <module type="WEB_MODULE" version="4"> |  | ||||||
|   <component name="Go" enabled="true" /> |  | ||||||
|   <component name="NewModuleRootManager"> |  | ||||||
|     <content url="file://$MODULE_DIR$" /> |  | ||||||
|     <orderEntry type="inheritedJdk" /> |  | ||||||
|     <orderEntry type="sourceFolder" forTests="false" /> |  | ||||||
|   </component> |  | ||||||
| </module> |  | ||||||
| @ -1,6 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="com.codeverse.userSettings.MarscodeWorkspaceAppSettingsState"> |  | ||||||
|     <option name="ckgOperationStatus" value="SUCCESS" /> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
| @ -1,6 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="ElasticsearchConfiguration"> |  | ||||||
|     <option name="version" value="2" /> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
| @ -1,8 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="ProjectModuleManager"> |  | ||||||
|     <modules> |  | ||||||
|       <module fileurl="file://$PROJECT_DIR$/.idea/CoverCrawler.iml" filepath="$PROJECT_DIR$/.idea/CoverCrawler.iml" /> |  | ||||||
|     </modules> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
| @ -1,6 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="VcsDirectoryMappings"> |  | ||||||
|     <mapping directory="$PROJECT_DIR$" vcs="Git" /> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								fyne-cross/.DS_Store
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								fyne-cross/.DS_Store
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								fyne-cross/bin/.DS_Store
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								fyne-cross/bin/.DS_Store
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								fyne-cross/dist/windows-amd64/CoverCrawler.exe.zip
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								fyne-cross/dist/windows-amd64/CoverCrawler.exe.zip
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 18 KiB | 
							
								
								
									
										88
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										88
									
								
								main.go
									
									
									
									
									
								
							| @ -17,58 +17,78 @@ func main() { | |||||||
| 	myWindow.Resize(fyne.NewSize(640, 480)) | 	myWindow.Resize(fyne.NewSize(640, 480)) | ||||||
| 
 | 
 | ||||||
| 	// 创建显示框
 | 	// 创建显示框
 | ||||||
| 	sourceDirLabel := widget.NewLabel("未选择") | 	displayBox1 := widget.NewLabel("未选择") | ||||||
| 	targetDirLabel := widget.NewLabel("未选择") | 	displayBox2 := widget.NewLabel("未选择") | ||||||
| 	displayBoxInfo := canvas.NewText("", colornames.Blue) | 	displayBoxInfo := canvas.NewText("", colornames.Blue) | ||||||
| 
 | 
 | ||||||
| 	// 创建目录选择框
 | 	// 创建目录选择框
 | ||||||
| 	selectSourceDir := widget.NewButton("选择作品存放目录", func() { | 	dirSelect1 := widget.NewButton("选择作品存放目录", func() { | ||||||
| 		dialog.ShowFolderOpen(func(uri fyne.ListableURI, err error) { | 		dirDialog := dialog.NewFolderOpen(func(d fyne.ListableURI, err error) { | ||||||
| 			if err != nil { | 			if err == nil && d != nil { | ||||||
| 				sourceDirLabel.SetText("选择目录失败: " + err.Error()) | 				displayBox1.SetText(d.Path()) | ||||||
| 				return |  | ||||||
| 			} |  | ||||||
| 			if uri != nil { |  | ||||||
| 				sourceDirLabel.SetText(uri.Path()) |  | ||||||
| 			} | 			} | ||||||
| 		}, myWindow) | 		}, myWindow) | ||||||
|  | 		dirDialog.Show() | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	selectTargetDir := widget.NewButton("选择输出目录", func() { | 	dirSelect2 := widget.NewButton("选择输出目录", func() { | ||||||
| 		dialog.ShowFolderOpen(func(uri fyne.ListableURI, err error) { | 		dirDialog := dialog.NewFolderOpen(func(d fyne.ListableURI, err error) { | ||||||
| 			if err != nil { | 			if err == nil && d != nil { | ||||||
| 				targetDirLabel.SetText("选择目录失败: " + err.Error()) | 				displayBox2.SetText(d.Path()) | ||||||
| 				return |  | ||||||
| 			} |  | ||||||
| 			if uri != nil { |  | ||||||
| 				targetDirLabel.SetText(uri.Path()) |  | ||||||
| 			} | 			} | ||||||
| 		}, myWindow) | 		}, myWindow) | ||||||
|  | 		dirDialog.Show() | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	// 创建主布局
 | 	// 创建确定按钮
 | ||||||
| 	content := container.NewVBox( | 	okButton := widget.NewButton("确  定", func() { | ||||||
| 		container.NewHBox(selectSourceDir, sourceDirLabel), | 		dir1 := displayBox1.Text | ||||||
| 		container.NewHBox(selectTargetDir, targetDirLabel), | 		dir2 := displayBox2.Text | ||||||
| 		container.NewCenter(displayBoxInfo), | 
 | ||||||
| 		layout.NewSpacer(), |  | ||||||
| 		container.NewCenter( |  | ||||||
| 			widget.NewButton("开始处理", func() { |  | ||||||
| 				displayBoxInfo.Text = "处理中..." |  | ||||||
| 		displayBoxInfo.Color = colornames.Blue | 		displayBoxInfo.Color = colornames.Blue | ||||||
| 				displayBoxInfo.Refresh() | 		displayBoxInfo.Text = "处理中ing..." | ||||||
| 
 | 
 | ||||||
| 				crawler := NewCrawler(sourceDirLabel.Text, targetDirLabel.Text) | 		crawler := NewCrawler(dir1, dir2) | ||||||
| 		if err := crawler.Handle(); err != nil { | 		if err := crawler.Handle(); err != nil { | ||||||
| 					displayBoxInfo.Text = "处理失败: " + err.Error() |  | ||||||
| 			displayBoxInfo.Color = colornames.Red | 			displayBoxInfo.Color = colornames.Red | ||||||
|  | 			displayBoxInfo.Text = err.Error() | ||||||
| 		} else { | 		} else { | ||||||
| 					displayBoxInfo.Text = "处理完成" |  | ||||||
| 			displayBoxInfo.Color = colornames.Green | 			displayBoxInfo.Color = colornames.Green | ||||||
|  | 			displayBoxInfo.Text = "处理完成" | ||||||
| 		} | 		} | ||||||
| 				displayBoxInfo.Refresh() | 	}) | ||||||
| 			}), | 
 | ||||||
| 		), | 	// 创建水平布局,将目录选择框和显示框并排排列
 | ||||||
|  | 	dirSelect1WithDisplay := container.NewHBox( | ||||||
|  | 		dirSelect1, | ||||||
|  | 		displayBox1, | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	dirSelect2WithDisplay := container.NewHBox( | ||||||
|  | 		dirSelect2, | ||||||
|  | 		displayBox2, | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	dirSelect3WithDisplay := container.NewHBox( | ||||||
|  | 		layout.NewSpacer(), | ||||||
|  | 		displayBoxInfo, | ||||||
|  | 		layout.NewSpacer(), | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	// 创建水平布局,将确定按钮居中
 | ||||||
|  | 	okButtonContainer := container.NewHBox( | ||||||
|  | 		layout.NewSpacer(), | ||||||
|  | 		okButton, | ||||||
|  | 		layout.NewSpacer(), | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	// 创建垂直布局,将上述水平布局和确定按钮垂直排列
 | ||||||
|  | 	content := container.NewVBox( | ||||||
|  | 		dirSelect1WithDisplay, | ||||||
|  | 		dirSelect2WithDisplay, | ||||||
|  | 		dirSelect3WithDisplay, | ||||||
|  | 		layout.NewSpacer(), | ||||||
|  | 		okButtonContainer, | ||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
| 	myWindow.SetContent(content) | 	myWindow.SetContent(content) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user