Compare commits
No commits in common. "994e432891851863b8e8efcbe5ed2ba194815582" and "90a87af5269a6f1cf109270b54b5a5dae1d817d1" have entirely different histories.
994e432891
...
90a87af526
@ -44,43 +44,6 @@ func main() {
|
|||||||
Centered: false,
|
Centered: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
menu := app.NewMenu()
|
|
||||||
fileMenu := menu.AddSubmenu("File")
|
|
||||||
fileMenu.AddRole(application.NewFile)
|
|
||||||
fileMenu.AddRole(application.Open)
|
|
||||||
fileMenu.Append(application.NewFileMenu().GetSubmenu())
|
|
||||||
menu.FindByRole(application.NewFile).OnClick(func(ctx *application.Context) {
|
|
||||||
d := application.SaveFileDialog()
|
|
||||||
d.SetOptions(&application.SaveFileDialogOptions{
|
|
||||||
Filters: []application.FileFilter{
|
|
||||||
{DisplayName: "Peachy database", Pattern: "*.pit"},
|
|
||||||
{DisplayName: "All Files", Pattern: "*.*"},
|
|
||||||
},
|
|
||||||
AllowOtherFileTypes: true,
|
|
||||||
Title: "Create new database",
|
|
||||||
})
|
|
||||||
path, err := d.PromptForSingleSelection()
|
|
||||||
if err != nil {
|
|
||||||
application.InfoDialog().SetMessage("Error: " + err.Error()).Show()
|
|
||||||
}
|
|
||||||
if path != "" {
|
|
||||||
application.InfoDialog().SetMessage(path).Show()
|
|
||||||
} else {
|
|
||||||
application.InfoDialog().SetMessage("No file selected").Show()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
menu.FindByRole(application.Open).OnClick(func(ctx *application.Context) {
|
|
||||||
path, _ := application.OpenFileDialog().
|
|
||||||
CanChooseFiles(true).
|
|
||||||
PromptForSingleSelection()
|
|
||||||
if path != "" {
|
|
||||||
application.InfoDialog().SetMessage(path).Show()
|
|
||||||
} else {
|
|
||||||
application.InfoDialog().SetMessage("No file selected").Show()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
app.SetMenu(menu)
|
|
||||||
|
|
||||||
err := app.Run()
|
err := app.Run()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -12,7 +12,6 @@ func Head() h.ParentElement {
|
|||||||
e.Meta(a.Name("viewport"), a.Content("width=device-width, initial-scale=1")),
|
e.Meta(a.Name("viewport"), a.Content("width=device-width, initial-scale=1")),
|
||||||
e.Title()(h.Text("Peachy")),
|
e.Title()(h.Text("Peachy")),
|
||||||
e.Link(a.Rel("stylesheet"), a.Href("/static/css/main.css")),
|
e.Link(a.Rel("stylesheet"), a.Href("/static/css/main.css")),
|
||||||
e.Link(a.Rel("icon"), a.Href("static/favicon.ico")),
|
|
||||||
e.Script(a.Src("/static/js/htmx-2.0.3.min.js"))(), // TODO change to pack it with the app
|
e.Script(a.Src("/static/js/htmx-2.0.3.min.js"))(), // TODO change to pack it with the app
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 933 B |
@ -1,12 +1,16 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
|
<head>
|
||||||
<title>Hello World</title>
|
<title>Hello World</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="icon" href="static/favicon.ico">
|
</head>
|
||||||
</head>
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1>Hello World</h1>
|
<h1>Hello World</h1>
|
||||||
</body>
|
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user