254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
|
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
+
+
+
+
+
+
+
+
+
+
|
variable ScheduledRestart 0
variable IdleQueue {}
variable IdleQueueArr
variable leftMark ""
variable rightMark ""
variable leftDir ""
variable rightDir ""
variable img
constructor {args} {
variable color
install tree using tablelist::tablelist $win.tree -height 20 \
-movablecolumns no -setgrid no -showseparators yes \
-expandcommand [mymethod expandCmd] \
-collapsecommand [mymethod collapseCmd] \
-fullseparators yes \
-columns {0 "Structure" 0 Size 0 Date 0 Size 0 Date}
install vsb using scrollbar $win.vsb -orient vertical \
-command "$tree yview"
install hsb using scrollbar $win.hsb -orient horizontal \
-command "$tree xview"
# Use demo images from Tablelist
set dir $::eskil(thisDir)/../lib/tablelist/demos
set img(clsd) [image create photo -file [file join $dir clsdFolder.gif]]
set img(open) [image create photo -file [file join $dir openFolder.gif]]
set img(file) [image create photo -file [file join $dir file.gif]]
set AfterId ""
set IdleQueue {}
$tree configure -yscrollcommand "$vsb set" -xscrollcommand "$hsb set"
$tree columnconfigure 0 -name structure
$tree columnconfigure 1 -name leftsize -align right
|
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
|
+
+
+
+
+
+
+
+
+
+
+
|
set d1 [file tail $leftDir]
set d2 [file tail $rightDir]
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
}
method expandCmd {tbl row} {
if {[$tree childcount $row] != 0} {
$tree cellconfigure $row,0 -image $img(open)
}
}
method collapseCmd {tbl row} {
$tree cellconfigure $row,0 -image $img(clsd)
}
# Format a time stamp for display
proc FormatDate {date} {
clock format $date -format "%Y-%m-%d %H:%M:%S"
}
# Remove all equal nodes from tree
|
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
|
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
|
+
+
|
$size2 $time2]
}
set id [$tree insertchild $node end $values]
$tree rowattrib $id type $type
$tree rowattrib $id status unknown
$tree rowattrib $id leftfull $df1
$tree rowattrib $id rightfull $df2
$tree cellconfigure $id,structure -image $img(file)
if {$type eq "directory"} {
## Make it so that this node is openable
$tree collapse $id
#$tree insertchild $id end dummy ;# a dummy
$tree cellconfigure $id,structure -text $name/
$self SetNodeStatus $id empty
$self AddNodeToIdle $id
$tree cellconfigure $id,structure -image $img(clsd)
} elseif {$size1 == $size2 && \
$time1 == $time2} {
$self SetNodeStatus $id equal
} elseif {$size1 == ""} {
$self SetNodeStatus $id new
} elseif {$size2 == ""} {
$self SetNodeStatus $id old
|