Ignore:
Timestamp:
May 15, 2009, 8:41:14 AM (15 years ago)
Author:
ronosman
Message:

Feature 994 added : gui layout management. Use perspective to save/reload gui layout.

File:
1 edited

Legend:

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

    r3269 r3284  
    335335          preview_settings
    336336          toolbar
     337          branding
     338          preview_w
     339          preview_h
     340          perspective
    337341      /;
    338342__PACKAGE__->mk_accessors( @properties );
     
    345349          EVT_LIST_END_LABEL_EDIT
    346350          EVT_LIST_ITEM_SELECTED
     351          EVT_LIST_ITEM_ACTIVATED
    347352          EVT_TREE_ITEM_RIGHT_CLICK
    348353          EVT_LIST_KEY_DOWN
     
    374379                                      wxDEFAULT_FRAME_STYLE|wxMAXIMIZE
    375380                                   );
     381    $self->preview_w(
     382        $params->{preview_w}||400
     383    );
     384
     385    $self->preview_h(
     386        $params->{preview_h}||300
     387    );
     388   
     389    $self->perspective(
     390        $params->{perspective}
     391    );
     392
    376393    $self->pwg( $params->{pwg} );
    377394    $self->imagelist( $params->{imagelist} );
     
    426443    );
    427444
     445
    428446    $self->manager( Wx::AuiManager->new );
     447    $self->manager->SetDockSizeConstraint(1, 1);
    429448    $self->manager->SetManagedWindow( $self );
    430449    $self->_set_setting_properties;
     
    436455}
    437456
     457
    438458sub _initImgTypes {
    439459    my ( $self ) = @_;
     
    461481        [
    462482            {
    463                 label => "Photo name :",
     483                label => gettext("Photo caption :"),
    464484                value => sub { $self->imagelist->current_image->site_name(@_) },
    465485            },
     
    548568            },
    549569            {
    550                 label     => gettext("Default photo name :"),
     570                label     => gettext("Default photo caption :"),
    551571                type      => 'Choice',
    552572                value   => sub { $self->imagelist->default_photo_name(@_) },
     
    563583            },
    564584            {
    565                 label     => gettext("Photo name  prefix :"),
     585                label     => gettext("Photo caption  prefix :"),
    566586                value   => sub { $self->imagelist->default_name_prefix(@_) },
    567587            },
     
    581601                value   => sub { $self->imagelist->upload_high(@_) },
    582602            },
     603#            {
     604#                label     => gettext("Remove uploaded photo from selection :"),
     605#                type      => 'Bool',
     606#                value  => sub { $self->imagelist->remove_uploaded_from_selection(@_) },
     607#            },
    583608        ]   
    584609    );
     
    822847        )   
    823848    );   
    824 
    825849   
    826850    $self->general_settings_panel->Show(0);
     
    830854            $self,
    831855            -1,
    832             wxNullBitmap
     856            wxNullBitmap,
     857            wxDefaultPosition,
     858            [$self->preview_w, $self->preview_h]
    833859        )
    834860    );
    835861
    836 
    837 
    838862    $self->image_prop_piwigo->Show(0);
    839 
    840        
    841863   
    842864    $self->image_prop_exif->Show(0);
     
    890912sub init_aui {
    891913    my ( $self ) = @_;
    892    
     914
    893915    my $url = wxTheApp->site_url;
    894916   
     
    901923    $self->manager->AddPane
    902924      ( $self->create_tree, Wx::AuiPaneInfo->new->Name( "categories" )->Caption(
    903           sprintf("%s - %s", gettext("Piwigo categories"), $url )
     925          sprintf("%s - %s", sprintf("Piwigo %s", wxTheApp->branding->{categories}), $url )
    904926      )
    905927        ->Right->Position( 0 )->Resizable->CloseButton(0) );
     
    920942        ->ToolbarPane->Top->Row( 1 )->LeftDockable( 0 )->RightDockable( 0 ) ) if defined $self->toolbar;
    921943
     944    if( $self->perspective){
     945        $self->manager->LoadPerspective($self->perspective);
     946    }
     947   
    922948    $self->manager->Update;
    923949
     
    929955    $self->manager->AddPane
    930956      ( $self->create_notebook_image_properties, Wx::AuiPaneInfo->new->Name( "photo_properties" )->Caption(gettext("Photo properties"))
    931         ->Right->Position( 1 )->Resizable->CloseButton(0) );
     957        ->Floatable(1)->Resizable->CloseButton(1) );
    932958
    933959    $self->manager->AddPane
    934960      ( $self->create_notebook_global_settings, Wx::AuiPaneInfo->new->Name( "global_settings" )->Caption(gettext("Global settings"))
    935         ->Right->Position( 2 )->Resizable->CloseButton(1) );
    936 
     961        ->Floatable(1)->Resizable->CloseButton(1) );
     962
     963    $self->manager->GetPane("photo_properties")->Show(0);
    937964    $self->manager->GetPane("global_settings")->Show(0);
    938965       
    939966}
    940967
     968sub OnPhotoProperties {
     969    my ( $self ) = @_;
     970
     971    $self->manager->GetPane("photo_properties")->Float;
     972    $self->manager->GetPane("photo_properties")->Show(1);
     973    $self->manager->Update();   
     974       
     975}
     976
    941977sub OnGlobalSettings {
    942978    my ( $self ) = @_;
    943979
    944980    $self->toolbar->EnableTool(104, 0 );
     981    $self->manager->GetPane("global_settings")->Float;
    945982    $self->manager->GetPane("global_settings")->Show(1);
    946983    $self->manager->Update();   
     
    11151152}
    11161153
    1117 #$tree_items is a list of anonymous arrays
    1118 # [ itemLabel, undef, rootInfo, ImageIndex, SelImageIndex ] for the root
    1119 
    1120 # [ itemLabel,
    1121 #       [ childItemLabel,
    1122 #           [...],
    1123 #           childItemdata,
    1124 #           childImageIndex,
    1125 #           childSelImageIndex
    1126 #       ],
    1127 #    Itemdata,
    1128 #    ImageIndex,
    1129 #    SelImageIndex
    1130 # ]
    11311154
    11321155# returns a valid itemData
     
    12171240    EVT_TREE_ITEM_RIGHT_CLICK( $self->tree, $self->tree, \&OnTreeItemRightClick );
    12181241    EVT_LIST_END_LABEL_EDIT( $self, $self->imageviewer, \&OnImageViewerEndLabelEdit );
     1242    EVT_LIST_ITEM_ACTIVATED( $self, $self->imageviewer, \&OnImageViewerItemActivated );
    12191243    EVT_LIST_ITEM_SELECTED($self, $self->imageviewer, \&OnImageViewerItemSelected) ;
    12201244    EVT_LIST_KEY_DOWN($self, $self->imageviewer, \&OnImageViewerKeyDown) ;
     
    12341258    my( $self, $event ) = @_;
    12351259    my $dialog = Wx::FileDialog->new
    1236       ( $self, "Select photos to send", $prevfile, $prevdir,
    1237         "JPEG files (*.jpg)|*.jpg|All(*.*)|*.*",
     1260      ( $self, gettext("Select photos for upload"), $prevfile, $prevdir,
     1261        sprintf("%s (*.jpg)|*.jpg|All(*.*)|*.*", gettext("JPEG files")),
    12381262        wxFD_OPEN|wxFD_MULTIPLE );
    12391263
     
    13321356    }
    13331357    (
    1334         [1+$ID_TREE_CTX_MENU, "Add new category","Add a new category to the current selected category."],
    1335         [2+$ID_TREE_CTX_MENU, "Refresh","Refresh category list."],
     1358        [
     1359            1+$ID_TREE_CTX_MENU,
     1360            wxTheApp->branding->{'Add new category'},
     1361            sprintf(
     1362                "%s %s %s %s",
     1363                gettext("Add a new"),
     1364                wxTheApp->branding->{category},
     1365                gettext("to the currently selected"),
     1366                wxTheApp->branding->{category},
     1367            )
     1368        ],
     1369        [
     1370            2+$ID_TREE_CTX_MENU,
     1371            "Refresh",
     1372            sprintf(
     1373                "Refresh %s list.",
     1374                wxTheApp->branding->{category},
     1375            )
     1376        ],
    13361377    );
    13371378    $self->PopupMenu($ctx_mnu, $point);
     
    13511392    my $dialog = Wx::TextEntryDialog->new(
    13521393        $self,
    1353         gettext("Category name :"),
    1354         gettext("Add new category"),
    1355         gettext("New category"),
     1394        sprintf("Category name :", wxTheApp->branding->{Category}),
     1395        sprintf("Add new %s", wxTheApp->branding->{category}),
     1396        sprintf("New %s", wxTheApp->branding->{category}),
    13561397    );
    13571398
     
    13901431       
    13911432    $self->image_prop_piwigo->Refresh;
     1433}
     1434
     1435sub OnImageViewerItemActivated {
     1436    my( $self, $event ) = @_;
     1437
     1438    $self->OnPhotoProperties;
    13921439}
    13931440
     
    15911638        Wx::MessageBox(
    15921639            sprintf(
    1593                 gettext("Please select a valid target category"),
     1640                "%s %s",
     1641                gettext("Please select a valid target"),
     1642                wxTheApp->branding->{category}
    15941643            ),
    15951644            gettext("Piwigo upload error"),
     
    16321681  my $self = shift;
    16331682
     1683
    16341684    # Restaure previous log wnd
    16351685    Wx::Log::SetActiveTarget( $self->oldlogwnd );
     
    16411691    $self->imagelist->Store;
    16421692    wxTheApp->login_dlg->Destroy;       
     1693
     1694    my $params = {};
     1695
     1696    ( $params->{'X'}, $params->{'Y'} ) = $self->GetPositionXY ;
     1697    ( $params->{'Width'}, $params->{'Height'} ) = $self->GetSizeWH ;
     1698    ( $params->{'PreviewWidth'}, $params->{'PreviewHeight'} ) = $self->image_preview->GetSizeWH ;
     1699    $params->{Perspective} = $self->manager->SavePerspective;
     1700   
     1701
     1702    wxTheApp->SaveConfig( $params );
     1703
    16431704    $self->Destroy;
    16441705}
Note: See TracChangeset for help on using the changeset viewer.