Changeset 5537 for extensions


Ignore:
Timestamp:
Apr 1, 2010, 4:23:43 PM (14 years ago)
Author:
ronosman
Message:

Refactor multiselection mode display.

Location:
extensions/pLoader/trunk/src/Uploader/GUI
Files:
2 edited

Legend:

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

    r5536 r5537  
    770770    my ( $self ) = @_;
    771771
    772     $self->piwigo_photo_properties_dlg->{_properties_notebook}->Enable(0);
     772    $self->piwigo_photo_properties_dlg->SetDisabled;
    773773    $self->imageviewer->OnEmpty;
    774774}
     
    777777    my ( $self ) = @_;
    778778
    779     $self->piwigo_photo_properties_dlg->{_properties_notebook}->Enable(1);
     779    $self->piwigo_photo_properties_dlg->SetEnabled;
    780780    $self->imageviewer->OnNotEmpty;
    781781}
     
    10951095            }
    10961096
    1097             if(!scalar @{$self->imageviewer->GetSelectedItems} and $self->piwigo_photo_properties_dlg->{_properties_notebook}->IsEnabled){
    1098                 $self->piwigo_photo_properties_dlg->{_properties_notebook}->Enable(0);
     1097            if(!$self->selected_images_count and $self->piwigo_photo_properties_dlg->IsEnabled){
     1098                $self->piwigo_photo_properties_dlg->SetDisabled;
    10991099            }
    11001100
     
    11041104    );
    11051105
     1106}
     1107
     1108
     1109sub selected_images_count {
     1110    my ( $self ) = @_;
     1111
     1112    scalar @{$self->imageviewer->GetSelectedItems};
    11061113}
    11071114
     
    13701377    my $indx = $event->GetIndex;
    13711378
    1372     $self->piwigo_photo_properties_dlg->{_properties_notebook}->Enable(1)
    1373         if !$self->piwigo_photo_properties_dlg->{_properties_notebook}->IsEnabled;
     1379    $self->piwigo_photo_properties_dlg->SetEnabled
     1380        if !$self->piwigo_photo_properties_dlg->IsEnabled;
    13741381    $self->_on_imageviewer_item_selected($indx);
    13751382
     
    14371444
    14381445
    1439     $self->piwigo_photo_properties_dlg->{_multi_selection_mode_panel}{_text1}->SetLabel(
    1440         sprintf(gettext("You have selected a batch of %s photos"), $self->imageviewer->GetSelectectItemsCount )
    1441     );
    1442 
    1443     $self->piwigo_photo_properties_dlg->{_multi_selection_mode_panel}{_text2}->SetLabel(
    1444         gettext("Changes apply to the whole batch")
    1445     );
    1446 
    1447     $self->piwigo_photo_properties_dlg->{_multi_selection_mode_panel}->Show(1);
    1448     $self->piwigo_photo_properties_dlg->Layout;
     1446    $self->piwigo_photo_properties_dlg->SetMultiSelectionMode(
     1447        $self->imageviewer->GetSelectectItemsCount
     1448    );
    14491449}
    14501450
     
    14521452    my( $self ) = @_;
    14531453
    1454     $self->piwigo_photo_properties_dlg->{_multi_selection_mode_panel}->Show(0);
    1455     $self->piwigo_photo_properties_dlg->Layout;
    1456 
     1454    $self->piwigo_photo_properties_dlg->SetSingleSelectionMode;
    14571455}
    14581456
  • extensions/pLoader/trunk/src/Uploader/GUI/wxPhotoProperties.pm

    r5391 r5537  
    3333                    EVT_CLOSE
    3434                /;
    35 
     35use Wx::Locale qw/:default/;
    3636use Carp;
    3737use Data::Dumper;
     
    119119}
    120120
     121
     122sub SetEnabled {
     123    my ( $self ) = @_;
     124
     125    $self->{_properties_notebook}->Enable(1);
     126}
     127
     128sub SetDisabled {
     129    my ( $self ) = @_;
     130
     131    $self->{_properties_notebook}->Enable(0);
     132}
     133
     134sub IsEnabled {
     135    my ( $self ) = @_;
     136
     137    $self->{_properties_notebook}->IsEnabled;
     138}
     139
     140
     141sub SetMultiSelectionMode {
     142    my ( $self, $count ) = @_;
     143
     144    $self->{_multi_selection_mode_panel}{_text1}->SetLabel(
     145        sprintf(gettext("You have selected a batch of %s photos"), $count )
     146    );
     147
     148    $self->{_multi_selection_mode_panel}{_text2}->SetLabel(
     149        gettext("Changes apply to the whole batch")
     150    );
     151
     152    $self->{_multi_selection_mode_panel}->Show(1);
     153    $self->Layout;
     154}
     155
     156
     157sub SetSingleSelectionMode {
     158    my ( $self ) = @_;
     159
     160    $self->{_multi_selection_mode_panel}->Show(0);
     161    $self->Layout;
     162}
    1211631;
Note: See TracChangeset for help on using the changeset viewer.