[4779] | 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 | # +-----------------------------------------------------------------------+ |
---|
[4718] | 20 | package Uploader::GUI::wxPropertyListDlg; |
---|
| 21 | use strict; |
---|
| 22 | use Wx qw/ |
---|
| 23 | wxDefaultSize |
---|
| 24 | wxDefaultPosition |
---|
| 25 | wxLIST_AUTOSIZE |
---|
| 26 | wxDEFAULT_DIALOG_STYLE |
---|
| 27 | |
---|
| 28 | wxMAXIMIZE_BOX |
---|
| 29 | wxMINIMIZE_BOX |
---|
| 30 | |
---|
| 31 | wxSTAY_ON_TOP |
---|
[4751] | 32 | wxLC_NO_HEADER |
---|
[4718] | 33 | /; |
---|
| 34 | use Wx::Locale qw/:default/; |
---|
| 35 | use base qw/Wx::Dialog Uploader::Object2/; |
---|
| 36 | |
---|
| 37 | use Data::Dumper; |
---|
| 38 | __PACKAGE__->mk_accessors( |
---|
| 39 | qw/ |
---|
| 40 | properties |
---|
| 41 | list |
---|
| 42 | / |
---|
| 43 | ); |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | sub new { |
---|
| 48 | my ($this, $params) = @_; |
---|
| 49 | #on recupere le nom de la classe en fonction du type d'appel de la méthode. |
---|
| 50 | my $class = ref($this) || $this; |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | my $self = $class->SUPER::new( |
---|
| 54 | undef, |
---|
| 55 | -1, |
---|
[4751] | 56 | $params->{caption}, |
---|
[4718] | 57 | wxDefaultPosition, |
---|
| 58 | wxDefaultSize, |
---|
[4751] | 59 | wxDEFAULT_DIALOG_STYLE| |
---|
[4718] | 60 | wxMAXIMIZE_BOX| |
---|
[4751] | 61 | wxMINIMIZE_BOX| |
---|
[4718] | 62 | wxSTAY_ON_TOP |
---|
| 63 | |
---|
| 64 | ); |
---|
| 65 | |
---|
| 66 | &main::image_prop_exif($self); |
---|
| 67 | |
---|
| 68 | $self->properties( |
---|
| 69 | $params->{properties} |
---|
| 70 | ); |
---|
| 71 | $self->list( |
---|
| 72 | $self->FindWindow($main::IMG_PROP_EXIF_LIST) |
---|
| 73 | ); |
---|
| 74 | |
---|
[4751] | 75 | $self->list->SetSingleStyle(wxLC_NO_HEADER); |
---|
| 76 | |
---|
[4718] | 77 | $self->{img_exif_prop_close} = $self->FindWindow($main::IMG_PROP_EXIF_CLOSE); |
---|
| 78 | |
---|
| 79 | $self->{img_exif_prop_close}->SetLabel( |
---|
| 80 | gettext("Close") |
---|
| 81 | ); |
---|
| 82 | |
---|
| 83 | Wx::Event::EVT_BUTTON( $self, $self->{img_exif_prop_close}, \&OnClose ); |
---|
| 84 | |
---|
| 85 | $self->list->InsertColumn(0, gettext("Property")); |
---|
| 86 | $self->list->InsertColumn(1, gettext("Value")); |
---|
| 87 | |
---|
| 88 | $self; |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | sub Refresh { |
---|
| 93 | my ( $self ) = @_; |
---|
| 94 | |
---|
| 95 | $self->list->Freeze; |
---|
| 96 | $self->list->DeleteAllItems; |
---|
| 97 | my $i=0; |
---|
| 98 | map { |
---|
| 99 | $self->list->InsertStringItem($i, $_->{label}); |
---|
| 100 | $self->list->SetItem($i, 1, $_->{value}->()); |
---|
| 101 | $i++; |
---|
| 102 | }@{$self->properties}; |
---|
| 103 | $self->list->SetColumnWidth(0, wxLIST_AUTOSIZE ); |
---|
| 104 | $self->list->SetColumnWidth(1, wxLIST_AUTOSIZE ); |
---|
| 105 | $self->list->Thaw; |
---|
| 106 | } |
---|
| 107 | |
---|
[4766] | 108 | # call to destroy crashes with GTK |
---|
[4718] | 109 | sub OnClose { |
---|
| 110 | my ( $self, $event ) = @_; |
---|
| 111 | |
---|
| 112 | $self->Hide; |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | 1; |
---|