扫描时禁用按钮
This commit is contained in:
+20
-8
@@ -11,7 +11,7 @@ import (
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
const appVersion = "V1.5.1"
|
||||
const appVersion = "V0.0.1"
|
||||
|
||||
const (
|
||||
ipPlaceholder = "例子:\n127.0.0.1 - 单IP\n192.168.0.0/24 - 掩码IP段\n0.0.0.0-255.255.255.255 - IP段\ndomain.com - 单域名"
|
||||
@@ -28,9 +28,10 @@ type scanForm struct {
|
||||
output *widget.Entry
|
||||
progress *widget.ProgressBar
|
||||
|
||||
scanBtn *widget.Button
|
||||
pingBtn *widget.Button
|
||||
scanning bool
|
||||
scanBtn *widget.Button
|
||||
pingBtn *widget.Button
|
||||
keypadBtn []*widget.Button
|
||||
scanning bool
|
||||
}
|
||||
|
||||
func newScanForm(app fyne.App) *scanForm {
|
||||
@@ -62,13 +63,17 @@ func (f *scanForm) build() fyne.CanvasObject {
|
||||
ipSection := container.NewVBox(
|
||||
widget.NewLabel("IP"),
|
||||
f.ipList,
|
||||
newIPKeypad(f.ipList),
|
||||
)
|
||||
ipKeys, ipBtns := newIPKeypad(f.ipList)
|
||||
ipSection.Add(ipKeys)
|
||||
portSection := container.NewVBox(
|
||||
widget.NewLabel("端口"),
|
||||
f.portList,
|
||||
newPortKeypad(f.portList),
|
||||
)
|
||||
portKeys, portBtns := newPortKeypad(f.portList)
|
||||
portSection.Add(portKeys)
|
||||
f.keypadBtn = append(f.keypadBtn, ipBtns...)
|
||||
f.keypadBtn = append(f.keypadBtn, portBtns...)
|
||||
|
||||
topRow := container.New(layout.NewGridLayoutWithColumns(2), ipSection, portSection)
|
||||
controlRow := f.buildControlRow()
|
||||
@@ -78,8 +83,8 @@ func (f *scanForm) build() fyne.CanvasObject {
|
||||
widget.NewLabel(appVersion),
|
||||
layout.NewSpacer(),
|
||||
widget.NewButton("Blog", func() { f.openURL("https://wnfed.com/") }),
|
||||
widget.NewButton("GitLab", func() { f.openURL("https://git.lmve.net/kevin/tcp_ip_scan") }),
|
||||
widget.NewButton("GitHub", func() { f.openURL("https://github.com/wuwenfengmi1998/tcp_ip_scan") }),
|
||||
widget.NewButton("Gitea", func() { f.openURL("https://git.lmve.net/kevin/ip_scan_go") }),
|
||||
widget.NewButton("GitHub", func() { f.openURL("https://github.com/wuwenfengmi1998") }),
|
||||
)
|
||||
|
||||
return container.NewBorder(topArea, footer, nil, nil, f.output)
|
||||
@@ -136,6 +141,13 @@ func (f *scanForm) togglePing() {
|
||||
}
|
||||
|
||||
func (f *scanForm) setInputsEnabled(enabled bool) {
|
||||
for _, b := range f.keypadBtn {
|
||||
if enabled {
|
||||
b.Enable()
|
||||
} else {
|
||||
b.Disable()
|
||||
}
|
||||
}
|
||||
if enabled {
|
||||
f.ipList.Enable()
|
||||
f.portList.Enable()
|
||||
|
||||
Reference in New Issue
Block a user