updated core dynamic config dialog to have a large size that can be scrolled, not ideal, but works
This commit is contained in:
parent
1ac95d7dca
commit
ac44603205
1 changed files with 42 additions and 13 deletions
|
@ -611,9 +611,12 @@ proc capTitle { cap } {
|
|||
proc popupCapabilityConfig { channel wlan model types values captions bmp possible_values groups } {
|
||||
global node_list g_node_type_services_hint g_popupcap_keys g_prefs
|
||||
set wi .popupCapabilityConfig
|
||||
|
||||
catch {destroy $wi}
|
||||
toplevel $wi
|
||||
set modelname [capTitle $model]
|
||||
wm maxsize $wi 710 600
|
||||
wm minsize $wi 710 600
|
||||
wm transient $wi .
|
||||
wm title $wi "$modelname configuration"
|
||||
|
||||
|
@ -656,10 +659,27 @@ proc popupCapabilityConfig { channel wlan model types values captions bmp possib
|
|||
# session options stored in array, not custom-config
|
||||
if { $model == "session" } { set cfg [getSessionOptionsList] }
|
||||
|
||||
frame $wi.frame
|
||||
set windowFrame $wi.frame
|
||||
|
||||
ttk::notebook $wi.vals
|
||||
pack $wi.vals -fill both -expand true -padx 4 -pady 4
|
||||
ttk::notebook::enableTraversal $wi.vals
|
||||
canvas $windowFrame.c -width 700 -height 600
|
||||
set windowCanvas $windowFrame.c
|
||||
|
||||
scrollbar $windowFrame.sb -orient vert -command "$windowCanvas yview"
|
||||
set windowScroll $windowFrame.sb
|
||||
|
||||
$windowCanvas config -yscrollcommand "$windowScroll set"
|
||||
pack $windowScroll -fill y -side right
|
||||
pack $windowCanvas -expand yes -fill both -side top
|
||||
|
||||
frame $windowCanvas.notebookFrame -width 700 -height 1200
|
||||
set notebookFrame $windowCanvas.notebookFrame
|
||||
pack $notebookFrame -fill both -expand yes -padx 5 -pady 5
|
||||
|
||||
ttk::notebook $notebookFrame.vals -width 690 -height 1200
|
||||
set configNotebook $notebookFrame.vals
|
||||
ttk::notebook::enableTraversal $configNotebook
|
||||
pack $configNotebook -fill both -expand yes
|
||||
|
||||
set n 0
|
||||
set gn 0
|
||||
|
@ -688,12 +708,14 @@ proc popupCapabilityConfig { channel wlan model types values captions bmp possib
|
|||
set gn [lindex $groupinfo 0]
|
||||
set groupcaption [lindex $groupinfo 1]
|
||||
if { $lastgn != $gn } {
|
||||
ttk::frame $wi.vals.$gn
|
||||
$wi.vals add $wi.vals.$gn -text $groupcaption -underline 0
|
||||
ttk::frame $configNotebook.$gn
|
||||
$configNotebook add $configNotebook.$gn -text $groupcaption -underline 0
|
||||
set lastgn $gn
|
||||
}
|
||||
set fr $wi.vals.$gn.item$n
|
||||
|
||||
set fr $configNotebook.$gn.item$n
|
||||
ttk::frame $fr
|
||||
|
||||
if {$type == 11} { ;# boolean value
|
||||
global $fr.entval $fr.entvalhint
|
||||
set optcmd [list tk_optionMenu $fr.ent \
|
||||
|
@ -748,6 +770,7 @@ proc popupCapabilityConfig { channel wlan model types values captions bmp possib
|
|||
} else {
|
||||
pack $fr.ent $fr.lab -side right -padx 4 -pady 4
|
||||
}
|
||||
|
||||
pack $fr -side top -anchor e
|
||||
incr n
|
||||
}; # end foreach
|
||||
|
@ -778,6 +801,11 @@ proc popupCapabilityConfig { channel wlan model types values captions bmp possib
|
|||
bind $wi <Key-Return> $apply_cmd
|
||||
bind $wi <Key-Escape> $cancel_cmd
|
||||
|
||||
# pack notebook
|
||||
$windowCanvas create window 0 0 -anchor nw -window $notebookFrame
|
||||
$windowCanvas configure -scrollregion [$windowCanvas bbox all]
|
||||
pack $windowFrame -fill both -expand yes -side top
|
||||
|
||||
after 100 {
|
||||
grab .popupCapabilityConfig
|
||||
raise .popupCapabilityConfig
|
||||
|
@ -817,22 +845,23 @@ proc popupCapabilityConfigGroup { groups n } {
|
|||
proc popupCapabilityConfigApply { wi channel wlan model types groups } {
|
||||
global node_list MACHINE_TYPES g_popupcap_keys
|
||||
|
||||
set configNotebook $wi.frame.c.notebookFrame.vals
|
||||
set n 0
|
||||
set vals {}
|
||||
foreach type $types {
|
||||
set groupinfo [popupCapabilityConfigGroup $groups [expr {$n + 1}]]
|
||||
set gn [lindex $groupinfo 0]
|
||||
if { ![winfo exists $wi.vals.$gn.item$n.ent] } {
|
||||
if { ![winfo exists $configNotebook.$gn.item$n.ent] } {
|
||||
puts "warning: missing dialog value $n for $model"
|
||||
continue
|
||||
}
|
||||
if { [catch { set val [$wi.vals.$gn.item$n.ent get] }] } {
|
||||
if { [catch { set val [$configNotebook.$gn.item$n.ent get] }] } {
|
||||
if { $type == 11 } {
|
||||
# convert textual value from tk_optionMenu to boolean 0/1
|
||||
# using hint
|
||||
global $wi.vals.$gn.item$n.entval $wi.vals.$gn.item$n.entvalhint
|
||||
if { [set $wi.vals.$gn.item$n.entval] == \
|
||||
[set $wi.vals.$gn.item$n.entvalhint] } {
|
||||
global $configNotebook.$gn.item$n.entval $configNotebook.$gn.item$n.entvalhint
|
||||
if { [set $configNotebook.$gn.item$n.entval] == \
|
||||
[set $configNotebook.$gn.item$n.entvalhint] } {
|
||||
set val 1 ;# true
|
||||
} else {
|
||||
set val 0 ;# false
|
||||
|
@ -840,8 +869,8 @@ proc popupCapabilityConfigApply { wi channel wlan model types groups } {
|
|||
} else {
|
||||
# convert textual dropdown value to numeric using first word
|
||||
# e.g. "0 11 Mbps" has a value of 0
|
||||
global $wi.vals.$gn.item$n.entval
|
||||
set selectedopt [set $wi.vals.$gn.item$n.entval]
|
||||
global $configNotebook.$gn.item$n.entval
|
||||
set selectedopt [set $configNotebook.$gn.item$n.entval]
|
||||
set val [lindex $selectedopt 0]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue