Ignore:
Timestamp:
Oct 9, 2008, 10:58:41 PM (16 years ago)
Author:
ronosman
Message:

Features added:

  • Cancel during upload or file processing
  • Auto rotate
  • Upload high resolution
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extras/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm

    r2661 r2696  
    2020package Uploader::GUI::wxFrameAUI;
    2121use strict;
     22use Carp;
    2223use Wx;
    2324use Wx::DND;
     
    5859             wxMAXIMIZE
    5960             wxOK
    60              wxICON_EXCLAMATION
     61             wxICON_EXCLAMATION
     62             wxICON_INFORMATION
    6163         /;
    6264use base qw/Wx::Frame Class::Accessor::Fast/;
     
    137139    );
    138140
     141    $self->imagelist->SetNewFilesDisplayEndInfoCallback(
     142        sub { $self->SetNewFilesDisplayEndInfo(@_) }
     143    );
     144
     145
    139146    # callback for GUI refresh : remove thumbnail images from imageviewer control
    140147    $self->imagelist->UploadImagesViewerCallback(
     
    142149    );
    143150
     151
     152
    144153    # callback for GUI refresh : progress dialog display current uploaded image
    145154    $self->imagelist->UploadImagesProgressCallback(
    146155        sub { $self->UploadImagesProgress(@_) }
     156    );
     157   
     158    $self->imagelist->UploadDisplayEndInfoCallback(
     159        sub { $self->UploadDisplayEndInfo(@_) }
    147160    );
    148161
     
    212225                parentwnd => $self,
    213226                accessors => {
     227                                  $main::ID_PHOTO =>
     228                                      sub {
     229                                            Wx::Bitmap->new(
     230                                                $self->imagelist->current_image->wx_thumb_file,
     231                                                $self->GetWxBitmapType($self->imagelist->type),
     232                                            );
     233                                      },
    214234                                  $main::ID_PHOTO_NAME =>
    215235                                      sub { $self->imagelist->current_image->site_name(@_) },
     
    419439                                      sub { $self->imagelist->resize_w(@_) },
    420440                                  $main::ID_GLOBAL_RESIZED_H =>
    421                                       sub { $self->imagelist->resize_h(@_) },
     441                                      sub { $self->imagelist->resize_h(@_) },
     442                                  $main::ID_GLOBAL_HIGH =>
     443                                      sub { $self->imagelist->upload_high(@_)},
    422444                             },
    423445                frame_callbacks => {
     
    621643        Uploader::GUI::wxImageProcessingProgressDlg->new(
    622644            {
    623                 title => "Image processing progress information",
     645                title => "Image processing progress information",
     646                bt_label => "Cancel image processing",
    624647             }
    625648        )       
     
    715738    my( $self, $event ) = @_;
    716739 
    717     my $id = $event->GetItem;
    718 
    719740    my $image = $self->imagelist->images->[$event->GetIndex];
    720741    $image->site_name(
     
    745766    my( $self, $event ) = @_;
    746767
    747    
    748     $self->ProcessImageSelection();   
     768#    eval {
     769        $self->ProcessImageSelection();   
     770#    };
    749771}
    750772
     
    761783sub UploadImagesProgress {
    762784    my ( $self ) = @_; 
    763 
     785   
    764786    my $imagelist = $self->imagelist ;
    765787
     
    786808        $self->upload_progressdlg->LogProgress();
    787809    };
     810    if($@){
     811        croak "Upload cancelled.\n";
     812    }
     813   
    788814    Wx::Yield();
    789815
     816}
     817
     818
     819sub SetNewFilesDisplayEndInfo {
     820    my ( $self ) = @_; 
     821       
     822    $self->progressdlg->DisplayEndInfo;
     823}
     824
     825sub UploadDisplayEndInfo {
     826    my ( $self ) = @_; 
     827   
     828    my $imagelist = $self->imagelist ;
     829   
     830    $self->upload_progressdlg->DisplayEndInfo;
    790831}
    791832
     
    849890            Uploader::GUI::wxImageProcessingProgressDlg->new(
    850891                {
    851                     title => "Image upload progress information",
     892                    title => "Image upload progress information",
     893                    bt_label => "Cancel upload",
    852894                 }
    853895            )       
    854896        );
     897        # modeless dialog
    855898        $self->upload_progressdlg->Show(1);
    856899        Wx::Yield();
    857         $self->imagelist->UploadSelection;
     900        eval {
     901            $self->imagelist->UploadSelection;
     902        };
     903        if($@){
     904            Wx::MessageBox(
     905                sprintf(
     906                    "Upload cancelled.",
     907                ),
     908                "Piwigo upload information",
     909                wxOK | wxICON_INFORMATION,
     910            );
     911        }
    858912    }
    859913    else {
Note: See TracChangeset for help on using the changeset viewer.