Ignore:
Timestamp:
Mar 11, 2010, 10:38:04 AM (14 years ago)
Author:
ronosman
Message:

Feature 1478 added : Ability to set properties for a batch of selected photos. New implementation with specific gui layout.

File:
1 edited

Legend:

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

    r5041 r5103  
    291291                $self->imageviewer_item_refresh(0);
    292292            }
    293             $self->OnUpdateNotebook;
     293
    294294            $self->OnUpdateToolbar;
    295295            $event->Skip;
     
    334334    $self->piwigo_photo_properties(
    335335        {
    336             $main::CAPTION => { label=>gettext("Photo caption")},
     336            $main::CAPTION => { label=>gettext("Caption")},
    337337            $main::PHOTO_PROPERTIES_CAPTION => {
    338338                value => sub {
     
    371371                frame_callback => sub { $self->imageviewer_item_refresh(1); },
    372372            },
    373             $main::PRIVACY_LEVEL => { label=>gettext("Who can see the photo?")},
     373            $main::PRIVACY_LEVEL => { label=>gettext("Who can see?")},
    374374            $main::PHOTO_PROPERTIES_PRIVACY_LEVEL => {
    375375                selection => sub {
     
    382382            $main::PHOTO_PROPERTIES_NB => {
    383383                texts => [
    384                     gettext("Photo properties"),
     384                    gettext("Properties"),
    385385                    gettext("Tags")
    386386                ],
    387                 multi_texts => [
    388                     sub { sprintf(gettext("Properties of the %s selected photos"), $self->imageviewer->GetSelectectItemsCount ) },
    389                     sub { sprintf(gettext("Tags of the %s selected photos"), $self->imageviewer->GetSelectectItemsCount) },
    390                 ],
    391387            },
    392388            $main::PHOTO_PROPERTIES_UPLOAD => { label=>gettext("Upload to Piwigo") },
     
    12861282}
    12871283
    1288 sub OnUpdateNotebook{
    1289     my( $self ) = @_;
    1290 
    1291     # Notebook page caption change according to photo selection
    1292     # include count when selection is multiple
    1293     my $texts;
    1294     if(!$self->multi_selection_mode){
    1295         $texts = $self->piwigo_photo_properties->{$main::PHOTO_PROPERTIES_NB}->{texts};
    1296     }
    1297     else {
    1298         $texts = [ map { $_->() } @{$self->piwigo_photo_properties->{$main::PHOTO_PROPERTIES_NB}->{multi_texts}} ];
    1299     }
    1300 
    1301     $texts||=[];
    1302     for(my $i=0; $i < scalar @$texts ; $i++){
    1303         $self->dlg_piwigo_photo_properties->{notebook}->SetPageText($i, $texts->[$i]);
    1304     }
    1305 
    1306 }
    13071284
    13081285sub OnRemoveImages {
     
    13211298        $self->piwigo_photo_properties_tags->ClearAllSelection;
    13221299        $self->imagelist->SetCurrentImage(-1);
     1300    }
     1301    if(!$self->multi_selection_mode){
     1302        $self->OnUpdateSingleSelectionModeUI;
    13231303    }
    13241304
     
    15901570    # for batch mode : reset the batch buffer if single selection
    15911571    if($self->multi_selection_mode){
     1572        $self->OnUpdateMultiSelectionModeUI;
    15921573        $self->imagelist->SetImageSelectionTags([]);
    15931574        $self->imagelist->image_selection_privacy_level(-1);
     
    15971578        $self->imagelist->image_selection_create_date(-1);
    15981579    }
     1580    else{
     1581        $self->OnUpdateSingleSelectionModeUI;
     1582    }
    15991583    # process image_preview in idle time
    16001584    # and when current event is processed
     
    16131597    scalar @{$self->imagelist->image_selection} > 1;
    16141598}
     1599
     1600sub OnUpdateMultiSelectionModeUI{
     1601    my( $self ) = @_;
     1602
     1603
     1604    $self->dlg_piwigo_photo_properties->{_multi_selection_mode_panel}{_text1}->SetLabel(
     1605        sprintf(gettext("You have selected a batch of %s photos"), $self->imageviewer->GetSelectectItemsCount )
     1606    );
     1607
     1608    $self->dlg_piwigo_photo_properties->{_multi_selection_mode_panel}{_text2}->SetLabel(
     1609        gettext("Changes apply to the whole batch")
     1610    );
     1611
     1612    $self->dlg_piwigo_photo_properties->{_multi_selection_mode_panel}->Show(1);
     1613    $self->dlg_piwigo_photo_properties->Layout;
     1614}
     1615
     1616sub OnUpdateSingleSelectionModeUI{
     1617    my( $self ) = @_;
     1618
     1619    $self->dlg_piwigo_photo_properties->{_multi_selection_mode_panel}->Show(0);
     1620    $self->dlg_piwigo_photo_properties->Layout;
     1621
     1622}
     1623
    16151624
    16161625sub set_preview_image {
     
    16821691    ) if !$self->imageviewer->GetItemCount;
    16831692
     1693    # reset previous selection
     1694    $self->imagelist->image_selection(
     1695        []
     1696    );
     1697
     1698    if(!$self->multi_selection_mode){
     1699        $self->OnUpdateSingleSelectionModeUI;
     1700    }
    16841701
    16851702    $self->image_preview->Refresh;
Note: See TracChangeset for help on using the changeset viewer.