Changeset 5103


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.

Location:
extensions/pLoader/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/locale/fr_FR/pLoader.po

    r5041 r5103  
    647647msgstr "Quel est l'album destination ?"
    648648
    649 msgid "Properties of the %s selected photos"
    650 msgstr "Propriétés des %s photos sélectionnées"
    651 
    652 msgid "Tags of the %s selected photos"
    653 msgstr "Tags des %s photos sélectionnées"
     649msgid "Caption"
     650msgstr "Titre"
     651
     652msgid "Who can see?"
     653msgstr "Qui peut voir ?"
     654
     655msgid "You have selected a batch of %s photos"
     656msgstr "Vous avez sélectionné un lot de %s photos"
     657
     658msgid "Changes apply to the whole batch"
     659msgstr "Les modifications s'appliquent à toutes les photos de la sélection"
  • 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;
  • extensions/pLoader/trunk/src/Uploader/GUI/Layout/PhotoPropertiesCategoriesTags.pm

    r4974 r5103  
    2828    my( $parent ) = @_;
    2929    my( $topsizer ) = Wx::BoxSizer->new( wxVERTICAL );
    30    
     30
     31    $parent->{_multi_selection_mode_panel} = Wx::Panel->new(
     32        $parent,
     33        -1,
     34        wxDefaultPosition,
     35        [450, -1]
     36    );
     37
     38    _multi_selection_mode_panel_layout(
     39        $parent->{_multi_selection_mode_panel}
     40    );
     41
     42    $parent->{_multi_selection_mode_panel}->Show(0);
     43
     44    $topsizer->Add(
     45        $parent->{_multi_selection_mode_panel},
     46        0,
     47        wxEXPAND|wxLEFT|wxRIGHT,
     48        5
     49    );
     50
     51
    3152    # defines minimum size
    3253    my( $item2 ) = Wx::Notebook->new( $parent, $main::PHOTO_PROPERTIES_NB, wxDefaultPosition, [450,160], 0 );
     
    3758   
    3859    # the notebook has adaptive size : stretch factor 2, wxEXPAND
    39     $topsizer->Add( $item1, 2, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
     60    $topsizer->Add( $item1, 2, wxEXPAND|wxALL, 5 );
    4061
    4162    my( $item3 ) = Wx::TreeCtrl->new( $parent, $main::PHOTO_PROPERTIES_CATEGORIES, wxDefaultPosition, [450,160], wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT );
    4263    # the notebook has adaptive size : stretch factor 1, wxEXPAND
    43     $topsizer->AddWindow( $item3, 1, wxGROW|wxALL, 5 );
     64    $topsizer->AddWindow( $item3, 1, wxEXPAND|wxALL, 5 );
    4465
    4566    my( $item4 ) = Wx::StaticLine->new( $parent, $main::ID_LINE, wxDefaultPosition, [20,-1], wxLI_HORIZONTAL );
    46     $topsizer->AddWindow( $item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
     67    $topsizer->AddWindow( $item4, 0, wxEXPAND|wxALL, 5 );
    4768
    4869    my( $item5 ) = Wx::Button->new( $parent, $main::PHOTO_PROPERTIES_UPLOAD, "", wxDefaultPosition, [-1,40], 0 );
     
    5172#    $item5->SetForegroundColour( Wx::wxGREEN );
    5273    $item5->SetForegroundColour( Wx::Colour->new(255, 51, 99) );
    53     $topsizer->AddWindow( $item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
     74    $topsizer->AddWindow( $item5, 0, wxEXPAND|wxALL, 5 );
    5475
    5576    $parent->SetSizer( $topsizer );
     
    5879    $topsizer;
    5980}
    60 
    6181use vars qw($TAGS); $TAGS = 10004;
    6282use vars qw($PHOTO_PROPERTIES_TAG); $PHOTO_PROPERTIES_TAG = 10005;
     
    93113sub photo_properties_caption_comments {
    94114    my( $parent ) = @_;
    95     my( $topsizer ) = Wx::BoxSizer->new( wxVERTICAL );
    96    
    97     my( $item1 ) = Wx::BoxSizer->new( wxVERTICAL );
    98    
    99     my( $item2 ) = Wx::StaticText->new( $parent, $main::CAPTION, "text", wxDefaultPosition, wxDefaultSize, 0 );
    100     $item1->AddWindow( $item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
    101 
    102     my( $item3 ) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_CAPTION, "", wxDefaultPosition, [-1,-1], 0 );
    103     $item1->AddWindow( $item3, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
    104 
    105     $topsizer->Add( $item1, 0, wxEXPAND, 5 );
    106 
    107     my( $item4 ) = Wx::BoxSizer->new( wxVERTICAL );
    108    
    109     my( $item5 ) = Wx::StaticText->new( $parent, $main::AUTHOR, "text", wxDefaultPosition, wxDefaultSize, 0 );
    110     $item4->AddWindow( $item5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
    111 
    112     my( $item6 ) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_AUTHOR, "", wxDefaultPosition, [-1,-1], 0 );
    113     $item4->AddWindow( $item6, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
    114 
    115     my( $item7 ) = Wx::StaticText->new( $parent, $main::COMMENT, "text", wxDefaultPosition, wxDefaultSize, 0 );
    116     $item4->AddWindow( $item7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
    117 
    118     # adaptive size : stretch factor 1
    119     # the textctrl has a variable line number
    120     my( $item8 ) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_COMMENT, "", wxDefaultPosition, [-1,-1], wxTE_MULTILINE );
    121     $item4->AddWindow( $item8, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
    122 
    123     my( $item9 ) = Wx::StaticText->new( $parent, $main::CREATE_DATE, "text", wxDefaultPosition, wxDefaultSize, 0 );
    124     $item4->AddWindow( $item9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
    125 
    126     my( $item10 ) = Wx::DatePickerCtrl->new( $parent, $main::PHOTO_PROPERTIES_CREATE_DATE, Wx::DateTime->new(), wxDefaultPosition, [200,-1], wxDP_DROPDOWN );
    127     $item4->AddWindow( $item10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
    128     # adaptive size : stretch factor 3
    129     $topsizer->Add( $item4, 3, wxEXPAND, 5 );
    130 
    131     my( $item11 ) = Wx::BoxSizer->new( wxVERTICAL );
    132    
    133     my( $item12 ) = Wx::StaticText->new( $parent, $main::PRIVACY_LEVEL, "text", wxDefaultPosition, wxDefaultSize, 0 );
    134     $item11->AddWindow( $item12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
    135 
    136     my( $item13 ) = Wx::Choice->new( $parent, $main::PHOTO_PROPERTIES_PRIVACY_LEVEL, wxDefaultPosition, [-1,-1], [], 0 );
    137     $item11->AddWindow( $item13, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
    138 
    139     # adaptive size : stretch factor 1
    140     $topsizer->Add( $item11, 1, wxEXPAND, 5 );
     115
     116    my $topsizer = Wx::BoxSizer->new( wxVERTICAL );
     117
     118    $topsizer->Add(
     119        TextField(
     120            $parent,
     121            $main::CAPTION,
     122            $main::PHOTO_PROPERTIES_CAPTION
     123        ),
     124        0,
     125        wxEXPAND|wxALL,
     126        2
     127    );
     128
     129    $topsizer->Add(
     130        TextField(
     131            $parent,
     132            $main::COMMENT,
     133            $main::PHOTO_PROPERTIES_COMMENT,
     134            1
     135        ),
     136        1,
     137        wxEXPAND|wxALL,
     138        2
     139    );
     140
     141    my $sizer_author_create = Wx::BoxSizer->new( wxVERTICAL );
     142    $sizer_author_create->Add(
     143        TextField(
     144            $parent,
     145            $main::AUTHOR,
     146            $main::PHOTO_PROPERTIES_AUTHOR
     147        ),
     148        1,
     149        wxEXPAND|wxALL,
     150        2
     151    );
     152
     153    $sizer_author_create->Add(
     154        DatepickerField(
     155            $parent,
     156            $main::CREATE_DATE,
     157            $main::PHOTO_PROPERTIES_CREATE_DATE
     158        ),
     159        1,
     160        wxEXPAND|wxALL,
     161        2
     162    );
     163
     164    my $sizer_author_create_privacy = Wx::BoxSizer->new( wxHORIZONTAL );
     165
     166    $sizer_author_create_privacy->Add($sizer_author_create, 0, wxEXPAND|wxALL, 0);
     167
     168    $sizer_author_create_privacy->Add(
     169        ChoiceField(
     170            $parent,
     171            $main::PRIVACY_LEVEL,
     172            $main::PHOTO_PROPERTIES_PRIVACY_LEVEL,
     173            1
     174        ),
     175        1,
     176        wxEXPAND|wxALL,
     177        2
     178    );
     179
     180    $topsizer->Add( $sizer_author_create_privacy, 0, wxEXPAND|wxALL, 2 );
    141181
    142182    $parent->SetSizer( $topsizer );
     
    148188use Wx qw( wxITEM_NORMAL wxITEM_RADIO wxITEM_CHECK );
    149189
     190
     191sub TextField {
     192    my ( $parent, $id_label, $id_textctrl, $expand ) = @_;
     193
     194    $expand ||=0;
     195
     196    my( $sizer ) = Wx::BoxSizer->new( wxVERTICAL );
     197   
     198    $sizer->Add(
     199        Wx::StaticText->new(
     200            $parent,
     201            $id_label,
     202            "text",
     203            wxDefaultPosition,
     204            wxDefaultSize,
     205            0
     206        ),
     207        0,
     208        wxALL,
     209        1
     210    );
     211
     212    $sizer->Add(
     213        Wx::TextCtrl->new(
     214            $parent,
     215            $id_textctrl,
     216            "",
     217            wxDefaultPosition,
     218            [-1,-1],
     219            0
     220        ),
     221        $expand,
     222        wxEXPAND|wxALL,
     223        1
     224    );
     225
     226    $sizer;
     227}
     228
     229sub DatepickerField {
     230    my ( $parent, $id_label, $id_ctrl, $expand ) = @_;
     231
     232    $expand ||=0;
     233
     234    my( $sizer ) = Wx::BoxSizer->new( wxVERTICAL );
     235   
     236    $sizer->Add(
     237        Wx::StaticText->new(
     238            $parent,
     239            $id_label,
     240            "text",
     241            wxDefaultPosition,
     242            wxDefaultSize,
     243            0
     244        ),
     245        0,
     246        wxALL,
     247        1
     248    );
     249
     250    $sizer->Add(
     251        Wx::DatePickerCtrl->new(
     252            $parent,
     253            $id_ctrl,
     254            Wx::DateTime->new(),
     255            wxDefaultPosition,
     256            [200,-1],
     257            wxDP_DROPDOWN
     258        ),
     259        $expand,
     260        wxEXPAND|wxALL,
     261        1
     262    );
     263
     264    $sizer;
     265}
     266
     267sub ChoiceField {
     268    my ( $parent, $id_label, $id_ctrl, $expand ) = @_;
     269
     270    $expand ||=0;
     271
     272    my( $sizer ) = Wx::BoxSizer->new( wxVERTICAL );
     273
     274    $expand||=0;
     275   
     276    $sizer->Add(
     277        Wx::StaticText->new(
     278            $parent,
     279            $id_label,
     280            "text",
     281            wxDefaultPosition,
     282            wxDefaultSize,
     283            0
     284        ),
     285        0,
     286        wxALL,
     287        1
     288    );
     289
     290    $sizer->Add(
     291        Wx::Choice->new(
     292            $parent,
     293            $id_ctrl,
     294            wxDefaultPosition,
     295            [-1,-1],
     296            [],
     297            0
     298        ),
     299        1,
     300        wxEXPAND|wxALL,
     301        1
     302    );
     303
     304    $sizer;
     305}
     306
     307sub _multi_selection_mode_panel_layout{
     308    my ( $panel ) = @_;
     309
     310    my( $item0 ) = Wx::BoxSizer->new( wxVERTICAL );
     311
     312    my $fb = Wx::Font->new( 10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD );
     313    my $fn = Wx::Font->new( 10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL );
     314
     315    $panel->{_text1} = Wx::StaticText->new( $panel, -1, "Text", wxDefaultPosition, wxDefaultSize, 0 );
     316    $panel->{_text1}->SetFont($fb);
     317    $item0->Add( $panel->{_text1}, 0, wxALIGN_LEFT|wxALL, 1 );
     318
     319   
     320    $panel->{_text2} = Wx::StaticText->new( $panel, -1, "Text", wxDefaultPosition, wxDefaultSize, 0 );
     321    $panel->{_text2}->SetFont($fn);
     322    $item0->Add( $panel->{_text2}, 0, wxALIGN_LEFT|wxALL, 1 );
     323
     324    $panel->SetSizer( $item0 );
     325    $item0->SetSizeHints( $panel );
     326
     327}
  • extensions/pLoader/trunk/src/Uploader/ImageList.pm

    r5041 r5103  
    741741                display_mode
    742742                image_selection_tags
    743                 image_selection_properties
    744743            /
    745744        ]
Note: See TracChangeset for help on using the changeset viewer.