Worked around the 4 reserved characters of Bwidget Tree
This commit is contained in:
parent
1c59b20844
commit
e89c448171
@ -2450,8 +2450,10 @@ proc browse_tree_fill_dir {tr parent children} {
|
|||||||
|
|
||||||
if {$parent == "/"} {
|
if {$parent == "/"} {
|
||||||
set parent_name root
|
set parent_name root
|
||||||
|
set parent_dir /
|
||||||
} else {
|
} else {
|
||||||
set parent_name $parent
|
set parent_name [escape_to_tree $parent]
|
||||||
|
set parent_dir $parent_name
|
||||||
}
|
}
|
||||||
if {[$tr exists $parent_name] == 0} {return ""}
|
if {[$tr exists $parent_name] == 0} {return ""}
|
||||||
|
|
||||||
@ -2459,19 +2461,12 @@ proc browse_tree_fill_dir {tr parent children} {
|
|||||||
|
|
||||||
foreach i $children {
|
foreach i $children {
|
||||||
set name [string range $i 2 end]
|
set name [string range $i 2 end]
|
||||||
|
set escpd [escape_to_tree $name]
|
||||||
# >>> Escape $|^!
|
set adr [combine_dir_and_name $parent_dir $escpd]
|
||||||
|
|
||||||
set adr [combine_dir_and_name $parent $name]
|
|
||||||
$tr insert end $parent_name $adr -text $name
|
$tr insert end $parent_name $adr -text $name
|
||||||
if {[string range $i 0 0] == "d"} {
|
if {[string range $i 0 0] == "d"} {
|
||||||
set dir_dummy [combine_dir_and_name $adr "_"]
|
set dir_dummy [combine_dir_and_name $adr "_"]
|
||||||
|
$tr insert end $adr $dir_dummy -text " "
|
||||||
# <<<
|
|
||||||
catch {
|
|
||||||
# >>> Fails if the path contains $|^!
|
|
||||||
$tr insert end $adr $dir_dummy -text " "
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2479,7 +2474,7 @@ proc browse_tree_fill_dir {tr parent children} {
|
|||||||
|
|
||||||
# The command to be executed when the user double-clicks a node.
|
# The command to be executed when the user double-clicks a node.
|
||||||
#
|
#
|
||||||
proc browse_tree_accept {adr_var_name do_return tr selected} {
|
proc browse_tree_accept {adr_var_name do_return tr value} {
|
||||||
global have_bwidget
|
global have_bwidget
|
||||||
global extract_to_adr insert_from_adr burn_write_image_adr isodir_adr
|
global extract_to_adr insert_from_adr burn_write_image_adr isodir_adr
|
||||||
global isomanip_move_target indev_adr outdev_adr cmd_log_target
|
global isomanip_move_target indev_adr outdev_adr cmd_log_target
|
||||||
@ -2487,15 +2482,6 @@ proc browse_tree_accept {adr_var_name do_return tr selected} {
|
|||||||
|
|
||||||
# Caution: Before using $tr, check for $have_bwidget
|
# Caution: Before using $tr, check for $have_bwidget
|
||||||
|
|
||||||
if {[llength $selected] > 1} {
|
|
||||||
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You may only select a single file"
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
if {[llength $selected] == 0} {
|
|
||||||
set value ""
|
|
||||||
} else {
|
|
||||||
set value [lindex $selected 0]
|
|
||||||
}
|
|
||||||
if {$adr_var_name == "burn_write_image_adr"} {
|
if {$adr_var_name == "burn_write_image_adr"} {
|
||||||
set burn_write_image_adr $value
|
set burn_write_image_adr $value
|
||||||
if {$do_return == 1} {burn_write_image}
|
if {$do_return == 1} {burn_write_image}
|
||||||
@ -2576,6 +2562,29 @@ proc browse_tree_topic {adr_var_name} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Unescape &|^! from Bwidget tree browser
|
||||||
|
#
|
||||||
|
proc unescape_from_tree {text} {
|
||||||
|
return [string map [list "\{\{\}" "\{" "\{+\}" "&" "\{I\}" "|" \
|
||||||
|
"\{A\}" "^" "\{.\}" "!"] \
|
||||||
|
$text]
|
||||||
|
|
||||||
|
# <<< alternative encoding
|
||||||
|
# set escpd [string map [list "\\\\" "\\" "\\+" "&" "\\I" "|" \
|
||||||
|
# "\\A" "^" "\\." "!"] \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Escape &|^! which are special to BWidget Tree
|
||||||
|
#
|
||||||
|
proc escape_to_tree {text} {
|
||||||
|
return [string map [list "\{" "\{\{\}" "&" "\{+\}" "|" "\{I\}" \
|
||||||
|
"^" "\{A\}" "!" "\{.\}"] \
|
||||||
|
$text]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Accept the single selected item of the tree browser
|
# Accept the single selected item of the tree browser
|
||||||
# Called by the \"Accept\" button in the browser window.
|
# Called by the \"Accept\" button in the browser window.
|
||||||
#
|
#
|
||||||
@ -2586,7 +2595,8 @@ proc browse_tree_accept_sel {adr_var_name do_return tr} {
|
|||||||
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You must select a single tree item before clicking the \"Accept\" button."
|
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You must select a single tree item before clicking the \"Accept\" button."
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
browse_tree_accept $adr_var_name $do_return $tr $selected
|
browse_tree_accept $adr_var_name $do_return $tr \
|
||||||
|
[unescape_from_tree [lindex $selected 0]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2598,16 +2608,16 @@ proc browse_tree_accept_entry {adr_var_name do_return tr} {
|
|||||||
global debug_log_file execute_script_adr
|
global debug_log_file execute_script_adr
|
||||||
|
|
||||||
eval set text $$adr_var_name
|
eval set text $$adr_var_name
|
||||||
set selected [list $text]
|
browse_tree_accept $adr_var_name $do_return $tr $text
|
||||||
browse_tree_accept $adr_var_name $do_return $tr $selected
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Hand the variable from double click over to browse_tree_accept as list.
|
# Submit a Tree-escaped path to browse_tree_accept.
|
||||||
# Called by double click in browser tree
|
# Called by Double-click in browser.
|
||||||
#
|
#
|
||||||
proc browse_tree_accept_bindtext {adr_var_name do_return tr item} {
|
proc browse_tree_accept_escd {adr_var_name do_return tr escd_path} {
|
||||||
browse_tree_accept $adr_var_name $do_return $tr [list $item]
|
browse_tree_accept $adr_var_name $do_return $tr \
|
||||||
|
[unescape_from_tree $escd_path]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2708,7 +2718,7 @@ proc browse_tree_populate {which_fs} {
|
|||||||
if {$i == ""} {
|
if {$i == ""} {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
set path [combine_dir_and_name $path $i]
|
set path [combine_dir_and_name $path [escape_to_tree $i]]
|
||||||
$open_dir_cmd $w.tree $path
|
$open_dir_cmd $w.tree $path
|
||||||
catch {
|
catch {
|
||||||
$w.tree opentree $path 0
|
$w.tree opentree $path 0
|
||||||
@ -2748,9 +2758,10 @@ proc destroy_browse_disk {w} {
|
|||||||
# the hard disk filesystem.
|
# the hard disk filesystem.
|
||||||
#
|
#
|
||||||
proc browse_disk_open_dir {tr name} {
|
proc browse_disk_open_dir {tr name} {
|
||||||
if {[localfs_filetype $name] != "d"} {return ""}
|
set escpd [unescape_from_tree $name]
|
||||||
set lslist [localfs_ls $name]
|
if {[localfs_filetype $escpd] != "d"} {return ""}
|
||||||
browse_tree_fill_dir $tr $name $lslist
|
set lslist [localfs_ls $escpd]
|
||||||
|
browse_tree_fill_dir $tr $escpd $lslist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2765,9 +2776,10 @@ proc browse_disk_refresh {} {
|
|||||||
# the ISO model.
|
# the ISO model.
|
||||||
#
|
#
|
||||||
proc browse_iso_open_dir {tr name} {
|
proc browse_iso_open_dir {tr name} {
|
||||||
if {[isofs_filetype $name] != "d"} {return ""}
|
set escpd [unescape_from_tree $name]
|
||||||
set lslist [isofs_ls $name]
|
if {[isofs_filetype $escpd] != "d"} {return ""}
|
||||||
browse_tree_fill_dir $tr $name $lslist
|
set lslist [isofs_ls $escpd]
|
||||||
|
browse_tree_fill_dir $tr $escpd $lslist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2869,7 +2881,7 @@ proc browse_tree {adr_var which_fs} {
|
|||||||
|
|
||||||
# At least double-click does work
|
# At least double-click does work
|
||||||
$w.tree bindText <Double-Button-1> \
|
$w.tree bindText <Double-Button-1> \
|
||||||
"browse_tree_accept_bindtext $adr_var 1 $w.tree"
|
"browse_tree_accept_escd $adr_var 1 $w.tree"
|
||||||
|
|
||||||
$w.tree bindText <Button-3> {browse_tree_help "Browse tree" grey}
|
$w.tree bindText <Button-3> {browse_tree_help "Browse tree" grey}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2013.01.06.174508"
|
#define Xorriso_timestamP "2013.01.06.194655"
|
||||||
|
Loading…
Reference in New Issue
Block a user