Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Handle NodeStatus in a variable, for speed. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c6bb079eec016156b97759442a415a7c |
User & Date: | peter 2018-10-20 20:29:08.458 |
Context
2019-02-04
| ||
15:52 | Handle a dir name with -review. check-in: 8ecbca03a0 user: peter tags: trunk | |
2018-10-20
| ||
20:29 | Handle NodeStatus in a variable, for speed. check-in: c6bb079eec user: peter tags: trunk | |
20:28 | Handle different user name. check-in: bc38ecca6e user: peter tags: trunk | |
Changes
Changes to src/dirdiff.tcl.
︙ | ︙ | |||
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | variable AfterId "" variable DebugCh "" variable DebugTime {} variable PauseBgProcessing 0 variable ScheduledRestart 0 variable AfterTime 1 variable IdleQueue {} variable IdleQueueArr variable leftMark "" variable rightMark "" variable leftDir "" variable rightDir "" variable protect {left 0 right 0} constructor {args} { | > > | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | variable AfterId "" variable DebugCh "" variable DebugTime {} variable PauseBgProcessing 0 variable ScheduledRestart 0 variable AfterTime 1 variable WorkTime 200 variable IdleQueue {} variable IdleQueueArr variable NodeStatus variable leftMark "" variable rightMark "" variable leftDir "" variable rightDir "" variable protect {left 0 right 0} constructor {args} { |
︙ | ︙ | |||
462 463 464 465 466 467 468 469 470 471 472 473 474 475 | if {$d1 eq $d2} { $tree cellconfigure $topIndex,structure -text $d1 } else { $tree cellconfigure $topIndex,structure -text "$d1 vs $d2" } $tree cellconfigure $topIndex,structure -image $::img(open) $tree rowattrib $topIndex type directory $self SetNodeStatus $topIndex empty $tree rowattrib $topIndex leftfull $leftDir $tree rowattrib $topIndex rightfull $rightDir $self UpdateDirNode $topIndex } | > | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | if {$d1 eq $d2} { $tree cellconfigure $topIndex,structure -text $d1 } else { $tree cellconfigure $topIndex,structure -text "$d1 vs $d2" } $tree cellconfigure $topIndex,structure -image $::img(open) $tree rowattrib $topIndex type directory set NodeStatus($topIndex) "" $self SetNodeStatus $topIndex empty $tree rowattrib $topIndex leftfull $leftDir $tree rowattrib $topIndex rightfull $rightDir $self UpdateDirNode $topIndex } |
︙ | ︙ | |||
508 509 510 511 512 513 514 | method PruneEqual {} { $self busyCursor set todo [$tree childkeys root] while {[llength $todo] > 0} { set todoNow $todo set todo {} foreach node $todoNow { | | | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | method PruneEqual {} { $self busyCursor set todo [$tree childkeys root] while {[llength $todo] > 0} { set todoNow $todo set todo {} foreach node $todoNow { set status $NodeStatus($node) if {$status eq "equal"} { $tree delete $node } else { lappend todo {*}[$tree childkeys $node] } } } |
︙ | ︙ | |||
858 859 860 861 862 863 864 | } if {$sts} { lappend errors $node $err break } # Work for at least 200 ms to keep things efficient set post [clock clicks -milliseconds] | > | | 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | } if {$sts} { lappend errors $node $err break } # Work for at least 200 ms to keep things efficient set post [clock clicks -milliseconds] #puts "$pre $post [expr {$post - $pre}]" if {($post - $pre) > $WorkTime} break } #if {($post - $pre) > 1000} { #puts "[expr $post - $pre] ms for [$tree set $node leftfull]" #} # Update the status variable to track progress if {$options(-statusvar) ne ""} { |
︙ | ︙ | |||
908 909 910 911 912 913 914 | set statusvar "" set AfterId "" } } method SetNodeStatus {node status} { variable color | | | | | | | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | set statusvar "" set AfterId "" } } method SetNodeStatus {node status} { variable color set old $NodeStatus($node) if {$old eq $status} return set NodeStatus($node) $status $tree rowconfigure $node -foreground $color($status) \ -selectforeground $color($status) #puts "Set [$tree item $node -text] to $status" # Loop through children to update parent set parent [$tree parentkey $node] if {$parent eq "" || $parent eq "root"} { return } # If this is only present on one side, there is no need to update set lf [$tree rowattrib $parent leftfull] set rf [$tree rowattrib $parent rightfull] if {$lf eq "" || $rf eq ""} { return } # If parent is being filled, do not update yet if {$NodeStatus($parent) eq "unknown2"} { return } set pstatus equal foreach child [$tree childkeys $parent] { set status $NodeStatus($child) switch $status { unknown - unknown2 { set pstatus unknown } new - old - change { set pstatus change break } } } $self SetNodeStatus $parent $pstatus } method UpdateDirNode {node} { if {[$tree rowattrib $node type] ne "directory"} { return } if {$NodeStatus($node) ne "empty"} { #puts "Dir [$tree set $node leftfull] already done" return } $tree delete [$tree childkeys $node] set leftfull [$tree rowattrib $node leftfull] set rightfull [$tree rowattrib $node rightfull] |
︙ | ︙ | |||
1028 1029 1030 1031 1032 1033 1034 | # TODO: Configurable large file value? if {$size1 > 1000000 && $size2 > 1000000} { set largeFile 1 } } set id [$tree insertchild $node end $values] $tree rowattrib $id type $type | | | 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | # TODO: Configurable large file value? if {$size1 > 1000000 && $size2 > 1000000} { set largeFile 1 } } set id [$tree insertchild $node end $values] $tree rowattrib $id type $type set NodeStatus($id) unknown $tree rowattrib $id leftfull $df1 $tree rowattrib $id rightfull $df2 $tree rowattrib $id largefile $largeFile if {$type ne "directory"} { if {$type eq "link"} { $tree cellconfigure $id,structure -image $::img(link) } else { |
︙ | ︙ | |||
1054 1055 1056 1057 1058 1059 1060 | $self SetNodeStatus $id new } elseif {$size2 == ""} { $self SetNodeStatus $id old } else { $self SetNodeStatus $id unknown $self AddNodeToIdle $id } | | | | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 | $self SetNodeStatus $id new } elseif {$size2 == ""} { $self SetNodeStatus $id old } else { $self SetNodeStatus $id unknown $self AddNodeToIdle $id } return $NodeStatus($id) } method addCmdCol {tbl row col w} { variable widgets set key [$tree getfullkeys $row] set status $NodeStatus($key) set type [$tree rowattrib $row type] set lf [$tree rowattrib $row leftfull] set rf [$tree rowattrib $row rightfull] set bg [$tbl cget -background] ttk::style configure Apa.TFrame -background $bg ttk::style configure Apa.My.Toolbutton -background $bg ttk::frame $w -style Apa.TFrame |
︙ | ︙ |
Changes to src/eskil.syntax.
︙ | ︙ | |||
103 104 105 106 107 108 109 | # This is the annotation needed for this object definition ##nagelfar syntax DirCompareTree dc=_obj,DirCompareTree p* ##nagelfar option DirCompareTree -leftdirvariable -rightdirvariable -statusvar ##nagelfar return DirCompareTree _obj,DirCompareTree ##nagelfar subcmd+ _obj,DirCompareTree text newLine | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | # This is the annotation needed for this object definition ##nagelfar syntax DirCompareTree dc=_obj,DirCompareTree p* ##nagelfar option DirCompareTree -leftdirvariable -rightdirvariable -statusvar ##nagelfar return DirCompareTree _obj,DirCompareTree ##nagelfar subcmd+ _obj,DirCompareTree text newLine ##nagelfar implicitvarns snit::widget::DirCompareTree self\ _obj,DirCompareTree hull win self tree hsb vsb options AfterId PauseBgProcessing IdleQueue IdleQueueArr leftMark rightMark leftDir rightDir protect ScheduledRestart img AfterTime DebugCh DebugTime NodeStatus WorkTime ########################################################## # This is the annotation needed for this object definition ##nagelfar syntax ttk::entryX dc=_obj,entryX p* ##nagelfar option ttk::entryX -width -textvariable -style ##nagelfar option ttk::entryX\ -textvariable n |
︙ | ︙ |