[4467] | 1 | # +-----------------------------------------------------------------------+ |
---|
| 2 | # | pLoader - a Perl photo uploader for Piwigo | |
---|
| 3 | # +-----------------------------------------------------------------------+ |
---|
[4779] | 4 | # | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org | |
---|
[4467] | 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 | # +-----------------------------------------------------------------------+ |
---|
| 20 | package Uploader::GUI::wxImageReuploadDlg; |
---|
| 21 | use strict; |
---|
| 22 | use Wx qw/ |
---|
| 23 | wxDefaultSize |
---|
| 24 | wxDefaultPosition |
---|
| 25 | wxID_CANCEL |
---|
| 26 | wxID_OK |
---|
[4750] | 27 | wxSTAY_ON_TOP |
---|
[4467] | 28 | /; |
---|
[4469] | 29 | #use base qw/Wx::Dialog Class::Accessor::Fast Uploader::GUI::DlgCommon/; |
---|
| 30 | use base qw/Wx::Dialog Uploader::GUI::DlgCommon/; |
---|
[4467] | 31 | use Wx::Event qw/ |
---|
| 32 | EVT_BUTTON |
---|
[4750] | 33 | EVT_CLOSE |
---|
[4467] | 34 | /; |
---|
| 35 | |
---|
| 36 | use Carp; |
---|
| 37 | |
---|
| 38 | sub new { |
---|
| 39 | my ($this, $params) = @_; |
---|
| 40 | #on recupere le nom de la classe en fonction du type d'appel de la méthode. |
---|
| 41 | my $class = ref($this) || $this; |
---|
| 42 | |
---|
| 43 | |
---|
[4750] | 44 | my $self = $class->SUPER::new( undef, -1, $params->{title}, wxDefaultPosition, wxDefaultSize, wxSTAY_ON_TOP); |
---|
[4467] | 45 | # load controls |
---|
| 46 | eval { |
---|
| 47 | &main::Reupload($self, 1); |
---|
| 48 | |
---|
[4750] | 49 | $self->properties( |
---|
| 50 | $params->{properties} |
---|
[4467] | 51 | ); |
---|
[4475] | 52 | $self->InitLabels(); |
---|
[4469] | 53 | $self->SetProperties(); |
---|
[4467] | 54 | $self->_initEventHandlers(); |
---|
| 55 | |
---|
[4750] | 56 | if($@){ |
---|
| 57 | Wx::LogMessage("Error during dialogbox initialization"); |
---|
| 58 | } |
---|
| 59 | }; |
---|
[4467] | 60 | |
---|
| 61 | $self; |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | sub _initEventHandlers { |
---|
| 67 | my ( $self ) = @_; |
---|
| 68 | |
---|
| 69 | EVT_BUTTON( $self, $main::ID_REUPLOAD_OK, \&OnOK ); |
---|
| 70 | EVT_CLOSE( $self, \&OnClose ); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | sub OnOK { |
---|
| 75 | my ( $self, $event ) = @_; |
---|
| 76 | |
---|
| 77 | $self->_close; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | sub OnClose { |
---|
| 81 | my ( $self, $event ) = @_; |
---|
[4750] | 82 | |
---|
| 83 | $self->_close; |
---|
[4467] | 84 | } |
---|
| 85 | |
---|
| 86 | sub _close { |
---|
| 87 | my ( $self ) = @_; |
---|
| 88 | |
---|
[4469] | 89 | $self->GetProperties(); |
---|
[4750] | 90 | |
---|
[4467] | 91 | $self->Destroy; |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | 1; |
---|