Changeset 4479


Ignore:
Timestamp:
Dec 13, 2009, 8:21:10 PM (11 years ago)
Author:
ronosman
Message:

Feature 1282 added : user defined default property values. The pairs property/value are defined in the properties.ini file.

Location:
extensions/pLoader/trunk/src
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/src/Uploader/GUI/wxApp.pm

    r4476 r4479  
    112112                  eng_upload_hd
    113113                  privacy_level
     114                  user_defined_properties
    114115      /
    115116);
     
    133134    # to check if we can use stored cache
    134135    $self->imagelist_version(
    135         '9'
     136        '10'
    136137    );
    137138
     
    180181    }
    181182
     183    $self->_read_default_user_properties( 'properties.ini' ) ;
     184       
    182185    # when language is switched, need a new layout
    183186    unlink $self->layout_file if $self->layout_clean;
     
    511514    my $params = {
    512515        new_files        => [],
    513         hd_filter        => 'Lanczos',
    514         hd_blur          => 0.9,
    515         hd_quality       => 95,
    516         hd_w             => 1600,
    517         hd_h             => 1200,
    518         hd_interlace     => 'Line',
    519         thumb_size       => 120,
     516        hd_filter        => $self->user_defined_properties->{hd_filter}||'Lanczos',
     517        hd_blur          => $self->user_defined_properties->{hd_blur}||0.9,
     518        hd_quality       => $self->user_defined_properties->{hd_quality}||95,
     519        hd_w             => $self->user_defined_properties->{hd_w}||1600,
     520        hd_h             => $self->user_defined_properties->{hd_h}||1200,
     521        hd_interlace     => $self->user_defined_properties->{hd_interlace}||'Line',
     522        thumb_size       => $self->user_defined_properties->{thumbnail_size}||120,
    520523        site_thumb_dir   => $self->thumb_dir,
    521         wx_thumb_size    => 100,
     524        wx_thumb_size    => $self->user_defined_properties->{wx_thumbnail_size}||100,
    522525        wx_thumb_dir     => $self->wx_thumb_dir,
    523         resize_w         => 800,
    524         resize_h         => 600,
     526        resize_w         => $self->user_defined_properties->{resize_w}||800,
     527        resize_h         => $self->user_defined_properties->{resize_h}||600,
    525528        site_resized_dir => $self->resized_dir,
    526529        type             => 'jpg',
    527         filter           => 'Lanczos',
    528         blur             => 0.9,
    529         quality          => 95,
    530         wx_quality       => 90,
    531         th_quality       => 90,
    532         auto_rotate      => 1,
    533                 upload_hd        => 'No',
    534         remove_uploaded_from_selection => 1,
    535         interlace        => 'Line',
    536         create_resized   => 1,
     530        filter           => $self->user_defined_properties->{resize_filter}||'Lanczos',
     531        blur             => $self->user_defined_properties->{resize_blur}||0.9,
     532        quality          => $self->user_defined_properties->{resize_quality}||95,
     533        wx_quality       => $self->user_defined_properties->{wx_thumbnail_quality}||90,
     534        th_quality       => $self->user_defined_properties->{thumbnail_quality}||90,
     535        auto_rotate      => $self->user_defined_properties->{auto_rotate}||1,
     536                upload_hd        => $self->user_defined_properties->{upload_hd}||'No',
     537        remove_uploaded_from_selection => $self->user_defined_properties->{remove_uploaded_from_selection}||1,
     538        interlace        => $self->user_defined_properties->{resize_interlace}||'Line',
     539        create_resized   => $self->user_defined_properties->{create_resized}||1,
    537540        prefix           => 'TN',
    538541        count            => 0,
    539542        storable_file    => $self->storable_file,
    540543        userdata_dir     => $self->userdata_dir,
    541         default_photo_name => 'File name',
    542         default_name_prefix => gettext('Photo '),
     544        default_photo_name => $self->user_defined_properties->{default_photo_name}||'File name',
     545        default_name_prefix => $self->user_defined_properties->{default_name_prefix}||gettext('Photo '),
    543546        upload_rejects   =>  [],
    544547        image_sums       => {},
     
    548551        RescaleCallback  => sub { $self->RescaleImage(@_) },
    549552        ResizeCallback   => sub { $self->ResizeImage(@_) },
    550         watermark_text => gettext("my watermark"),
    551         watermark_text_size => 12,
    552         watermark_position => 'Center',
    553         watermark_y => 10,
    554         watermark_x => 10,
    555         watermark_color => 'White',
     553        watermark_text => $self->user_defined_properties->{watermark_text}||gettext("my watermark"),
     554        watermark_text_size => $self->user_defined_properties->{watermark_text_size}||12,
     555        watermark_position => $self->user_defined_properties->{watermark_position}||'Center',
     556        watermark_y => $self->user_defined_properties->{watermark_y}||10,
     557        watermark_x => $self->user_defined_properties->{watermark_x}||10,
     558        watermark_color => $self->user_defined_properties->{watermark_color}||'White',
    556559                reupload_action_files => 1,
    557560                reupload_action_properties => 2,
     
    946949}
    947950
     951sub _read_default_user_properties {
     952        my( $self, $file ) = @_ ;
     953
     954
     955        my $expr_params ;
     956        eval { $expr_params = read_file( $file ); } ;
     957        my $properties;
     958        if($expr_params){
     959                my $expr = '$properties = ' ;
     960                $expr .=  " { $expr_params }; " ;
     961                eval $expr ;
     962        }
     963        $properties = {} unless 'HASH' eq ref $properties;
     964        $self->user_defined_properties($properties);
     965
     966}
     967
    948968
    949969
Note: See TracChangeset for help on using the changeset viewer.