Changeset 3383


Ignore:
Timestamp:
Jun 1, 2009, 4:04:58 PM (11 years ago)
Author:
ronosman
Message:

Bug 1004 fixed : keep category tree layout after adding a new category.

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

Legend:

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

    r3374 r3383  
    867867    $self->general_settings_panel->Show(0);
    868868
    869 if(0){
    870     $self->image_preview(
    871         Wx::StaticBitmap->new(
    872             $self,
    873             -1,
    874             wxNullBitmap,
    875             wxDefaultPosition,
    876             [$self->preview_w, $self->preview_h]
    877         )
    878     );
    879 }
    880869    $self->image_preview(
    881870        Uploader::GUI::wxImagePreview->new(
     
    1005994    $self->manager->AddPane
    1006995      ( $self->image_preview, Wx::AuiPaneInfo->new->Name( "preview" )
    1007         ->Floatable(1)->Resizable->CloseButton(1));
     996        ->Floatable(1)->Fixed->CloseButton(1));
    1008997
    1009998
     
    12181207    ) if defined wxTheApp->pwg ;
    12191208   
    1220     $self->tree->ExpandAll;
     1209    #$self->tree->ExpandAll;
    12211210
    12221211}
     
    12561245          $name = $_->[0];
    12571246      }
    1258        $id = $tree->AppendItem(
     1247
     1248      $id = $tree->AppendItem(
    12591249                                   $parent_id,
    12601250                                   $name,
     
    15431533    my ( $self, $event ) = @_;
    15441534
    1545     my $item = $self->tree->GetSelection;
    1546 
    1547     my $category = $self->tree->GetPlData($item);
     1535    my $parent_item = $self->tree->GetSelection;
     1536
     1537    my $category = $self->tree->GetPlData($parent_item);
    15481538    my $category_id;
    15491539   
     
    15591549    if( $dialog->ShowModal != wxID_CANCEL ) {
    15601550        my $name = $dialog->GetValue;
    1561         my ( $status, $status_msg ) = $self->pwg->AddCategories( $name, $category_id);
    1562         $self->_refresh_tree_categories_helper;
     1551        my ( $success, $status_msg, $content ) = $self->pwg->AddCategories( $name, $category_id);
     1552
     1553        if($success){
     1554            $self->_append_category($parent_item, $name, $content->{id});
     1555        }
    15631556    }
    15641557    $dialog->Destroy;
     
    15681561    my ( $self, $event ) = @_;
    15691562
    1570     $self->_refresh_tree_categories_helper;
    1571 }
    1572 
    1573 sub _refresh_tree_categories_helper {
     1563    $self->_refresh_all_categories_helper;
     1564}
     1565
     1566
     1567sub _refresh_all_categories_helper {
    15741568    my ( $self ) = @_; 
    15751569
     
    15801574    $self->pwg->RefreshCategories();
    15811575    $self->populate_tree_categories;
     1576}
     1577
     1578sub _append_category {
     1579    my ( $self, $parent_id, $name, $id ) = @_;
     1580
     1581    $self->tree->SelectItem(
     1582        $self->tree->AppendItem(
     1583            $parent_id,
     1584            $name,
     1585            1,
     1586            -1,
     1587            itemData($id)
     1588        )
     1589    );
    15821590}
    15831591
  • extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm

    r3360 r3383  
    164164   
    165165    $hresult ||= {};
     166
    166167    my $categories = $hresult->{result}{categories};
    167 
    168168
    169169    $categories;       
     
    292292    );
    293293
    294     return ( $result->is_success, $result->status_line );
     294    my $content = {};
     295        eval {
     296            $content = from_json(
     297                $result->content
     298            );
     299        };
     300
     301    return ( $result->is_success, $result->status_line, $content );
    295302       
    296303}
Note: See TracChangeset for help on using the changeset viewer.