Changeset 3178


Ignore:
Timestamp:
Mar 7, 2009, 8:33:10 PM (15 years ago)
Author:
ronosman
Message:

Feature 914, 920, 921, 924 added ( see rev 3177 ). Change the way properties are displayed in GUI. Use a generic grid panel replaces custom dialogs ( wxGlobalSettingsPanel, wxPhotoExifPanel, wxPhotoPropertiesPanel ).

Location:
extras/pLoader/trunk/src/Uploader/GUI
Files:
3 deleted
2 edited

Legend:

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

    r3163 r3178  
    327327    };
    328328
    329     $self->_readParams2( 'locale.ini' ) ;
    330 
    331329    $self->_init_userdir;
    332330
     
    398396    );
    399397    $locale->AddCatalogLookupPathPrefix( '../locale');
    400     if(!$locale->AddCatalog( 'pLoader' )){
     398    if(!$locale->AddCatalog( 'pLoader.mo' )){
    401399        print "Cannot find translation catalog files. Use default language\n";
    402400    }
     
    476474        blur             => 0.9,
    477475        quality          => 100,
     476        wx_quality       => 80,
     477        th_quality       => 90,
     478        auto_rotate      => 1,
     479        interlace        => 'Line',
     480        create_resized   => 1,
     481        use_exif_preview => 1,
    478482        prefix           => 'TN',
    479483        count            => 0,
     
    722726            width     => $w,
    723727            height    => $h,
    724             title     => "pLoader - Piwigo uploader 2.0.0b - [$url]" ,
     728            title     => "pLoader - Piwigo uploader 2.0.0c - [$url]" ,
    725729            pwg       => $self->pwg,
    726730            imagelist => $self->imagelist,
  • extras/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm

    r3159 r3178  
    2424use Wx::DND;
    2525use Wx qw/
     26             wxNullBitmap
    2627             wxID_OK
    2728             wxDEFAULT_FRAME_STYLE
     
    317318          categories
    318319          imagelist
    319           image_prop_general
     320          image_preview
     321          image_prop_piwigo
    320322          image_prop_exif
    321323          notebook_image_properties
    322324          notebook_global_settings
    323           global_settings_panel
     325          general_settings_panel
     326          resized_settings_panel
     327          thumbnail_settings_panel
     328          preview_settings_panel
     329          piwigo_properties
     330          exif_properties
     331          general_settings
     332          resized_settings
     333          thumbnail_settings
     334          preview_settings
     335
    324336      /;
    325337__PACKAGE__->mk_accessors( @properties );
     
    343355use Wx::AUI;
    344356use Storable;
    345 use Uploader::GUI::wxPhotoPropertiesPanel;
    346 use Uploader::GUI::wxPhotoExifPanel;
    347 use Uploader::GUI::wxGlobalSettingsPanel;
     357use Uploader::GUI::wxPropertyGridPanel;
    348358use Encode qw/encode decode is_utf8/;
    349359
     
    416426    $self->manager( Wx::AuiManager->new );
    417427    $self->manager->SetManagedWindow( $self );
    418 
     428    $self->_set_setting_properties;
    419429    $self->_initFrame;
    420430    $self->_InitEventHandlers;
     
    441451}
    442452
     453sub _refreshFrame__ {
     454    my ( $self ) = @_;
     455   
     456    $self->_destroy_settings_panels;
     457    $self->manager->Update;
     458   
     459    $self->_init_settings_panels;
     460    $self->_init_aui_settings_panels;
     461
     462    $self->manager->Update;
     463}
     464
     465sub _set_setting_properties {
     466    my ( $self ) = @_;
     467
     468    $self->piwigo_properties(
     469        [
     470            {
     471                label => "Photo name :",
     472                value => sub { $self->imagelist->current_image->site_name(@_) },
     473            },
     474            {
     475                label => "Comment :",
     476                value => sub { $self->imagelist->current_image->site_comment(@_) },
     477                type  => "LongText",
     478            },
     479            {
     480                label => "Author :",
     481                value => sub { $self->imagelist->current_image->site_author(@_) },
     482            },
     483            {
     484                label    => "Create date :",
     485                value    => sub { $self->imagelist->current_image->create_date(@_) },
     486                readonly => 1,
     487            },
     488        ]   
     489    );
     490
     491    $self->exif_properties(
     492        [
     493            {
     494                label    => gettext("Create date :"),
     495                value    => sub { $self->imagelist->current_image->create_date },
     496                readonly => 1,
     497            }, 
     498            {
     499                label    => gettext("Model :"),
     500                value    => sub { $self->imagelist->current_image->exif_tag('Model') },
     501                readonly => 1,
     502            }, 
     503            {
     504                label    => gettext("Width :"),
     505                value    => sub { $self->imagelist->current_image->exif_tag('ImageWidth') },
     506                readonly => 1,
     507            }, 
     508            {
     509                label    => gettext("Height :"),
     510                value    => sub { $self->imagelist->current_image->exif_tag('ImageHeight') },
     511                readonly => 1,
     512            }, 
     513            {
     514                label    => gettext("Orientation :"),
     515                value    => sub { $self->imagelist->current_image->exif_tag('Orientation') },
     516                readonly => 1,
     517            }, 
     518            {
     519                label    => "ISO :",
     520                value    => sub { $self->imagelist->current_image->exif_tag('ISO') },
     521                readonly => 1,
     522            }, 
     523            {
     524                label    => gettext("Shutter speed :"),
     525                value    => sub { $self->imagelist->current_image->exif_tag('ExposureTime') },
     526                readonly => 1,
     527            }, 
     528            {
     529                label    => gettext("Aperture :"),
     530                value    => sub { $self->imagelist->current_image->exif_tag('ApertureValue') },
     531                readonly => 1,
     532            }, 
     533            {
     534                label    => gettext("Focal length :"),
     535                value    => sub { $self->imagelist->current_image->exif_tag('FocalLength') },
     536                readonly => 1,
     537            }, 
     538            {
     539                label    => gettext("Lens :"),
     540                value    => sub { $self->imagelist->current_image->exif_tag('Lens') },
     541                readonly => 1,
     542            }, 
     543        ]
     544    );   
     545
     546    $self->general_settings(
     547        [
     548            {
     549                label     => gettext("Default author :"),
     550                value   => sub { $self->imagelist->author(@_) },
     551            },
     552            {
     553                label     => gettext("Photo name  prefix :"),
     554                value   => sub { $self->imagelist->default_name_prefix(@_) },
     555            },
     556            {
     557                label     => gettext("Resize site image :"),
     558                type      => 'Bool',
     559                value   => sub { $self->imagelist->create_resized(@_) },
     560            },
     561            {
     562                label     => gettext("Auto rotate image :"),
     563                type      => 'Bool',
     564                value   => sub { $self->imagelist->auto_rotate(@_) },
     565            },
     566            {
     567                label     => gettext("Upload high (original size) :"),
     568                type      => 'Bool',
     569                value   => sub { $self->imagelist->upload_high(@_) },
     570            },
     571        ]   
     572    );
     573   
     574    $self->resized_settings(
     575        [
     576            {
     577                label     => gettext("Site image width :"),
     578                type      => 'Number',
     579                value   => sub { $self->imagelist->resize_w(@_) },
     580            },
     581            {
     582                label     => gettext("Site image height :"),
     583                type      => 'Number',
     584                value   => sub { $self->imagelist->resize_h(@_) },
     585            },
     586            {
     587                label     => gettext("Site image jpeg quality :"),
     588                type      => 'Number',
     589                value   => sub { $self->imagelist->quality(@_) },
     590            },
     591            {
     592                label     => gettext("Site image filter :"),
     593                type      => 'Choice',
     594                value   => sub { $self->imagelist->filter(@_) },
     595                choice    => [ qw/Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc/ ],
     596            },
     597            {
     598                label     => gettext("Site image blur :"),
     599                type      => 'Number',
     600                value   => sub { $self->imagelist->blur(@_) },
     601            },
     602            {
     603                label     => gettext("Site image interlace :"),
     604                type      => 'Choice',
     605                value   => sub { $self->imagelist->interlace(@_) },
     606                choice    => [ qw/None Line Plane Partition JPEG GIF PNG/ ],
     607            },
     608        ]   
     609    );
     610
     611    $self->thumbnail_settings(
     612        [
     613            {
     614                label     => gettext("Site thumbnail size :"),
     615                type      => 'Number',
     616                value   => sub { $self->imagelist->thumb_size(@_) },
     617            },
     618            {
     619                label     => gettext("Site thumbnail jpeg quality :"),
     620                type      => 'Number',
     621                value   => sub { $self->imagelist->th_quality(@_) },
     622            },
     623            {
     624                label     => gettext("Photo selection thumbnail size :"),
     625                type      => 'Number',
     626                value   => sub { $self->imagelist->wx_thumb_size(@_) },
     627            },
     628            {
     629                label     => gettext("Photo selection thumbnail jpeg quality :"),
     630                type      => 'Number',
     631                value   => sub { $self->imagelist->wx_quality(@_) },
     632            },
     633        ]   
     634    );
     635   
     636    $self->preview_settings(
     637        [
     638            {
     639                label     => gettext("Use exif preview when available :"),
     640                type      => 'Bool',
     641                value   => sub { $self->imagelist->use_exif_preview(@_) },
     642            },
     643            {
     644                label     => gettext("Custom preview ratio :"),
     645                type      => 'Number',
     646                value   => sub { $self->imagelist->preview_ratio(@_) },
     647            },
     648        ]   
     649    );
     650       
     651}
     652
    443653sub _refreshFrame {
    444654    my ( $self ) = @_;
    445655   
    446     $self->_destroy_settings_panels;
     656    $self->_set_setting_properties;
     657    $self->_refresh_settings_panels_properties;
     658    map {
     659        $_->Refresh;   
     660    }
     661    (
     662        $self->image_prop_piwigo,
     663        $self->image_prop_exif,
     664        $self->general_settings_panel,
     665        $self->resized_settings_panel,
     666        $self->thumbnail_settings_panel,
     667        $self->preview_settings_panel,
     668    );
     669   
    447670    $self->manager->Update;
    448    
    449     $self->_init_settings_panels;
    450     $self->_init_aui_settings_panels;
    451 
    452     $self->manager->Update;
    453 }
     671}
     672
    454673
    455674sub _destroy_settings_panels {
     
    492711}
    493712
     713sub _refresh_settings_panels_properties {
     714    my ( $self ) = @_; 
     715
     716    $self->image_prop_piwigo->properties(
     717        $self->piwigo_properties
     718    );
     719   
     720    $self->image_prop_exif->properties(
     721        $self->exif_properties
     722    );
     723
     724
     725    $self->general_settings_panel->properties(
     726        $self->general_settings
     727    );   
     728
     729    $self->resized_settings_panel->properties(
     730        $self->resized_settings
     731    );   
     732
     733    $self->thumbnail_settings_panel->properties(
     734        $self->thumbnail_settings,
     735    );   
     736
     737    $self->preview_settings_panel->properties(
     738        $self->preview_settings,
     739    );   
     740       
     741}
     742
    494743sub _init_settings_panels {
    495744    my ( $self ) = @_; 
    496745
    497     $self->global_settings_panel(
    498         $self->create_global_settings_panel()
    499     );   
    500    
    501     $self->global_settings_panel->Show(0);
    502 
    503     $self->image_prop_general(
    504         Uploader::GUI::wxPhotoPropertiesPanel->new(
     746    $self->image_prop_piwigo(
     747        Uploader::GUI::wxPropertyGridPanel->new(
    505748            {
    506                 parentwnd => $self,
    507                 accessors => {
    508                                   $main::ID_PHOTO =>
    509                                       sub {
    510                                             Wx::Bitmap->new(
    511                                                 $self->imagelist->current_image->wx_thumb_file,
    512                                                 $self->GetWxBitmapType($self->imagelist->type),
    513                                             );
    514                                       },
    515                                   $main::ID_PHOTO_NAME =>
    516                                       sub { $self->imagelist->current_image->site_name(@_) },
    517 
    518                                   $main::ID_PHOTO_CREATE_DATE =>
    519                                       sub { $self->imagelist->current_image->create_date(@_) },
    520                                  
    521                                   $main::ID_PHOTO_COMMENT =>
    522                                       sub { $self->imagelist->current_image->site_comment(@_) },
    523                                  
    524                                   $main::ID_PHOTO_AUTHOR =>
    525                                       sub { $self->imagelist->current_image->site_author(@_) },
    526                              },
    527                 frame_callbacks => {
    528                                       $main::ID_PHOTO_NAME =>
     749                parentwnd       => $self,
     750                properties      => $self->piwigo_properties,
     751                frame_callbacks => [
    529752                                          sub {
    530753                                              $self->imageviewer->Refresh();
    531754                                          },
    532                                    },
     755                                   ],
    533756            }
    534757        )
    535758    );
    536759
    537     $self->image_prop_general->Show(0);
    538 
    539        
    540760    $self->image_prop_exif(
    541         Uploader::GUI::wxPhotoExifPanel->new(
     761        Uploader::GUI::wxPropertyGridPanel->new(
    542762            {
    543                 parentwnd => $self,
    544                 frame_callback => sub {
    545                                       $self->imageviewer->Refresh();
    546                                   },
    547                 accessors => {
    548                                   $main::ID_EXIF_CREATE_DATE =>
    549                                       sub { $self->imagelist->current_image->create_date },
    550                                   $main::ID_EXIF_MODEL =>
    551                                       sub { $self->imagelist->current_image->exif_tag('Model') },
    552                                   $main::ID_EXIF_WIDTH =>
    553                                       sub { $self->imagelist->current_image->exif_tag('ImageWidth') },
    554                                   $main::ID_EXIF_HEIGHT =>
    555                                       sub { $self->imagelist->current_image->exif_tag('ImageHeight') },
    556                                   $main::ID_EXIF_ORIENTATION =>
    557                                       sub { $self->imagelist->current_image->exif_tag('Orientation') },
    558                                   $main::ID_EXIF_ISO =>
    559                                       sub { $self->imagelist->current_image->exif_tag('ISO') },
    560                                   $main::ID_EXIF_SHUTTER_SPEED =>
    561                                       sub { $self->imagelist->current_image->exif_tag('ExposureTime') },
    562                                   $main::ID_EXIF_APERTURE =>
    563                                       sub { $self->imagelist->current_image->exif_tag('ApertureValue') },
    564                                   $main::ID_EXIF_FOCAL_LENGTH =>
    565                                       sub { $self->imagelist->current_image->exif_tag('FocalLength') },
    566                                   $main::ID_EXIF_LENS =>
    567                                       sub { $self->imagelist->current_image->exif_tag('Lens') },
    568                              },
     763                parentwnd       => $self,
     764                frame_callbacks => [],
     765                properties      => $self->exif_properties,
    569766            }
    570767        )
    571768    );
     769
     770
     771    $self->general_settings_panel(
     772        Uploader::GUI::wxPropertyGridPanel->new(
     773            {
     774                parentwnd       => $self,
     775                properties      => $self->general_settings,
     776                frame_callbacks => [],
     777            }
     778        )
     779    );   
     780
     781    $self->resized_settings_panel(
     782        Uploader::GUI::wxPropertyGridPanel->new(
     783            {
     784                parentwnd       => $self,
     785                properties      => $self->resized_settings,
     786                frame_callbacks => [],
     787
     788            }
     789        )   
     790    );   
     791
     792    $self->thumbnail_settings_panel(
     793        Uploader::GUI::wxPropertyGridPanel->new(
     794            {
     795                parentwnd       => $self,
     796                properties      => $self->thumbnail_settings,
     797                frame_callbacks => [],
     798
     799            }
     800        )   
     801    );   
     802    $self->preview_settings_panel(
     803        Uploader::GUI::wxPropertyGridPanel->new(
     804            {
     805                parentwnd       => $self,
     806                properties      => $self->preview_settings,
     807                frame_callbacks => [],
     808
     809            }
     810        )   
     811    );   
     812
     813   
     814    $self->general_settings_panel->Show(0);
     815
     816    $self->image_preview(
     817        Wx::StaticBitmap->new(
     818            $self,
     819            -1,
     820            wxNullBitmap
     821        )
     822    );
     823
     824
     825
     826    $self->image_prop_piwigo->Show(0);
     827
     828       
    572829   
    573830    $self->image_prop_exif->Show(0);
     
    632889        ->Right->Position( 0 )->Resizable->CloseButton(0) );
    633890
     891    $self->manager->AddPane
     892      ( $self->image_preview, Wx::AuiPaneInfo->new->Name( "preview" )->Caption(gettext("Photo preview"))
     893        ->Right->Position( 1 )->Resizable->CloseButton(0)->Floatable(0) );
     894
     895
    634896    $self->_init_aui_settings_panels;
    635897
     
    652914
    653915    $self->manager->AddPane
    654       ( $self->create_notebook_global_settings, Wx::AuiPaneInfo->new->Name( "global_settings" )
     916      ( $self->create_notebook_global_settings, Wx::AuiPaneInfo->new->Name( "global_settings" )->Caption(gettext("Global settings"))
    655917        ->Right->Position( 2 )->Resizable->CloseButton(1) );
    656918       
     
    729991    my $pages = [   
    730992        [
    731             $self->image_prop_general,
     993            $self->image_prop_piwigo,
    732994            "Piwigo",
    733995        ],
     
    7511013    my $pages = [   
    7521014        [
    753             $self->global_settings_panel,
    754             gettext("Global settings"),
     1015            $self->general_settings_panel,
     1016            gettext("General"),
     1017        ],
     1018        [
     1019            $self->resized_settings_panel,
     1020            gettext("Resized"),
     1021        ],
     1022        [
     1023            $self->thumbnail_settings_panel,
     1024            gettext("Thumbnail"),
     1025        ],
     1026        [
     1027            $self->preview_settings_panel,
     1028            gettext("Preview"),
    7551029        ],
    7561030    ];
     
    7631037}
    7641038
    765 sub create_global_settings_panel {
    766     my ( $self ) = @_;
    767 
    768     Uploader::GUI::wxGlobalSettingsPanel->new(
    769             {
    770                 parentwnd => $self,
    771                 accessors => {
    772                                   $main::ID_GLOBAL_NAME_PREFIX =>
    773                                       sub { $self->imagelist->default_name_prefix(@_) },
    774                                   $main::ID_GLOBAL_AUTHOR =>
    775                                       sub { $self->imagelist->author(@_) },
    776                                   $main::ID_GLOBAL_THUMB_SIZE =>
    777                                       sub { $self->imagelist->thumb_size(@_) },
    778                                   $main::ID_GLOBAL_RESIZED_W =>
    779                                       sub { $self->imagelist->resize_w(@_) },
    780                                   $main::ID_GLOBAL_RESIZED_H =>
    781                                       sub { $self->imagelist->resize_h(@_) },
    782                                   $main::ID_GLOBAL_HIGH =>
    783                                       sub { $self->imagelist->upload_high(@_)},
    784                              },
    785                 frame_callbacks => {
    786                                    },
    787             }
    788         );
    789 }
     1039
     1040
    7901041
    7911042sub create_tree {
     
    10901341    );
    10911342       
    1092     $self->image_prop_general->SetControlValues();
     1343    $self->image_prop_piwigo->Refresh;
    10931344}
    10941345
     
    11061357    );
    11071358
    1108     $self->image_prop_general->SetControlValues();
    1109     $self->image_prop_exif->SetControlValues();
     1359    $self->image_preview->SetBitmap(
     1360        wxNullBitmap
     1361    );
     1362    $self->image_preview->Refresh;
     1363
     1364   
     1365    $self->image_preview->SetBitmap(
     1366        Wx::Bitmap->new(
     1367            $self->imagelist->current_image->preview_file,
     1368            $self->GetWxBitmapType($self->imagelist->type),
     1369        )
     1370    );
     1371   
     1372    $self->image_preview->Refresh;
     1373   
     1374    $self->manager->Update;
     1375   
     1376    $self->image_prop_piwigo->Refresh;
     1377    $self->image_prop_exif->Refresh;
     1378
    11101379}
    11111380
Note: See TracChangeset for help on using the changeset viewer.