source: extensions/pLoader/trunk/src/Uploader/GUI/wxImageProcessingProgressDlg.pm @ 4096

Last change on this file since 4096 was 2728, checked in by ronosman, 16 years ago

Feature added : auto rotate image using exif metadata
Feature added : upload in high resolution
Improved user feedback in upload progress dialog

  • Property svn:eol-style set to LF
File size: 3.5 KB
Line 
1# +-----------------------------------------------------------------------+
2# | pLoader - a Perl photo uploader for Piwigo                            |
3# +-----------------------------------------------------------------------+
4# | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
5# +-----------------------------------------------------------------------+
6# | This program is free software; you can redistribute it and/or modify  |
7# | it under the terms of the GNU General Public License as published by  |
8# | the Free Software Foundation                                          |
9# |                                                                       |
10# | This program is distributed in the hope that it will be useful, but   |
11# | WITHOUT ANY WARRANTY; without even the implied warranty of            |
12# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
13# | General Public License for more details.                              |
14# |                                                                       |
15# | You should have received a copy of the GNU General Public License     |
16# | along with this program; if not, write to the Free Software           |
17# | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
18# | USA.                                                                  |
19# +-----------------------------------------------------------------------+
20package Uploader::GUI::wxImageProcessingProgressDlg;
21use strict;
22use Wx qw/
23             wxDefaultSize
24             wxDefaultPosition
25             wxID_CANCEL
26             wxID_OK
27             wxGREEN
28         /;
29use base qw/Wx::Dialog Class::Accessor::Fast/;
30use Wx::Event qw/
31                    EVT_UPDATE_UI
32                    EVT_BUTTON
33                /;
34
35__PACKAGE__->mk_accessors( 
36    qw/
37           btok
38           gauge
39           progress
40           processing
41           txtprocessing
42           image
43           cancelled
44      / 
45);
46use Carp;
47
48sub new {
49    my ($this, $params) = @_;
50    #on recupere le nom de la classe en fonction du type d'appel de la méthode.
51    my $class = ref($this) || $this;
52
53
54    my $self = $class->SUPER::new( undef, -1, $params->{title}, wxDefaultPosition, wxDefaultSize);
55    # load controls
56    eval {
57      &main::ProcessingProgress($self, 1);
58
59    $self->_initEventHandlers();
60   
61    $self->btok( $self->FindWindow($main::ID_PROGRESS_OK) );
62    $self->gauge( $self->FindWindow($main::ID_PROGRESS_GAUGE) );
63    $self->txtprocessing( $self->FindWindow($main::ID_PROGRESS_TXT) );
64    $self->image( $self->FindWindow($main::ID_STATICBITMAP) );
65    $self->gauge->SetForegroundColour(wxGREEN);
66    };
67
68    $self->btok->SetLabel(
69        $params->{bt_label}||'Cancel'
70    );
71
72    if($@){
73        Wx::LogMessage("Error during dialogbox initialization");
74    }
75    $self;   
76}
77
78
79sub _initEventHandlers {
80    my ( $self ) = @_;
81   
82    EVT_BUTTON( $self, $main::ID_PROGRESS_OK, \&OnOK );
83   
84       
85}
86
87# Update progress information
88sub LogProgress {
89    my ( $self ) = @_;
90   
91    croak "Cancelled by user\n" if $self->cancelled;   
92   
93    $self->txtprocessing->SetLabel(
94        $self->processing
95    );
96    $self->gauge->SetValue(
97        $self->progress
98    );
99}
100
101sub DisplayEndInfo {
102    my ( $self, $msg ) = @_;
103
104    $self->txtprocessing->SetLabel(
105        $msg
106    );
107    $self->image->Show(0);
108    $self->gauge->Show(0);
109
110    $self->btok->SetLabel(
111        'Close'
112    );
113       
114}
115
116sub OnOK {
117    my ( $self, $event ) = @_;
118   
119    $self->cancelled(1);
120    $self->Destroy;
121 
122}
123
124
1251;
Note: See TracBrowser for help on using the repository browser.