First, I do this:
proc p0.StartUp.SetUpIcons {} {
set ::BaseVars_WindowIconFile "$::BaseVars_iconsdir/eye5.png"
set ::BaseVars_WindowIconFile [image create photo -file $::BaseVars_WindowIconFile]
wm iconphoto . -default $::BaseVars_WindowIconFile
load "$::BaseVars_iconsdir/
libtksvg0.12.so"
set ::CustomVars_IconFile_Dir_Close "$::BaseVars_iconsdir/folder_closed3.svg"
set ::CustomVars_IconFile_Dir_Open "$::BaseVars_iconsdir/folder_open3.svg"
set ::CustomVars_IconFile_CommonFile "$::BaseVars_iconsdir/file_black.svg"
set ::CustomVars_IconFile_Skinny "$::BaseVars_iconsdir/skinny.svg"
set iconsize $::GUIoptions_IconSize
set ::CustomVars_Image_IconFile_Dir_Close \
[image create photo ::CustomVars_IconFile_Dir_Close -file "$::CustomVars_IconFile_Dir_Close" -format "svg -scaletoheight $iconsize"]
set ::CustomVars_Image_IconFile_Dir_Open \
[image create photo ::CustomVars_IconFile_Dir_Open -file "$::CustomVars_IconFile_Dir_Open" -format "svg -scaletoheight $iconsize"]
set ::CustomVars_Image_IconFile_CommonFile \
[image create photo ::CustomVars_IconFile_CommonFile -file $::CustomVars_IconFile_CommonFile -format "svg -scaletoheight $iconsize"]
set ::CustomVars_Image_IconFile_Skinny \
[image create photo ::CustomVars_IconFile_Skinny -file $::CustomVars_IconFile_Skinny -format "svg -scaletoheight $iconsize"]
}
There is also this relevant proc:
p.GUI.InsertCorrectIcon {widget type target}
It's long and tedious, let's see just one part of it, it should
be enough:
if {$type == "typedir"} {
if {[file exists $::CustomVars_IconFile_Dir_Close]} {
$widget image create end -image $::CustomVars_Image_IconFile_Dir_Close
$widget insert end { }
} else {$widget insert end {D}}
return
}
OK. Then later on I build boxes with a file listing:
foreach line $organizedlist {
set insw $::Widgets_unipane.fileListPane.filenameframe.box
p.GUI.InsertCorrectIcon $insw [lindex $line 0] [lindex $line 1]
$insw insert end "[lindex $line 1]\n"
set insw $::Widgets_unipane.fileListPane.sizeframe.box
p.GUI.InsertCorrectIcon $insw [lindex $line 0] "___!SKINNY_ICON!___"
$insw insert end "[p.Utils.FormatUnits [lindex $line 2]]\n"
set insw $::Widgets_unipane.fileListPane.dateframe.box
p.GUI.InsertCorrectIcon $insw [lindex $line 0] "___!SKINNY_ICON!___"
$insw insert end "[clock format [lindex $line 3] -format "%Y-%m-%d %H:%M:%S"]\n"
set insw $::Widgets_unipane.fileListPane.permissionframe.box
p.GUI.InsertCorrectIcon $insw [lindex $line 0] "___!SKINNY_ICON!___"
$insw insert end "[p.Utils.Deoctalize [lindex $line 4]]\n"
set insw $::Widgets_unipane.fileListPane.ownerframe.box
p.GUI.InsertCorrectIcon $insw [lindex $line 0] "___!SKINNY_ICON!___"
$insw insert end "[lindex $line 5]\n"
}
And it all seemed to work so well until I "opened" a large directory.
Then it all gets pretty ugly.
For example, I have this directory with 3,000 items. My application
takes 5 seconds to "load" that directory. The delay is quite noticeable.
And it gets worse. I have another directory inside ~/Mail, one of my
oldest email accounts, with 12,500 items. My application takes a full
minute to load that directory. For comparison, SpaceFM takes 8 seconds
and PCManFM takes 3 seconds.
My application can load that huge directory almost instantaneously if I
disable the icons. It's clear the icons slow everything down. Badly.
But they are important aesthetically.
Is there some way around this problem? Can I make it faster?
Much, much faster?
--
Luc
>>