source: extensions/pLoader/trunk/src/Uploader/GUI/wxPhotoProperties.pm @ 5041

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

Feature 1478 added : ability to set properties for a photo selection.

File size: 3.5 KB
Line 
1# +-----------------------------------------------------------------------+
2# | pLoader - a Perl photo uploader for Piwigo                            |
3# +-----------------------------------------------------------------------+
4# | Copyright(C) 2008-2010 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::wxPhotoProperties;
21use strict;
22use Wx qw/
23             wxDefaultSize
24             wxDefaultPosition
25             wxTAB_TRAVERSAL
26             wxID_CANCEL
27             wxID_OK
28             wxGREEN
29         /;
30use base qw/Wx::Panel Uploader::GUI::DlgCommon/;
31use Wx::Event qw/
32                    EVT_BUTTON
33                    EVT_CLOSE
34                /;
35
36use Carp;
37
38sub 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, [-1, -1], wxTAB_TRAVERSAL );
45    # load controls
46    eval {
47        &main::PhotoPropertiesCategoriesTags($self, $params->{tags});
48
49        $self->_initNotebook($params->{tags});
50
51
52        $self->properties(
53            $params->{properties}
54        );
55
56        $self->InitLabels();
57        $self->InitChoices();
58        $self->SetProperties();
59        $self->InitHandler();
60        $self->_initEventHandlers();
61
62        if($@){
63            Wx::LogMessage("Error during dialogbox initialization");
64        }
65    };
66
67
68    $self;   
69}
70
71
72
73sub _initEventHandlers {
74    my ( $self ) = @_;
75   
76    EVT_BUTTON( $self, $main::ID_REUPLOAD_OK, \&OnOK );
77    EVT_CLOSE( $self, \&OnClose );
78   
79}
80
81
82sub _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    $self->{notebook} = $nb;
98
99}
100
101
102sub OnOK {
103    my ( $self, $event ) = @_;
104   
105    $self->_close;
106}
107
108sub OnClose {
109    my ( $self, $event ) = @_;
110       
111        $self->_close;
112}
113
114sub _close {
115    my ( $self ) = @_;
116
117    $self->GetProperties();
118
119    $self->Destroy;
120}
121
1221;
Note: See TracBrowser for help on using the repository browser.