[4475] | 1 | # +-----------------------------------------------------------------------+ |
---|
| 2 | # | pLoader - a Perl photo uploader for Piwigo | |
---|
| 3 | # +-----------------------------------------------------------------------+ |
---|
[4779] | 4 | # | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org | |
---|
[4475] | 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 |
---|
[4718] | 25 | wxTAB_TRAVERSAL |
---|
[4475] | 26 | wxID_CANCEL |
---|
| 27 | wxID_OK |
---|
| 28 | wxGREEN |
---|
| 29 | /; |
---|
| 30 | use base qw/Wx::Panel Uploader::GUI::DlgCommon/; |
---|
| 31 | use Wx::Event qw/ |
---|
| 32 | EVT_BUTTON |
---|
[4718] | 33 | EVT_CLOSE |
---|
[4475] | 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 | |
---|
[4718] | 44 | my $self = $class->SUPER::new( $params->{parentwnd}, -1, wxDefaultPosition, [-1, -1], wxTAB_TRAVERSAL ); |
---|
[4475] | 45 | # load controls |
---|
| 46 | eval { |
---|
[4784] | 47 | &main::PhotoPropertiesCategoriesTags($self, $params->{tags}); |
---|
[4475] | 48 | |
---|
[4784] | 49 | $self->_initNotebook($params->{tags}); |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | $self->properties( |
---|
| 53 | $params->{properties} |
---|
[4475] | 54 | ); |
---|
| 55 | |
---|
| 56 | $self->InitLabels(); |
---|
[4784] | 57 | $self->InitChoices(); |
---|
[4475] | 58 | $self->SetProperties(); |
---|
[4784] | 59 | $self->InitHandler(); |
---|
[4475] | 60 | $self->_initEventHandlers(); |
---|
| 61 | |
---|
[4784] | 62 | if($@){ |
---|
| 63 | Wx::LogMessage("Error during dialogbox initialization"); |
---|
| 64 | } |
---|
| 65 | }; |
---|
[4475] | 66 | |
---|
[4784] | 67 | |
---|
[4475] | 68 | $self; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | sub _initEventHandlers { |
---|
| 74 | my ( $self ) = @_; |
---|
| 75 | |
---|
| 76 | EVT_BUTTON( $self, $main::ID_REUPLOAD_OK, \&OnOK ); |
---|
| 77 | EVT_CLOSE( $self, \&OnClose ); |
---|
| 78 | |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | |
---|
[4784] | 82 | sub _initNotebook{ |
---|
| 83 | my ( $self, $tags ) = @_; |
---|
| 84 | |
---|
| 85 | my $nb = $self->FindWindow( |
---|
| 86 | $main::PHOTO_PROPERTIES_NB |
---|
| 87 | ); |
---|
| 88 | |
---|
| 89 | my( $page1 ) = Wx::Panel->new( $nb, -1 ); |
---|
| 90 | &main::photo_properties_caption_comments( $page1, 0 ); |
---|
| 91 | $nb->AddPage( $page1, "Photo informations" ); |
---|
| 92 | |
---|
| 93 | my( $page2 ) = Wx::Panel->new( $nb, -1 ); |
---|
| 94 | &main::photo_properties_tags( $page2, $tags ); |
---|
| 95 | $nb->AddPage( $page2, "Tags" ); |
---|
| 96 | |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | |
---|
[4475] | 100 | sub OnOK { |
---|
| 101 | my ( $self, $event ) = @_; |
---|
| 102 | |
---|
| 103 | $self->_close; |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | sub OnClose { |
---|
| 107 | my ( $self, $event ) = @_; |
---|
| 108 | |
---|
| 109 | $self->_close; |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | sub _close { |
---|
| 113 | my ( $self ) = @_; |
---|
| 114 | |
---|
| 115 | $self->GetProperties(); |
---|
| 116 | |
---|
| 117 | $self->Destroy; |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | 1; |
---|