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

Last change on this file since 4718 was 4718, checked in by ronosman, 14 years ago

Feature 1389 added : remove AUI docking manager

  • Property svn:eol-style set to LF
File size: 4.2 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             wxDIALOG_NO_PARENT
29             wxDEFAULT_DIALOG_STYLE
30
31             wxMAXIMIZE_BOX
32             wxMINIMIZE_BOX
33 
34             wxSTAY_ON_TOP
35         /;
36use base qw/Wx::Dialog Class::Accessor::Fast/;
37use Wx::Event qw/
38                    EVT_UPDATE_UI
39                    EVT_BUTTON
40                /;
41
42__PACKAGE__->mk_accessors( 
43    qw/
44           btok
45           gauge
46           progress
47           processing
48           txtprocessing
49           processing_details
50           txtprocessing_details
51           image
52           cancelled
53           bt_close_label
54      / 
55);
56use Carp;
57
58sub new {
59    my ($this, $params) = @_;
60    #on recupere le nom de la classe en fonction du type d'appel de la méthode.
61    my $class = ref($this) || $this;
62
63
64    my $self = $class->SUPER::new(
65        undef, 
66        -1,
67        $params->{title},
68        wxDefaultPosition,
69        wxDefaultSize,
70             wxDIALOG_NO_PARENT|
71             wxDEFAULT_DIALOG_STYLE|
72
73             wxMAXIMIZE_BOX|
74             wxMINIMIZE_BOX| 
75             wxSTAY_ON_TOP
76
77    );
78    # load controls
79    eval {
80      &main::ProcessingProgress($self, 1);
81
82    $self->_initEventHandlers();
83   
84    $self->btok( $self->FindWindow($main::ID_PROGRESS_OK) );
85    $self->gauge( $self->FindWindow($main::ID_PROGRESS_GAUGE) );
86    $self->txtprocessing( $self->FindWindow($main::ID_PROGRESS_TXT) );
87    $self->txtprocessing_details( $self->FindWindow($main::ID_PROGRESS_TXT2) );
88    $self->image( $self->FindWindow($main::ID_STATICBITMAP) );
89    $self->gauge->SetForegroundColour(wxGREEN);
90    };
91
92    $self->btok->SetLabel(
93        $params->{bt_label}||'Cancel'
94    );
95    $self->bt_close_label(
96        $params->{bt_close_label}||'Close'
97    );
98
99    if($@){
100        Wx::LogMessage("Error during dialogbox initialization");
101    }
102    $self;   
103}
104
105
106sub _initEventHandlers {
107    my ( $self ) = @_;
108   
109    EVT_BUTTON( $self, $main::ID_PROGRESS_OK, \&OnOK );
110   
111       
112}
113
114# Update progress information
115sub LogProgress {
116    my ( $self ) = @_;
117   
118    croak "Cancelled by user\n" if $self->cancelled;   
119   
120    $self->txtprocessing->SetLabel(
121        $self->processing
122    );
123    $self->txtprocessing_details->SetLabel(
124        $self->processing_details
125    );
126    $self->gauge->SetValue(
127        $self->progress
128    );
129}
130
131sub DisplayEndInfo {
132    my ( $self, $msg ) = @_;
133
134    $self->txtprocessing->SetLabel(
135        $msg
136    );
137    $self->image->Show(0);
138    $self->gauge->Show(0);
139    # for i18n
140    $self->btok->SetLabel(
141        $self->bt_close_label
142    );
143       
144    $self->txtprocessing_details->SetLabel("");
145}
146
147sub OnOK {
148    my ( $self, $event ) = @_;
149   
150    $self->cancelled(1);
151    $self->Destroy;
152 
153}
154
155
1561;
Note: See TracBrowser for help on using the repository browser.