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

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

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (9)
    As of 2018-04-24 14:57 GMT
    Find Nodes?
      Voting Booth?