source: extensions/pLoader/trunk/src/Uploader/GUI/wxApp.pm @ 4096

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

Feature 1204 added : only display languages with available translations.

  • Property svn:eol-style set to LF
File size: 20.8 KB
RevLine 
[4096]1# +-----------------------------------------------------------------------+
[2597]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# +-----------------------------------------------------------------------+
20package Uploader::GUI::wxApp;
21use strict;
22use base qw/Wx::App Class::Accessor::Fast/;   
23use Wx qw/
24             wxBITMAP_TYPE_GIF
25             wxBITMAP_TYPE_ICO
26             wxBITMAP_TYPE_BMP
27             wxBITMAP_TYPE_PNG
28             wxBITMAP_TYPE_JPEG
[2661]29             wxIMAGE_QUALITY_NORMAL
30             wxIMAGE_QUALITY_HIGH
[2597]31             wxSPLASH_CENTRE_ON_SCREEN
32             wxSPLASH_TIMEOUT
33             wxDefaultPosition
34             wxDefaultSize
35             wxSIMPLE_BORDER
36             wxFRAME_TOOL_WINDOW
37             wxFRAME_NO_TASKBAR wxSTAY_ON_TOP
38             wxWHITE
[2618]39             wxICON_EXCLAMATION
40             wxOK
[3159]41             wxLANGUAGE_CHINESE_SIMPLIFIED   
42             wxLANGUAGE_CZECH   
43             wxLANGUAGE_DANISH   
44             wxLANGUAGE_DUTCH   
45             wxLANGUAGE_ENGLISH   
46             wxLANGUAGE_FRENCH   
47             wxLANGUAGE_GERMAN   
48             wxLANGUAGE_ITALIAN   
49             wxLANGUAGE_JAPANESE   
50             wxLANGUAGE_POLISH   
51             wxLANGUAGE_PORTUGUESE   
52             wxLANGUAGE_PORTUGUESE_BRAZILIAN   
53             wxLANGUAGE_RUSSIAN   
54             wxLANGUAGE_SLOVAK   
55             wxLANGUAGE_SPANISH   
[2597]56         /;
57use Uploader::GUI::wxFrameAUI;
[3140]58use File::Slurp ;
[2597]59use Data::Dumper;
60use Storable;
61use File::HomeDir;
62use File::Spec;
63use Uploader::PWG;
64use Uploader::ImageList;
65use Uploader::GUI::wxLoginDlg;
[3159]66use Wx::Locale qw/:default/;
[4096]67use utf8;
[2618]68
[2597]69$|=1;
70
71__PACKAGE__->mk_accessors( 
72    qw/
73          pwg
74          site_url
75          site_username
76          site_password
[3285]77          http_username
78          http_password
[2597]79          rejects
80          imagelist
81          storable_file
82          wx_thumb_dir
83          resized_dir
84          preview_dir
85          userdata_dir
86          resized_dir
87          thumb_dir
88          conf_file
[3458]89          layout_file
[3159]90          locale
91          current_language
[4096]92          languages
93          available_languages
[3227]94          version
95          imagelist_version
96          use_offline
97          login_dlg
[3284]98          branding
[3370]99          frame
[3458]100          perspective
101          imageviewerIndex
102          frameLayout
[3467]103          chunk_size
[2597]104      / 
105);
106
107sub FilterEvent {
108    my( $self, $event ) = @_;
109   
110    Wx::LogMessage "EventType %s", $event->GetEventType();
111   
112    return -1;
113}
114
[3227]115
[2597]116sub OnInit {
117    my( $self ) = @_;
[3227]118   
119    $self->version(
[4091]120        '2.0.5a'
[3227]121    );
122   
123    # to check if we can use stored cache
124    $self->imagelist_version(
[4091]125        '6'
[3227]126    );
[2597]127
[4096]128    $self->languages(
129      [
130             ["中文 (%s)", wxLANGUAGE_CHINESE_SIMPLIFIED, 'Chinese simplified'],   
131             ["Česky (%s)", wxLANGUAGE_CZECH, 'Czech'],   
132             ["Dansk (%s)", wxLANGUAGE_DANISH, 'Danish'],   
133             ["Deutsch (%s)", wxLANGUAGE_GERMAN, 'German'],   
134             ["English (%s)", wxLANGUAGE_ENGLISH, 'English'],   
135             ["Español (%s)", wxLANGUAGE_SPANISH, 'Spanish'],   
136             ["Français (%s)", wxLANGUAGE_FRENCH, 'French'],   
137             ["Italiano (%s)", wxLANGUAGE_ITALIAN, 'Italian'],   
138             ["日本語 (にほんご) (%s)", wxLANGUAGE_JAPANESE, 'Japanese'],   
139             ["Nederlands (%s)", wxLANGUAGE_DUTCH, 'Dutch'],   
140             ["Polski (%s)", wxLANGUAGE_POLISH, 'Polish'],   
141             ["Português Brasileiro (%s)", wxLANGUAGE_PORTUGUESE_BRAZILIAN, 'Portuguese Brazil'],   
142             ["Português Portugal (%s)", wxLANGUAGE_PORTUGUESE, 'Portuguese Portugal'],   
143             ["Русский (%s)", wxLANGUAGE_RUSSIAN, 'Russian'],
144             ["Slovenčina (%s)", wxLANGUAGE_SLOVAK, 'Slovak'],
145      ]
146    );
147    $self->_filter_available_languages;
148
[2597]149    Wx::InitAllImageHandlers();
150    my $applicationName = "pLoader" ;
151    $self->SetAppName( $applicationName );
152    $self->SetVendorName( "Piwigo Team" );
153
154    $self->{IMGTYPE} = {
155        'jpg' => wxBITMAP_TYPE_JPEG,
156        'gif' => wxBITMAP_TYPE_GIF,
157        'png' => wxBITMAP_TYPE_PNG,
158    };
159
160    $self->_init_userdir;
161
162
163    my $conf = retrieve $self->conf_file if -e $self->conf_file;       
[3458]164    my $layout = retrieve $self->layout_file if -e $self->layout_file; 
[2597]165
166    if(defined $conf ){
167        $self->SetKeyValues($conf);
168    }
169    else {
170        $self->_readParams( 'pLoader.ini' ) unless defined $conf ;
171    }
172
[3458]173    if(defined $layout ){
174        $self->SetKeyValues($layout);
175    }
[3159]176
[3458]177
[2597]178    $self->site_url(
179        $self->{site_url}
180    );
[3284]181   
[2597]182
183    $self->site_username(
184        $self->{site_username}
185    );
186    $self->site_password(
187        $self->{site_password}
188    );
[3285]189
190    $self->http_username(
191        $self->{http_username}
192    );
193    $self->http_password(
194        $self->{http_password}
195    );
196
197
[3159]198    $self->current_language(
[3456]199        $self->{current_language}||Wx::Locale::GetSystemLanguage()
[3159]200    );
[3467]201
202    $self->chunk_size(
203        $self->{chunk_size}||500_000
204    );
[2597]205   
[3159]206    $self->init_locale;
[2597]207
[3227]208    my $not_exit = $self->Login();
[2618]209    # user pressed OK
[3227]210    if($not_exit){
[3386]211        $self->StoreConnectionProperties;
[3227]212        if( !$self->use_offline ){
213            while( $not_exit and !$self->_is_connected ){
214                $not_exit = $self->Login();
[3232]215                last if $self->use_offline;
[3227]216            }
217        }
[2618]218        $self->_init_imagelist;
219        $self->_init_thumbimagelist;
220        $self->_init_frame;
[2597]221    }
222
[3227]223    $not_exit;
[2597]224}
225
[4096]226sub _filter_available_languages {
227    my ( $self ) = @_;
[3227]228
[4096]229    # check if the locale can be set and the translation catalog available
230    $self->available_languages(
231        [
232            grep {$_} 
233            map{
234                my $locale = Wx::Locale->new($_->[1]);
235                $locale->AddCatalogLookupPathPrefix('../locale');
236                $_ if $locale->AddCatalog('pLoader');
237            }
238            @{$self->languages}
239        ]
240    );
241}
242
[3227]243sub _is_connected {
244    my ( $self ) = @_;
245
246    my $is_connected;
247
248    if($self->pwg->login_result->{stat} eq 'ok'){
249        $is_connected = 1;
250    }
251    else{
252        Wx::MessageBox( 
253            sprintf(
254                "%s\n\n%s %s %s",
255                $self->pwg->login_result->{message},
256                gettext("Connection to"),
257                $self->site_url,
258                gettext("failed"),
259            ),
260            gettext("Piwigo login error"),
261            wxOK | wxICON_EXCLAMATION, 
262        );
263    }
264   
265    $is_connected;
266}
267
268
[3159]269my $locale;
270sub init_locale {
271    my ( $self, $language ) = @_;
272   
273    $self->current_language(
274        $language
275    ) if defined $language;
276
277    undef $locale;
278    $locale = Wx::Locale->new(
279        $self->current_language
280    );
281    $locale->AddCatalogLookupPathPrefix( '../locale');
[3178]282    if(!$locale->AddCatalog( 'pLoader.mo' )){
[4076]283        Wx::LogMessage gettext("Cannot find translation catalog files for %s. Use default language"), $locale->GetCanonicalName();
[3159]284    }
[3357]285    $self->locale($locale);     
[3159]286}
287
[2597]288sub StoreConnectionProperties {
289    my ( $self ) = @_;
290
291    eval {   
292        store( 
293            {
294                map{
295                   $_ => $self->{$_},
296                }
297                qw/
298                    site_url
299                    site_username
300                    site_password
[3285]301                    http_username
302                    http_password
[3159]303                    current_language
[3467]304                    chunk_size
[2597]305                /
306            },
307            $self->conf_file
308        );
309    };
310}
311
[3458]312sub StoreLayoutProperties {
313    my ( $self ) = @_;
314
315    eval {   
316        store( 
317            {
318                map{
319                   $_ => $self->{$_},
320                }
321                qw/
322                      perspective
323                      imageviewerIndex
324                      frameLayout
325                /
326            },
327            $self->layout_file
328        );
329    };
330}
331
[2597]332sub _init_imagelist {
333    my ( $self ) = @_; 
334
335    my $stored_imagelist;
336   
[3227]337    my $use_new_imagelist;
338   
[2597]339    if( -e $self->storable_file ){
340        eval {
341            $stored_imagelist = retrieve $self->storable_file;
342        };
343        if($@){
[2661]344            Wx::LogMessage(
[3227]345                gettext("An error has occured. Can not read %s\n%s"),
[2661]346                $self->storable_file,
347                $@
348            );
[3227]349            $use_new_imagelist = 1 ;
[2597]350        }
[3227]351        # should have a valid imagelist
352        else{
353            $use_new_imagelist = 1 unless $self->imagelist_version eq $stored_imagelist->{imagelist_version};
354            if($use_new_imagelist){
355                Wx::LogMessage(gettext("pLoader has to reset image cache."));
356            }
357        }
[2597]358    }
359    else{
[3227]360        $use_new_imagelist = 1 ;
361    }
362
363    if($use_new_imagelist){
[2597]364        $stored_imagelist = $self->_default_imagelist_params ;
365    }
366
[3227]367
[2597]368    $self->imagelist(
369        Uploader::ImageList->new(
370            $stored_imagelist
371        )
372    );
[2661]373
[3227]374    $self->imagelist->RescaleCallback(
375        sub { $self->RescaleImage(@_) }
376    );
377
[2661]378    $self->imagelist->ResizeCallback(
379        sub { $self->ResizeImage(@_) }
380    );
[3509]381
382    $self->imagelist->YieldCallback(
383        sub { Wx::Yield }
384    );
[2597]385}
386
387
388sub _default_imagelist_params {
389    my ( $self ) = @_ ;
390
391    my $params = {
[3232]392        new_files        => [],
[2597]393        thumb_size       => 120,
[2661]394        site_thumb_dir   => $self->thumb_dir,
[2597]395        wx_thumb_size    => 120,
396        wx_thumb_dir     => $self->wx_thumb_dir,
397        preview_ratio    => 25, 
398        preview_dir      => $self->preview_dir,
399        resize_w         => 800,
400        resize_h         => 600,
[2661]401        site_resized_dir => $self->resized_dir,
[2597]402        type             => 'jpg',
403        filter           => 'Lanczos',
[2661]404        blur             => 0.9,
[3458]405        quality          => 95,
[3178]406        wx_quality       => 80,
407        th_quality       => 90,
408        auto_rotate      => 1,
[3284]409        remove_uploaded_from_selection => 1,
[3178]410        interlace        => 'Line',
411        create_resized   => 1,
412        use_exif_preview => 1,
[2597]413        prefix           => 'TN',
414        count            => 0,
415        storable_file    => $self->storable_file,
416        userdata_dir     => $self->userdata_dir,
[3267]417        default_photo_name => gettext('File name'),
[3357]418        default_name_prefix => gettext('Photo '),
[3227]419        upload_rejects   =>  [],
420        image_sums       => {},
421        sums             => [],
422        version          => $self->version,
423        imagelist_version => $self->imagelist_version,
424        RescaleCallback  => sub { $self->RescaleImage(@_) },
425        ResizeCallback   => sub { $self->ResizeImage(@_) },
[4091]426        watermark_text => gettext("my watermark"),
427        watermark_text_size => 12,
428        watermark_position => gettext("Center"),
429        watermark_y => 10,
430        watermark_x => 10,
431        watermark_color => gettext("White"),
[2597]432    };
433
434    return $params;
435}
436
437sub Login {
438    my ( $self ) = @_; 
439
[3227]440    $self->login_dlg( 
441        Uploader::GUI::wxLoginDlg->new(
442            {
443                title         => gettext("Piwigo login"),
444                site_url      => sub { $self->site_url(@_) },
445                site_username => sub { $self->site_username(@_) },     
446                site_password => sub { $self->site_password(@_) },
447                use_offline   => sub { $self->use_offline(@_) },       
448            }
449        )
450    ) unless $self->login_dlg;
[2597]451
452    my $icon = Wx::Icon->new();
453    $icon->LoadFile('../res/favicon.ico', wxBITMAP_TYPE_ICO);
[3227]454    $self->login_dlg->SetIcon($icon);   
[2597]455
456   
[3227]457    my $rval = $self->login_dlg->ShowModal();
458    $self->login_dlg->Show(0);
459
[3284]460    $self->_init_branding;
[3388]461   
462    if ($self->site_url !~ /^http:/){
463        $self->site_url(
464            sprintf(
465                "http://%s",
466                $self->site_url
467            )
468        );     
469    }
[3284]470
[3227]471    $self->pwg(
472        # get these parameters from dialog or from file
473        Uploader::PWG->new(
474            {
475                site_url       => $self->site_url,
476                site_username  => $self->site_username,
477                site_password  => $self->site_password,
[3285]478                http_username  => $self->http_username,
479                http_password  => $self->http_password,
[3284]480                branding       => $self->branding,
[3467]481                chunk_size     => $self->chunk_size,
[3472]482                use_offline    => $self->use_offline,
[3227]483            }
484        )
485    );
[3472]486
[2597]487    $rval;
488}
489
490sub _init_userdir {
491    my ( $self ) = @_;
492   
493    my $applicationName = $self->GetAppName ;
[3140]494    my $userdatadir = File::Spec->canonpath(
495        File::Spec->catfile(
496            File::HomeDir->my_data(), 
497            "\.$applicationName"
498        )
499    );
[2597]500
[3140]501    if(! -d $userdatadir){
502        if(! mkdir $userdatadir){
503            Wx::MessageBox( 
504                sprintf(
505                    "%s directory creation failed",
506                    $userdatadir,
507                ),
508                "pLoader working directory creation error",
509                wxOK | wxICON_EXCLAMATION, 
510            );
511
512            $userdatadir = File::Spec->canonpath(
513                File::Spec->catfile(
514                    File::Spec->tmpdir(), 
515                    "\.$applicationName"
516                )
517            );
518            mkdir $userdatadir;
519        }       
520    }
521
[2597]522    $self->userdata_dir($userdatadir);
523   
524    $self->conf_file(
525        File::Spec->catfile(
526            $self->userdata_dir, 
527            ".$applicationName.conf"
528        )
529    );
[2661]530
[3458]531    $self->layout_file(
532        File::Spec->catfile(
533            $self->userdata_dir, 
534            ".$applicationName.layout"
535        )
536    );
[2597]537
538    $self->storable_file(
539        File::Spec->catfile($self->userdata_dir, 'pLoader.dat')
540    );
541   
542    my $thumbdir = File::Spec->catfile($self->userdata_dir, 'thumbnails');
543    mkdir $thumbdir unless -d $thumbdir ;
544    $self->thumb_dir($thumbdir);
545
546    my $wxthumbdir = File::Spec->catfile($self->userdata_dir, 'wxthumbnails');
547    mkdir $wxthumbdir unless -d $wxthumbdir ;
548    $self->wx_thumb_dir($wxthumbdir);
549
550
551    my $resizedir = File::Spec->catfile($self->userdata_dir, 'resize');
552    mkdir $resizedir unless -d $resizedir ;
553    $self->resized_dir($resizedir);
554
555    my $previewdir = File::Spec->catfile($self->userdata_dir, 'preview');
556    mkdir $previewdir unless -d $previewdir ;
557    $self->preview_dir($previewdir);
558
559       
560}
561
562sub _init_thumbimagelist {
563    my ( $self ) = @_;
564
565   
566    $self->imagelist->wx_thumb_imglist(
567        Wx::ImageList->new( 
568            $self->imagelist->wx_thumb_size, 
569            $self->imagelist->wx_thumb_size, 
570            1,
571            0
572        )
573    );
574   
575    # reload images
576    $self->_reload_thumb_images;
577}
578
579
580sub _reload_thumb_images {
581    my ( $self ) = @_;
582   
583    my $wximagelist = $self->imagelist->wx_thumb_imglist;
[3227]584    my $sums = $self->imagelist->sums;
[2597]585
586    map {
[3227]587        my $image = $self->imagelist->image_sums->{$_};
588
[2597]589        $wximagelist->Add(
590            Wx::Bitmap->new( 
[3227]591                $image->wx_thumb_file, 
[2597]592                $self->GetWxBitmapType($self->imagelist->type), 
593            )
594        );
595    }
[3227]596    @$sums ;
[2597]597
598}
599
600sub GetWxBitmapType {
601    my ( $self, $type ) = @_;
602   
603    $self->{IMGTYPE}->{$type};
604}
605
606
[3227]607sub RescaleImage {
[2661]608    my ( $self, $image_file, $image_file_out, $type, $ratio, $width, $height, $quality ) = @_;
609   
610
611    my $image = Wx::Image->new(
612            $image_file, 
613            $self->GetWxBitmapType($type),
614            0
615    );
616   
617    my $w;
618    my $h;
619
620    my $img_w = $image->GetWidth;
621    my $img_h = $image->GetHeight;
622   
623    # use a ratio ( 25% default ) if defined
624    # default ratio is used for preview.
625    if($ratio){
626        $w = $ratio*$img_w/100 ;
627        $h = $ratio*$img_h/100 ;
628    }
629    # use specified width and height
630    else{
631        # portrait
632        if( $img_w < $img_h ){
633            $w = $height;
634        }
635        else{
636            $w = $width;
637        }
638        # to respect aspect ratio
639        $h = sprintf(
640            "%.0f",
641            ($w*$img_h)/$img_w
642        );
643    }
644
645    $image->Rescale(
646        $w,
647        $h,
648        wxIMAGE_QUALITY_HIGH
649    );
650   
651    $quality ||= 90;
652   
653    $image->SetOption( 
654        "quality", 
655        $quality 
656    );
657   
658    if(!$image->SaveFile(
659        $image_file_out,
660        $self->GetWxBitmapType($type),
661    )){
662        Wx::LogMessage(
[3227]663            gettext("An error has occured. Can not save file %s"),
[2661]664            $image_file_out,
665        )
666    };
667}
668
[3227]669sub ResizeImage {
670    my ( $self, $image_file, $image_file_out, $type, $width, $height, $quality ) = @_;
671   
672
673    my $image = Wx::Image->new(
674            $image_file, 
675            $self->GetWxBitmapType($type),
676            0
677    );
678
679    my $w;
680    my $h;
681
682    my $img_w = $image->GetWidth;
683    my $img_h = $image->GetHeight;
684   
685        # portrait
686        if( $img_w < $img_h ){
687            $w = $height;
688        }
689        else{
690            $w = $width;
691        }
692        # to respect aspect ratio
693        $h = sprintf(
694            "%.0f",
695            ($w*$img_h)/$img_w
696        );
697
698   
699
700    $image->Rescale(
701        $w,
702        $h,
703        wxIMAGE_QUALITY_HIGH
704    );
705
706    $image->Resize(
707        [ $width, $height ], [ 0, 20],
708    );
709   
710    $quality ||= 90;
711   
712    $image->SetOption( 
713        "quality", 
714        $quality 
715    );
716   
717    if(!$image->SaveFile(
718        $image_file_out,
719        $self->GetWxBitmapType($type),
720    )){
721        Wx::LogMessage(
722            gettext("An error has occured. Can not save file %s"),
723            $image_file_out,
724        )
725    };
726}
727
[3284]728# some labels differ with branding ( piwigo.com or piwigo.org )
729sub _init_branding {
730    my ( $self ) =@_;
731   
732    if( $self->site_url =~ /\.piwigo\.com/ ){
733        $self->branding(
734            {
735                category  => gettext("album"), 
736                Category  => gettext("Album"), 
737                categories => gettext("albums"),       
738                Categories => gettext("Albums"),
739                'Add new category' => gettext("Add new album"), 
[3466]740                'Category name' => gettext("Album name :"),
741                'New category' => gettext("New album"),
[3284]742            }
743        );
744    }
745    else{
746        $self->branding(
747            {
[3466]748                category  => gettext("categorie"),     
749                Category  => gettext("Categorie"),     
[3284]750                categories => gettext("categories"),   
751                Categories => gettext("Categories"),   
[3466]752                'Add new category' => gettext("Add new category"),
753                'Category name' => gettext("Category name :"),
754                'New category' => gettext("New category"),
[3284]755            }
756        );
757    }   
758}
[3227]759
[3284]760sub SaveConfig {
761    my ( $self, $params ) = @_; 
[3227]762
[3284]763   my $config = Wx::ConfigBase::Get;
[3227]764
[3284]765   map {
766       $config->WriteInt( $_, $params->{$_} )
767   } keys %$params;
768
769   $config->Write( 'Perspective', $params->{Perspective} )
770       
771}
772
773
[2597]774sub _init_frame {
[3227]775    my ( $self ) = @_; 
[2597]776
[3227]777    my $url = $self->site_url;
778   
779    if($self->use_offline){
780        $url = gettext("Work Offline");
[2618]781    }
[2597]782
[3370]783    $self->frame(
784        Uploader::GUI::wxFrameAUI->new( 
785            {
786                title     => sprintf("pLoader - Piwigo uploader %s - [%s]", $self->version, $url),
787                pwg       => $self->pwg,
788                imagelist => $self->imagelist,
[3458]789                perspective => $self->perspective,
790                imageviewer_index => $self->imageviewerIndex,
791                frameLayout => $self->frameLayout,
[3370]792            }
793        )
[2618]794    );
[3458]795 
[3370]796    $self->frame->Show( 1 );
797    $self->SetTopWindow( $self->frame );
[2597]798
[2618]799    my $icon = Wx::Icon->new();
800    $icon->LoadFile('../res/favicon.ico', wxBITMAP_TYPE_ICO);
[3370]801    $self->frame->SetIcon($icon);       
[2597]802}
803
804sub _readParams {
805        my( $self, $file ) = @_ ;
806
807
808        my $expr_params ;
809        eval { $expr_params = read_file( $file ); } ;
810       
811        my $paramValues = [] ;
812        if($expr_params){
813                my $expr = '$paramValues = ' ;
814                $expr .=  "$expr_params ; " ;
815                eval $expr ;
816        }
817       
818        return unless 'ARRAY' eq ref $paramValues ;
819       
820        if(scalar(@$paramValues )){
821            my $params = $paramValues->[0] ;
822            $self->SetKeyValues($params);
823        }
824}
825
[3159]826
827
[2597]828sub SetKeyValues {
829    my ( $self, $params )= @_; 
830
831    foreach( keys %$params ) {
832        $self->{$_} = $params->{$_} ;
833    }
834}
835
[3159]836
[2597]8371;
Note: See TracBrowser for help on using the repository browser.