feat: dialogs
This commit is contained in:
@@ -4,14 +4,36 @@ import (
|
|||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var currentWindow *application.WebviewWindow
|
||||||
|
|
||||||
|
func Init(window *application.WebviewWindow) {
|
||||||
|
if window == nil {
|
||||||
|
panic("currentWindow is nil")
|
||||||
|
}
|
||||||
|
currentWindow = window
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkInit() {
|
||||||
|
if currentWindow == nil {
|
||||||
|
panic("Initialize dialogs package before use")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func InfoDialog(title string, message string) {
|
func InfoDialog(title string, message string) {
|
||||||
application.InfoDialog().SetTitle(title).SetMessage(message).Show()
|
checkInit()
|
||||||
|
application.InfoDialog().AttachToWindow(currentWindow).SetTitle(title).SetMessage(message).Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
func WarningDialog(title string, message string) {
|
func WarningDialog(title string, message string) {
|
||||||
application.WarningDialog().SetTitle(title).SetMessage(message).Show()
|
checkInit()
|
||||||
|
application.WarningDialog().AttachToWindow(currentWindow).SetTitle(title).SetMessage(message).Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
func ErrorDialog(title string, message string) {
|
func ErrorDialog(title string, message string) {
|
||||||
application.ErrorDialog().SetTitle(title).SetMessage(message).Show()
|
checkInit()
|
||||||
|
application.ErrorDialog().AttachToWindow(currentWindow).SetTitle(title).SetMessage(message).Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func SaveFileDialog(title string) {
|
||||||
|
checkInit()
|
||||||
}
|
}
|
||||||
|
|||||||
1
internal/extras/excel/export.go
Normal file
1
internal/extras/excel/export.go
Normal file
@@ -0,0 +1 @@
|
|||||||
|
package excel
|
||||||
4
main.go
4
main.go
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"app/internal/dialogs"
|
||||||
"app/internal/services"
|
"app/internal/services"
|
||||||
"embed"
|
"embed"
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
@@ -28,7 +29,7 @@ func main() {
|
|||||||
// 'Mac' options tailor the window when running on macOS.
|
// 'Mac' options tailor the window when running on macOS.
|
||||||
// 'BackgroundColour' is the background colour of the window.
|
// 'BackgroundColour' is the background colour of the window.
|
||||||
// 'URL' is the URL that will be loaded into the webview.
|
// 'URL' is the URL that will be loaded into the webview.
|
||||||
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
window := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||||
Title: "Завод \"Белочка\"",
|
Title: "Завод \"Белочка\"",
|
||||||
Mac: application.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
@@ -38,6 +39,7 @@ func main() {
|
|||||||
BackgroundColour: application.NewRGB(27, 38, 54),
|
BackgroundColour: application.NewRGB(27, 38, 54),
|
||||||
URL: "/",
|
URL: "/",
|
||||||
})
|
})
|
||||||
|
dialogs.Init(window)
|
||||||
|
|
||||||
err := app.Run()
|
err := app.Run()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user