Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
i made a code that creates thumbnails of pictures using the iconview widget. problem is, when opening many (20++) pictures (2000++px x 2000++px) it turns out to be slow. is there a way to open a folder even if the pictures are still loading? would progressive loading help?
my @selection_list = (); my $liststore = Gtk2::ListStore->new("Glib::String","Glib::String","Gt +k2::Gdk::Pixbuf","Glib::Int","Glib::Int","Gtk2::Gdk::Pixbuf"); my $iconview = Gtk2::IconView->new_with_model($liststore); sub browse_files { # SEARCH FOR FOLDERS # $iconview->set('visible',0); my $path = $_[0]; my $new_path = $path; print $path , "\n"; use Encode; opendir my $dh, $path or warn "Error: $!"; my @files = grep !/^\.\.?$/, readdir $dh; closedir $dh; @files = map { decode( 'utf8', "$path/".$_ ) } sort @files; my @files_t=(); foreach my $file (@files) { $file =~ s|//|/|g; (my $text = $file ) =~ s|^.*/||g; if (-d $file) { my $folder_pixbuf_t = Gtk2::Gdk::Pixbuf->new_from_file("ic +ons/folder_green.png"); my $rowiter = $liststore->append; $liststore->set_value($rowiter,0,substr($file,length($path +)+1,length($file) - length($path))); $liststore->set_value($rowiter,1,$file); $liststore->set_value($rowiter,2,$folder_pixbuf_t); $liststore->set_value($rowiter,3,1); $liststore->set_value($rowiter,4,0); push @files_t, $file; } } foreach my $file (@files) { $file =~ s|//|/|g; (my $text = $file ) =~ s|^.*/||g; if( uc($file) =~ /.*\.(PNG|JPG|GIF|JPEG)$/ ){ my $isselected = 0; foreach my $x_t (@selection_list){ if($file eq $x_t){ $isselected=1; } } my $folder_pixbuf_t = Gtk2::Gdk::Pixbuf->new_from_file_at_ +scale($file,100,100,1); my $backup_pixbuf_t = $folder_pixbuf_t->copy; my $rowiter = $liststore->append; if($isselected==1){ my $bookmark_t = Gtk2::Gdk::Pixbuf->new_from_file("ico +ns/bookmarks2.png"); $bookmark_t->composite($folder_pixbuf_t,0,0,22,22,0,0, +1,1,'nearest',255); } $liststore->set_value($rowiter,0,substr($file,length($path +)+1,length($file) - length($path))); $liststore->set_value($rowiter,1,$file); $liststore->set_value($rowiter,2,$folder_pixbuf_t); $liststore->set_value($rowiter,3,0); if($isselected==1){ $liststore->set_value($rowiter,4,1); }else{ $liststore->set_value($rowiter,4,0); } $liststore->set_value($rowiter,5,$backup_pixbuf_t); push @files_t, $file; } } $iconview->set('visible',1); return @files_t; }

In reply to how to speed up image file loading with gtk2 iconview? by renegadex

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (5)
    As of 2014-09-20 02:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (151 votes), past polls