1 Star 0 Fork 354

honiswang/PDF-Guru

forked from Kevin2li/PDF-Guru 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
utils.go 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
Kevin2li 提交于 2023-07-18 15:06 . refactor
package main
import (
"github.com/pkg/errors"
wails_runtime "github.com/wailsapp/wails/v2/pkg/runtime"
)
func (a *App) SelectFile() string {
d, err := wails_runtime.OpenFileDialog(a.ctx, wails_runtime.OpenDialogOptions{})
if err != nil {
logger.Errorln(err)
return ""
}
logger.Debugf("%v\n", d)
return d
}
func (a *App) SelectMultipleFiles() []string {
d, err := wails_runtime.OpenMultipleFilesDialog(a.ctx, wails_runtime.OpenDialogOptions{})
if err != nil {
logger.Errorln(err)
return nil
}
logger.Debugf("%v\n", d)
return d
}
func (a *App) SelectDir() string {
d, err := wails_runtime.OpenDirectoryDialog(a.ctx, wails_runtime.OpenDialogOptions{})
if err != nil {
logger.Errorln(err)
return ""
}
logger.Debugf("%v\n", d)
return d
}
func (a *App) SaveFile() string {
d, err := wails_runtime.SaveFileDialog(a.ctx, wails_runtime.SaveDialogOptions{})
if err != nil {
logger.Errorln(err)
return ""
}
logger.Debugf("%v\n", d)
return d
}
func (a *App) OpenUrl(url string) {
wails_runtime.BrowserOpenURL(a.ctx, url)
}
func (a *App) GetClipboard() string {
text, err := wails_runtime.ClipboardGetText(a.ctx)
if err != nil {
logger.Errorln(err)
return ""
}
return text
}
func (a *App) SetClipboard(content string) error {
err := wails_runtime.ClipboardSetText(a.ctx, content)
if err != nil {
logger.Errorln(err)
err = errors.Wrap(err, "set clipboard error")
return err
}
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/whyfree/PDF-Guru.git
git@gitee.com:whyfree/PDF-Guru.git
whyfree
PDF-Guru
PDF-Guru
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385