Refactor application structure and initialize core components
I decided to rewrite the program taking into account the experience gained.
This commit is contained in:
39
internal/gui/view/error.go
Normal file
39
internal/gui/view/error.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application/setting"
|
||||
)
|
||||
|
||||
func StartWithError(err error, languages []setting.Lang, funcSelected func(lang setting.Lang)) fyne.CanvasObject {
|
||||
messageHead := lang.L("error")
|
||||
|
||||
listView := widget.NewList(
|
||||
func() int {
|
||||
return len(languages)
|
||||
},
|
||||
func() fyne.CanvasObject {
|
||||
return widget.NewLabel("template")
|
||||
},
|
||||
func(i widget.ListItemID, o fyne.CanvasObject) {
|
||||
block := o.(*widget.Label)
|
||||
block.SetText(languages[i].Title)
|
||||
})
|
||||
listView.OnSelected = func(id widget.ListItemID) {
|
||||
funcSelected(languages[id])
|
||||
}
|
||||
|
||||
return container.NewBorder(
|
||||
container.NewVBox(
|
||||
widget.NewLabel(messageHead),
|
||||
widget.NewLabel(err.Error()),
|
||||
),
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
listView,
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user