фикс для окна конфигураций (vibe-kanban b9621dd9)
Окно конфигураций не открывается:
PS C:\\Users\\hamy\\AppData\\Local\\Temp\\vibe-kanban\\worktrees\\a880-\\HamyVPNClient> go run .
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x38 pc=0x7ff69290cb17]
goroutine 1 [running, locked to thread]:
main.main.func4.2()
C:/Users/hamy/AppData/Local/Temp/vibe-kanban/worktrees/a880-/HamyVPNClient/main.go:323 +0x177
main.main.func4()
C:/Users/hamy/AppData/Local/Temp/vibe-kanban/worktrees/a880-/HamyVPNClient/main.go:328 +0x27a
fyne.io/fyne/v2/widget.(\*Button).Tapped(0xc00021e7e0, 0x7ff69328c860?)
C:/Users/hamy/go/pkg/mod/fyne.io/fyne/v2@v2.7.2/widget/button.go:192 +0x9f
fyne.io/fyne/v2/internal/driver/glfw.(\*window).mouseClickedHandleTapDoubleTap(0xc00011a000, {0x7ff6933cbac0, 0xc00021e7e0}, 0xc000c579a0)
C:/Users/hamy/go/pkg/mod/fyne.io/fyne/v2@v2.7.2/internal/driver/glfw/window.go:581 +0x182
fyne.io/fyne/v2/internal/driver/glfw.(\*window).processMouseClicked(0xc00011a000, 0x1, 0x0, 0x0)
C:/Users/hamy/go/pkg/mod/fyne.io/fyne/v2@v2.7.2/internal/driver/glfw/window.go:542 +0x718
fyne.io/fyne/v2/internal/driver/glfw.(\*window).mouseClicked(0xc00021ebd0?, 0xc000c3d9c8?, 0x7ff6928935a0?, 0x7ff6938e1480?, 0xc000c3d9a8?)
C:/Users/hamy/go/pkg/mod/fyne.io/fyne/v2@v2.7.2/internal/driver/glfw/window\_desktop.go:409 +0xaf
github.com/go-gl/glfw/v3.3/glfw.goMouseButtonCB(0xc0000021c0?, 0x0, 0x0, 0x0)
C:/Users/hamy/go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240506104042-037f3cc74f2a/input.go:333 +0x4e
github.com/go-gl/glfw/v3.3/glfw.\_Cfunc\_glfwPollEvents()
\_cgo\_gotypes.go:1544 +0x45
github.com/go-gl/glfw/v3.3/glfw.PollEvents()
C:/Users/hamy/go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240506104042-037f3cc74f2a/window.go:931 +0x13
fyne.io/fyne/v2/internal/driver/glfw.(\*gLDriver).pollEvents(...)
C:/Users/hamy/go/pkg/mod/fyne.io/fyne/v2@v2.7.2/internal/driver/glfw/loop\_desktop.go:22
fyne.io/fyne/v2/internal/driver/glfw.(\*gLDriver).runGL(0xc00004bda8?)
C:/Users/hamy/go/pkg/mod/fyne.io/fyne/v2@v2.7.2/internal/driver/glfw/loop.go:154 +0x1aa
fyne.io/fyne/v2/internal/driver/glfw.(\*gLDriver).Run(0xc0000ea000)
C:/Users/hamy/go/pkg/mod/fyne.io/fyne/v2@v2.7.2/internal/driver/glfw/driver.go:162 +0x72
fyne.io/fyne/v2/app.(\*fyneApp).Run(0xc0000ea0b0)
C:/Users/hamy/go/pkg/mod/fyne.io/fyne/v2@v2.7.2/app/app.go:77 +0x102
fyne.io/fyne/v2/internal/driver/glfw.(\*window).ShowAndRun(0xc00011a000)
C:/Users/hamy/go/pkg/mod/fyne.io/fyne/v2@v2.7.2/internal/driver/glfw/window.go:217 +0x64
main.main()
C:/Users/hamy/AppData/Local/Temp/vibe-kanban/worktrees/a880-/HamyVPNClient/main.go:363 +0xa18
exit status 2
PS C:\\Users\\hamy\\AppData\\Local\\Temp\\vibe-kanban\\worktrees\\a880-\\HamyVPNClient>
также там была проблема с полем ввода - оно сжатое (отображается не во всю ширину окна)
This commit is contained in:
BIN
hamy-vpn-client-updated.exe
Normal file
BIN
hamy-vpn-client-updated.exe
Normal file
Binary file not shown.
43
main.go
43
main.go
@@ -227,11 +227,11 @@ func main() {
|
|||||||
var scrollContainer *container.Scroll
|
var scrollContainer *container.Scroll
|
||||||
var refreshList func()
|
var refreshList func()
|
||||||
|
|
||||||
// Entry for importing new configuration
|
// Entry for importing new configuration - fixed to expand properly
|
||||||
importEntry := widget.NewEntry()
|
importEntry := widget.NewEntry()
|
||||||
importEntry.PlaceHolder = "vless://..."
|
importEntry.PlaceHolder = "vless://..."
|
||||||
|
|
||||||
// Import button - define after all necessary variables
|
// Container for import field and button - use HBox to allow proper expansion
|
||||||
importButton := widget.NewButtonWithIcon("", theme.ContentAddIcon(), func() {
|
importButton := widget.NewButtonWithIcon("", theme.ContentAddIcon(), func() {
|
||||||
url := importEntry.Text
|
url := importEntry.Text
|
||||||
if url != "" && isValidVLESS(url) {
|
if url != "" && isValidVLESS(url) {
|
||||||
@@ -240,17 +240,16 @@ func main() {
|
|||||||
dialog.ShowInformation("Успешно", "Конфиг добавлен", configWindow)
|
dialog.ShowInformation("Успешно", "Конфиг добавлен", configWindow)
|
||||||
|
|
||||||
// Refresh the list
|
// Refresh the list
|
||||||
if listContainer != nil {
|
refreshList()
|
||||||
refreshList()
|
|
||||||
}
|
|
||||||
importEntry.SetText("")
|
importEntry.SetText("")
|
||||||
} else if url != "" {
|
} else if url != "" {
|
||||||
dialog.ShowError(errors.New("Невалидная ссылка"), configWindow)
|
dialog.ShowError(errors.New("Невалидная ссылка"), configWindow)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Fixed the order of operations to avoid nil reference
|
||||||
refreshList = func() {
|
refreshList = func() {
|
||||||
// Need to recreate the list since we can't refresh it directly
|
// Create the list first
|
||||||
newListContainer := widget.NewList(
|
newListContainer := widget.NewList(
|
||||||
func() int {
|
func() int {
|
||||||
return len(configs)
|
return len(configs)
|
||||||
@@ -303,13 +302,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allow clicking on the whole row to select the config
|
// Allow clicking on the whole row to select the config
|
||||||
box.Objects[0] = container.NewStack(
|
selectButton := widget.NewButton("", func() {
|
||||||
widget.NewButton("", func() {
|
activeConfig = id
|
||||||
activeConfig = id
|
dialog.ShowInformation("Config Selected", fmt.Sprintf("Active config: %s", configs[id].Title), configWindow)
|
||||||
dialog.ShowInformation("Config Selected", fmt.Sprintf("Active config: %s", configs[id].Title), configWindow)
|
configWindow.Close()
|
||||||
configWindow.Close()
|
})
|
||||||
}),
|
selectButton.Hidden = true
|
||||||
)
|
box.Objects[0] = container.NewStack(selectButton)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -319,18 +318,24 @@ func main() {
|
|||||||
configWindow.Close()
|
configWindow.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace the list container content
|
// Assign to the variable before using it in the scroll container
|
||||||
scrollContainer.Content = newListContainer
|
|
||||||
scrollContainer.Refresh()
|
|
||||||
listContainer = newListContainer
|
listContainer = newListContainer
|
||||||
|
|
||||||
|
// Create scroll container only once
|
||||||
|
if scrollContainer == nil {
|
||||||
|
scrollContainer = container.NewScroll(listContainer)
|
||||||
|
} else {
|
||||||
|
scrollContainer.Content = listContainer
|
||||||
|
scrollContainer.Refresh()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call refreshList to initialize the list first
|
||||||
refreshList()
|
refreshList()
|
||||||
|
|
||||||
scrollContainer = container.NewScroll(listContainer)
|
|
||||||
|
|
||||||
// Container for import field and button - use HBox to allow proper expansion
|
// Container for import field and button - use HBox to allow proper expansion
|
||||||
importContainer := container.NewHBox(importEntry, importButton)
|
// Using container.NewBorder to make the entry expand properly
|
||||||
|
importContainer := container.NewBorder(nil, nil, nil, importButton, importEntry)
|
||||||
|
|
||||||
// Main content for the config window
|
// Main content for the config window
|
||||||
configContent := container.NewVBox(
|
configContent := container.NewVBox(
|
||||||
|
|||||||
Reference in New Issue
Block a user