[4475] | 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 | # +-----------------------------------------------------------------------+ |
---|
| 20 | package Uploader::GUI::wxPhotoProperties; |
---|
| 21 | use strict; |
---|
| 22 | use Wx qw/ |
---|
| 23 | wxDefaultSize |
---|
| 24 | wxDefaultPosition |
---|
| 25 | wxID_CANCEL |
---|
| 26 | wxID_OK |
---|
| 27 | wxGREEN |
---|
| 28 | /; |
---|
| 29 | use base qw/Wx::Panel Uploader::GUI::DlgCommon/; |
---|
| 30 | use Wx::Event qw/ |
---|
| 31 | EVT_UPDATE_UI |
---|
| 32 | EVT_BUTTON |
---|
| 33 | EVT_CLOSE |
---|
| 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 | |
---|
| 44 | # my $self = $class->SUPER::new( $params->{parentwnd}, -1, wxDefaultPosition, [600, 350]); |
---|
| 45 | my $self = $class->SUPER::new( $params->{parentwnd}, -1, wxDefaultPosition, wxDefaultSize); |
---|
| 46 | #$self->SetMinSize([600, 350]); |
---|
| 47 | # load controls |
---|
| 48 | eval { |
---|
| 49 | &main::PhotoProperties($self, $params->{tags}); |
---|
| 50 | |
---|
| 51 | $self->properties( |
---|
| 52 | $params->{properties} |
---|
| 53 | ); |
---|
| 54 | |
---|
| 55 | #$self->_init_values; |
---|
| 56 | $self->InitLabels(); |
---|
| 57 | $self->SetProperties(); |
---|
| 58 | $self->InitHandler(); |
---|
| 59 | $self->_initEventHandlers(); |
---|
| 60 | |
---|
| 61 | if($@){ |
---|
| 62 | Wx::LogMessage("Error during dialogbox initialization"); |
---|
| 63 | } |
---|
| 64 | }; |
---|
| 65 | |
---|
| 66 | $self; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | sub _initEventHandlers { |
---|
| 72 | my ( $self ) = @_; |
---|
| 73 | |
---|
| 74 | EVT_BUTTON( $self, $main::ID_REUPLOAD_OK, \&OnOK ); |
---|
| 75 | EVT_CLOSE( $self, \&OnClose ); |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | sub OnOK { |
---|
| 82 | my ( $self, $event ) = @_; |
---|
| 83 | |
---|
| 84 | $self->_close; |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | sub OnClose { |
---|
| 88 | my ( $self, $event ) = @_; |
---|
| 89 | |
---|
| 90 | $self->_close; |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | sub _close { |
---|
| 94 | my ( $self ) = @_; |
---|
| 95 | |
---|
| 96 | $self->GetProperties(); |
---|
| 97 | |
---|
| 98 | $self->Destroy; |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | 1; |
---|