makepptWithWorkflowBasefyne/main.go

56 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"context"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)
type themeObj struct {
id int
}
func main() {
var (
content []fyne.CanvasObject
theme themeObj
)
myWindow, myApp := InitApp()
ctx := context.Background()
keyword := widget.NewEntry()
keyword.SetPlaceHolder("请输入主题eg:核弹的手搓过程")
//大纲
outLine, input := ModuleOutline(ctx, keyword, myApp)
//主题
themes := ModuleTheme(ctx, keyword, &theme)
//生成ppt
ppt := ModulePpt(ctx, input, &theme, keyword)
//添加到窗口
content = append(content, keyword)
content = append(content, outLine...)
content = append(content, themes...)
content = append(content, ppt...)
myWindow.SetContent(container.NewVBox(
content...,
),
)
//// 显示并运行窗口
myWindow.ShowAndRun()
}
func InitApp() (fyne.Window, fyne.App) {
myApp := app.New()
myApp.Settings().SetTheme(theme.DefaultTheme())
// 创建一个窗口
myWindow := myApp.NewWindow("蓝色兄弟ppt创建测试版")
myWindow.Resize(fyne.NewSize(800, 500))
myWindow.CenterOnScreen()
return myWindow, myApp
}