Ignore:
Timestamp:
Jun 25, 2009, 5:52:30 PM (15 years ago)
Author:
ronosman
Message:

Feature 1014 added : save layout configuration in a .pLoader.layout file.

File:
1 edited

Legend:

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

    r3456 r3458  
    302302          thumb_dir
    303303          conf_file
     304          layout_file
    304305          locale
    305306          current_language
     
    310311          branding
    311312          frame
     313          perspective
     314          imageviewerIndex
     315          frameLayout
    312316      /
    313317);
     
    331335    # to check if we can use stored cache
    332336    $self->imagelist_version(
    333         '3'
     337        '4'
    334338    );
    335339
     
    349353
    350354    my $conf = retrieve $self->conf_file if -e $self->conf_file;       
     355    my $layout = retrieve $self->layout_file if -e $self->layout_file; 
    351356
    352357    if(defined $conf ){
     
    355360    else {
    356361        $self->_readParams( 'pLoader.ini' ) unless defined $conf ;
     362    }
     363
     364    if(defined $layout ){
     365        $self->SetKeyValues($layout);
    357366    }
    358367
     
    467476            },
    468477            $self->conf_file
     478        );
     479    };
     480}
     481
     482sub StoreLayoutProperties {
     483    my ( $self ) = @_;
     484
     485    eval {   
     486        store(
     487            {
     488                map{
     489                   $_ => $self->{$_},
     490                }
     491                qw/
     492                      perspective
     493                      imageviewerIndex
     494                      frameLayout
     495                /
     496            },
     497            $self->layout_file
    469498        );
    470499    };
     
    540569        filter           => 'Lanczos',
    541570        blur             => 0.9,
    542         quality          => 100,
     571        quality          => 95,
    543572        wx_quality       => 80,
    544573        th_quality       => 90,
     
    658687    );
    659688
    660    
     689    $self->layout_file(
     690        File::Spec->catfile(
     691            $self->userdata_dir,
     692            ".$applicationName.layout"
     693        )
     694    );
    661695
    662696    $self->storable_file(
     
    895929    my ( $self ) = @_; 
    896930
    897     my $config = Wx::ConfigBase::Get;
    898 
    899     my $x = $config->ReadInt( "X", 50 );
    900     my $y = $config->ReadInt( "Y", 50 );
    901     my $w = $config->ReadInt( "Width", 1024 );
    902     my $h = $config->ReadInt( "height", 768 );
    903     my $prev_w = $config->ReadInt( "PreviewWidth", 400 );
    904     my $prev_h = $config->ReadInt( "PreviewHeight", 300 );
    905     my $perspective = $config->Read( "Perspective" );
    906     my $imageviewer_index = $config->ReadInt( "ImageviewerIndex", 0 );
    907    
    908     #printf("Config x %s, y %s, w %s, h %s, prev_w %s, prev_h %s\n", $x, $y, $w, $h, $prev_w, $prev_h);
    909    
    910931    my $url = $self->site_url;
    911932   
     
    917938        Uploader::GUI::wxFrameAUI->new(
    918939            {
    919                 x         => $x,
    920                 y         => $y,
    921                 width     => $w,
    922                 height    => $h,
    923940                title     => sprintf("pLoader - Piwigo uploader %s - [%s]", $self->version, $url),
    924941                pwg       => $self->pwg,
    925942                imagelist => $self->imagelist,
    926                 preview_w => $prev_w,
    927                 preview_h => $prev_h,
    928                 perspective => $perspective,
    929                 imageviewer_index => $imageviewer_index,
     943                perspective => $self->perspective,
     944                imageviewer_index => $self->imageviewerIndex,
     945                frameLayout => $self->frameLayout,
    930946            }
    931947        )
    932948    );
    933        
    934     $self->frame->SetSize( $x, $y, $w, $h );
     949 
    935950    $self->frame->Show( 1 );
    936951    $self->SetTopWindow( $self->frame );
Note: See TracChangeset for help on using the changeset viewer.