view release on metacpan or search on metacpan
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
$progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("Inserting ").$numFound._T(" Items Into Tree..."),
$numFound,$self,wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME
) unless $progress;
#start timing
$begin=time();
#restart count if another progressdialog is passeed in
$progress->Update(0,_T("Inserting ").$numFound._T(" Items Into Tree..."));
my $percent=$max_progress/$numFound;
$cnt=0;
foreach $top_level ( sort( keys(%$tree) ) ){
next if $top_level eq '_items_in_tree_';
my $display=$top_level;
my $curParent=$self->AppendItem(
$self->GetRootItem(),
$top_level,$self->_get_status_icon($top_level));
foreach $item (sort(@{$tree->{$top_level}})){
$self->AppendItem($curParent,$top_level."::".$item,$self->_get_status_icon($item)) if ($curParent && $item);
last unless $progress->Update($cnt*$percent);
$cnt++;
}
}
# my $dummy=$self->AppendItem($self->GetRootItem(),'end');
# my $subDummy=$self->AppendItem($dummy,'end');
# $progress->Update($numFound+1);
$progress->Destroy();
my $inserted_time=time()-$begin;
Wx::LogMessage _T("Finished Inserting in ").sprintf("%d",($inserted_time/60)).":".($inserted_time % 60)."\n";
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
}
my %tree=();
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),
$max_pval,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my %allMods=%{$self->{cpan}->module_tree()}; #get all modules
my $total=keys(%allMods);
my $percent=$max_pval/($total||1); #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @allMods - for progressbar
my $numFound=0;
$progress->Update(0,_T("Step 1 of 2: Sorting All ").$total._T(" Modules...")); #start actual progress
#search through installed modules and insert them into the correct category
foreach $thisName (keys(%allMods)){
my $i=$allMods{$thisName};
if (!($i->is_uptodate || $i->installed_version)){
my ($top_level)=split('::',$thisName);
push (@{$tree{$top_level}}, ($thisName eq $top_level)?():$thisName); #add the item to the tree
$numFound++;
}
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
#store tree for later use
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
}
my %tree=();
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),
$max_pval,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my %allMods=%{$self->{cpan}->module_tree()}; #get all modules
my $total=keys(%allMods);
my $percent=$max_pval/($total||1); #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @allMods - for progressbar
$numFound=0;
$progress->Update(0,_T("Step 1 of 2: Categorizing All ").$total._T(" Modules...")); #start actual progress
#search through installed modules and insert them into the correct category
foreach $thisName (keys(%allMods)){
my $i=$allMods{$thisName};
if (!($i->is_uptodate || $i->installed_version)){
my $thisAuthor=$i->author()->cpanid." [".$i->author()->author."]";
my $cat_num=$self->{category_list}->{$thisName};
push (@{$tree{$thisAuthor}}, $thisName); #add the item to the tree
$numFound++;
}
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
#store tree for later use
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
Wx::LogMessage _T("[Done]");
return 1;
}
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),$max_pval,$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my %allMods=%{$self->{cpan}->module_tree()}; #get all modules
my $total=keys(%allMods);
my $percent=$max_pval/($total||1); #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @allMods - for progressbar
$numFound=0;
$progress->Update(0,_T("Step 1 of 2: Categorizing All ").$total.(" Modules...")); #start actual progress
#search through installed modules and insert them into the correct category
foreach $thisName (keys(%allMods)){
my $i=$allMods{$thisName};
my $cat_num=$self->{category_list}->{$thisName};
if (defined($cat_num) && !($i->is_uptodate || $i->installed_version)){
$cat_num=0 if ($cat_num==99); #don't use index 99, it make array too large
$cat_num=1 if ($i->module_is_supplied_with_perl_core() && $cat_num==2);
push (@{$tree{$self->{catNames}->[$cat_num]}}, $thisName); #add the item to the tree
$numFound++;
}
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
}
my %tree=();
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),
$max_pval,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my %allMods=%{$self->{cpan}->module_tree()}; #get all modules
my $total=keys(%allMods);
my $percent=$max_pval/($total||1); #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @allMods - for progressbar
$progress->Update(0,_T("Step 1 of 2: Sorting All ").$total._T(" Modules...")); #start actual progress
#search through installed modules and insert them into the correct category
foreach $thisName (keys(%allMods)){
my $i=$allMods{$thisName};
my ($top_level)=split('::',$thisName);
push (@{$tree{$top_level}}, ($thisName eq $top_level)?():$thisName); #add the item to the tree
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
#store tree for later use
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
}
my %tree=();
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),
$max_pval,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my %allMods=%{$self->{cpan}->module_tree()}; #get all modules
my $total=keys(%allMods);
my $percent=$max_pval/($total||1); #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @allMods - for progressbar
$progress->Update(0,_T("Step 1 of 2: Categorizing All ").$total._T(" Modules...")); #start actual progress
#search through installed modules and insert them into the correct category
foreach $thisName (keys(%allMods)){
my $i=$allMods{$thisName};
my $thisAuthor=$i->author()->cpanid." [".$i->author()->author."]";
my $cat_num=$self->{category_list}->{$thisName};
push (@{$tree{$thisAuthor}}, $thisName); #add the item to the tree
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
#store tree for later use
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
Wx::LogMessage _T("[Done]");
return 1;
}
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),$max_pval,$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my %allMods=%{$self->{cpan}->module_tree()}; #get all modules
my $total=keys(%allMods);
my $percent=$max_pval/($total||1); #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @allMods - for progressbar
$progress->Update(0,_T("Step 1 of 2: Categorizing All ").$total._T(" Modules...")); #start actual progress
#search through installed modules and insert them into the correct category
foreach $thisName (keys(%allMods)){
my $i=$allMods{$thisName};
my $cat_num=$self->{category_list}->{$thisName};
if (defined($cat_num)){
$cat_num=0 if ($cat_num==99); #don't use index 99, it make array too large
$cat_num=1 if ($i->module_is_supplied_with_perl_core() && $cat_num==2);
push (@{$tree{$self->{catNames}->[$cat_num]}}, $thisName); #add the item to the tree
}
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
return 0 unless $self->PopulateWithHash($self->{'tree_UpdatesByCategory'});
Wx::LogMessage _T("[Done]");
return 1;
}
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),$max_pval,$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my @installed=$self->{cpan}->installed(); #get installed modules
my $percent=$max_pval/@installed; #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @installed - for progressbar
my $numFound=0; #the number of modules that match CPAN to CPANPLUS::Installed
$progress->Update(0,_T("Step 1 of 2: Categorizing ").@installed._T(" Installed Modules...")); #start actual progress
#search through installed modules and insert them into the correct category
foreach $i (@installed){
unless ($i->is_uptodate()){
my $thisName=$i->name;
my $cat_num=$self->{category_list}->{$thisName};
if (defined($cat_num)){
$cat_num=0 if ($cat_num==99); #don't use index 99, it make array too large
$cat_num=1 if ($i->module_is_supplied_with_perl_core() && $cat_num==2);
push (@{$tree{$self->{catNames}->[$cat_num]}}, $thisName); #add the item to the tree
$numFound++; #increment the number of items that matched
}
}
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
return 1;
}
my %tree=();
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),
$max_pval,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my @installed=$self->{cpan}->installed(); #get installed modules
my $percent=$max_pval/@installed; #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @installed - for progressbar
my $numFound=0; #the number of modules that match CPAN to CPANPLUS::Installed
$progress->Update(0,_T("Step 1 of 2: Sorting ").@installed." Installed Modules..."); #start actual progress
#search through installed modules and insert them into the correct category
foreach $i (@installed){
unless ($i->is_uptodate()){
my $thisName=$i->name;
my $thisAuthor=$i->author()->cpanid." [".$i->author()->author."]";
my $cat_num=$self->{category_list}->{$thisName};
push (@{$tree{$thisAuthor}}, $thisName); #add the item to the tree
}
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
#store tree for later use
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
return 1;
}
my %tree=();
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),
$max_pval,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my @installed=$self->{cpan}->installed(); #get installed modules
my $percent=$max_pval/@installed; #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @installed - for progressbar
my $numFound=0; #the number of modules that match CPAN to CPANPLUS::Installed
$progress->Update(0,_T("Step 1 of 2: Sorting ").@installed." Installed Modules..."); #start actual progress
#search through installed modules and insert them into the correct category
foreach $i (@installed){
unless ($i->is_uptodate()){
my $thisName=$i->name;
my ($top_level)=split('::',$thisName);
push (@{$tree{$top_level}}, ($thisName eq $top_level)?():$thisName); #add the item to the tree
}
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
#store tree for later use
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
return 1;
}
my %tree=();
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),
$max_pval,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my @installed=$self->{cpan}->installed(); #get installed modules
my $percent=$max_pval/@installed; #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @installed - for progressbar
my $numFound=0; #the number of modules that match CPAN to CPANPLUS::Installed
$progress->Update(0,_T("Step 1 of 2: Sorting ").@installed._T(" Installed Modules...")); #start actual progress
#search through installed modules and insert them into the correct category
foreach $i (@installed){
my $thisName=$i->name;
my ($top_level)=split('::',$thisName);
push (@{$tree{$top_level}}, ($thisName eq $top_level)?():$thisName); #add the item to the tree
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
#store tree for later use
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
return 1;
}
my %tree=();
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new("Setting Up List...",
"CPANPLUS is getting information...",
$max_pval,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my @installed=$self->{cpan}->installed(); #get installed modules
my $percent=$max_pval/@installed; #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @installed - for progressbar
my $numFound=0; #the number of modules that match CPAN to CPANPLUS::Installed
$progress->Update(0,_T("Step 1 of 2: Sorting ").@installed._T(" Installed Modules...")); #start actual progress
#search through installed modules and insert them into the correct category
foreach $i (@installed){
my $thisName=$i->name;
my $thisAuthor=$i->author()->cpanid." [".$i->author()->author."]";
my $cat_num=$self->{category_list}->{$thisName};
push (@{$tree{$thisAuthor}}, $thisName); #add the item to the tree
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
#store tree for later use
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
}
my %tree=();
my $max_pval=10000; #the maximum value of the progress bar
my $progress=Wx::ProgressDialog->new(_T("Setting Up List..."),
_T("CPANPLUS is getting information..."),
10000,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my @installed=$self->{cpan}->installed(); #get installed modules
my $percent=$max_pval/@installed; #number to increment progress by
my $begin=time(); #for timing loops
my $cnt=0; #the count of current index of @installed - for progressbar
my $numFound=0; #the number of modules that match CPAN to CPANPLUS::Installed
$progress->Update(0,_T("Step 1 of 2: Categorizing ").@installed._T(" Installed Modules...")); #start actual progress
#search through installed modules and insert them into the correct category
foreach $i (@installed){
my $thisName=$i->name;
my $cat_num=$self->{category_list}->{$thisName};
$progress->Update($cnt*$percent);
# "Step 1 of 2: Categorizing ".@installed." Installed Modules...#$cnt : ".$i->name);
if (defined($cat_num)){
$cat_num=0 if ($cat_num==99); #don't use index 99, it make array too large
$cat_num=1 if ($i->module_is_supplied_with_perl_core() && $cat_num==2);
push (@{$tree{$self->{catNames}->[$cat_num]}}, $thisName); #add the item to the tree
$numFound++; #increment the number of items that matched
}
unless ($progress->Update($cnt*$percent)){
$progress->Destroy();
return 0;
}
$cnt++; #increment current index in @installed
}
#end timing method
my $end=time();
Wx::LogMessage _T("Finished Sorting in ").sprintf("%d",(($end-$begin)/60)).":".(($end-$begin) % 60)."\n";
#store tree for later use
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
$type= lc($type);
my $mparent=$self->GetRootItem();
my @names=();
my $numFound=0;
my $tmpCnt=1;
$modules={};
if ($type eq 'any' || $type eq 'all'){
my @modterms=CPANPLUS::Module::accessors(); #('name','version','path','comment','package','description','dslip','status');
my @authterms=CPANPLUS::Module::Author::accessors(); #('author','cpanid','email');
my $percent = MAX_PROGRESS_VALUE/(@modterms+@authterms);
my $count=0;
foreach $term (@modterms){
if ($progress->Update($percent*($count++),_T("Searching in $term: Found ").keys(%$modules)._T(" items"))){
foreach $m ($self->{cpan}->search(type => $term, allow => \@search)){
if ($m->isa(CPANPLUS::Module)){
#print "module: ".$m->name." [".($percent*($count++)/MAX_PROGRESS_VALUE)."]\n";
$modules->{$m->name} = $m;
}
if ($m->isa(CPANPLUS::Module::Author)){
foreach $amod ($m->modules()){
#print "amodule: ".$m->name." [".($percent*($count++)/MAX_PROGRESS_VALUE)."]\n";
$modules->{$amod->name} = $amod;
}
}
}
}else{$progress->Destroy();return;}
}
}else{
foreach $m ($self->{cpan}->search(type => $type, allow => \@search)){
return unless $progress->Update(MAX_PROGRESS_VALUE-1,_T("Found ").keys(%$modules)._T(" items"));
$modules->{$m->name}=$m;
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
my $progress=shift || Wx::ProgressDialog->new(_T("Please Wait..."),
_T("Displaying List..."),
MAX_PROGRESS_VALUE,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my $modules=shift;
my @names=();
my $count=0;
my $numFound=keys(%$modules);
return unless $numFound>0;
my $percent=MAX_PROGRESS_VALUE / $numFound;
return unless $progress->Update(0,_T("Getting info for $numFound items."));
my $newTree={};
#get information from modules
foreach $modname (keys(%$modules)){
last unless $progress->Update($percent*$count);
if ($modules->{$modname}->isa('CPANPLUS::Module')){
my @names=split('::',$modname);
my $ref=$newTree;
foreach $n (@names){
$ref=$ref->{$n}='';
# push(@names,$modname);
}
}
if ($modules->{$modname}->isa('CPANPLUS::Module::Author')){
foreach $m ($modules->{$modname}->modules()){
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
#populate the tree ctrl
return unless $progress->Update(0,_T("Populating tree with ").$numFound._T(" items.") );
$count=0;
# my $dummy=$self->AppendItem($self->GetRootItem(),'Modules');
# foreach $item (sort {lc($a) cmp lc($b)} @names){
# $self->AppendItem($dummy,$item,$self->_get_status_icon($item));
# $count++;
# }
foreach $k (sort(keys(%$newTree))){
return unless $progress->Update($percent*$count);
my $parent=$self->AppendItem($self->GetRootItem(),$item,$self->_get_status_icon($item));
my $ref=$newTree->{$k};
while($ref){
}
$count++;
}
# my $dummy=$self->AppendItem($self->GetRootItem(),'end');
# my $subDummy=$self->AppendItem($dummy,'end');
# $self->EnsureVisible($dummy);
lib/CPANPLUS/Shell/Wx/ModuleTree.pm view on Meta::CPAN
_T("Displaying List..."),
MAX_PROGRESS_VALUE,
$self,
wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME);
my $totalFound=shift;
return unless $totalFound;
my $numFound=$totalFound;
my @modules=@_;
my @names=();
my $count=0;
my $percent=MAX_PROGRESS_VALUE/$totalFound;
return unless $progress->Update(0,_T("Getting info for $numFound items."));
#get information from modules
foreach $mod (@modules){
last unless $progress->Update($percent*$count);
if ($mod->isa('CPANPLUS::Module')){
push(@names,$mod->name);
}
if ($mod->isa('CPANPLUS::Module::Author')){
foreach $m ($mod->modules()){
push(@names,$m->name);
}
}
$count++;
}
#populate the tree ctrl
return unless $progress->Update(0,_T("Populating tree with").$totalFound._T(" items.") );
$count=0;
foreach $item (sort {lc($a) cmp lc($b)} @names){
return unless $progress->Update($percent*$count);
$self->AppendItem($self->GetRootItem(),$item,$self->_get_status_icon($item));
$count++;
}
return 1;
}
#this method returns the index in the imageList for the status of the passed name
sub _get_status_icon{
my $self=shift;
my ($name)=@_;
lib/CPANPLUS/Shell/Wx/util.pm view on Meta::CPAN
return $ret;
}
#TODO this method populates a tree with the correct status icon
sub _uPopulateModulesWithIcons{
my $max_pval=10000; #the maximum value of the progress bar
my $tree=shift;
my $parent=shift;
my $aref=shift;
my $progress = shift;
my $percent=shift || $max_pval/(@{%$tree}/2);
my $cnt=shift || 0;
$progress=Wx::ProgressDialog->new(_T("Inserting Items..."),
_T("Inserting Items Into List..."),
$max_pval,
$self,
wxPD_APP_MODAL) unless $progress;
#remove all items if we are stating anew
$tree->DeleteChildren($tree->GetRootItem()) unless $cnt;
foreach $items ( sort {lc $a cmp lc $b} keys(%$tree) ){
my $curParent=$tree->AppendItem(
$self->GetRootItem(),
$top_level,_uGetStatusIcon($top_level));
$progress->Update($cnt*$percent); #,"[Step 2 of 2] Iserting ".keys(%tree)." Authors Into Tree...#$cnt : $top_level");
foreach $item (sort(@{$tree{$top_level}})){
if (keys(%$item)){
my $new_parent=$self->AppendItem($curParent,(keys(%$item))[0],$self->_get_status_icon($item)) if ($curParent && $item);
$cnt++;
$progress->Update($cnt*$percent);
$cnt=_uPopulateModulesWithIcons($tree,$new_parent,$item,$progress,$percent,$cnt);
}else{
my $new_parent=$self->AppendItem($curParent,$item,$self->_get_status_icon($item)) if ($curParent && $item);
$progress->Update($cnt*$percent);
$cnt++;
}
}
}
return $cnt;
#$progress->Destroy();
}
sub _uGetInstallPath{
my $file=shift;