Changeset 6707 for extensions/pLoader/trunk
- Timestamp:
- Jul 26, 2010, 11:21:44 AM (14 years ago)
- Location:
- extensions/pLoader/trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pLoader/trunk/locale/fr_FR/pLoader.po
r6094 r6707 721 721 msgid "Square" 722 722 msgstr "Carrée" 723 724 msgid "cancelled" 725 msgstr "annulé" 726 727 msgid "sending files" 728 msgstr "envoi de fichiers" 729 730 msgid "checking files" 731 msgstr "validation de fichiers" 732 733 msgid "files checked" 734 msgstr "fichiers validés" 735 736 msgid "transfered" 737 msgstr "transféré" 738 739 msgid "updating" 740 msgstr "mise à jour" 741 742 msgid "updating files" 743 msgstr "mise à jour de fichiers" 744 745 msgid "files updated" 746 msgstr "fichiers mis à jour" 747 748 msgid "updating properties" 749 msgstr "mise à jour de propriétés" 750 751 msgid "properties updated" 752 msgstr "propriétés mises à jour" 753 754 msgid "prepared, waiting for transfer" 755 msgstr "préparée, transfert en attente" 756 757 msgid "preparing web size" 758 msgstr "préparation taille web" 759 760 msgid "web size prepared" 761 msgstr "taille web préparée" 762 763 msgid "preparing high" 764 msgstr "préparation haute définition" 765 766 msgid "high prepared" 767 msgstr "haute définition préparée" 768 769 msgid "start sending" 770 msgstr "Début d'envoi" 771 772 msgid "sending" 773 msgstr "envoie" -
extensions/pLoader/trunk/src/Uploader/GUI/App.pm
r6538 r6707 73 73 74 74 my @app_properties = qw/ 75 localized_msg 75 76 version 76 77 frame … … 140 141 batch_end_event 141 142 image_progress_event 143 image_done_event 142 144 /; 143 145 … … 469 471 $self->current_language 470 472 ); 473 471 474 $locale->AddCatalogLookupPathPrefix( 472 475 File::Spec->catfile($self->root_dir, $self->locale_dir) … … 582 585 ] 583 586 ); 587 588 589 $self->localized_msg( 590 { 591 map { $_ => gettext($_) } ( 592 'cancelled', 593 'sending files', 594 'checking files', 595 'files checked', 596 'transfered', 597 'updating', 598 'updating files', 599 'files updated', 600 'updating properties', 601 'properties updated', 602 'prepared, waiting for transfer', 603 'preparing web size', 604 'web size prepared', 605 'preparing high', 606 'high prepared', 607 'start sending', 608 'sending', 609 610 ) 611 } 612 ); 613 614 print Dumper $self->localized_msg; 584 615 585 616 } … … 727 758 batch_end_event => $resize_batch_end_event, 728 759 event_handler => $self, 760 localized_msg => $self->localized_msg, 729 761 }) 730 762 ); … … 817 849 } 818 850 851 852 sub on_image_done { 853 my ( $self, $image ) = @_; 854 855 Wx::PostEvent( 856 $self->frame, 857 Wx::PlThreadEvent->new( 858 -1, 859 $self->image_done_event, 860 $image 861 ) 862 ); 863 } 819 864 820 865 sub init_images { … … 1108 1153 use_offline => $self->use_offline, 1109 1154 version => $self->version, 1155 localized_msg => $self->localized_msg, 1110 1156 } 1111 1157 ) … … 1229 1275 event_handler => $self, 1230 1276 batch_end_event => $transfer_batch_end_event, 1277 localized_msg => $self->localized_msg, 1231 1278 }) 1232 1279 ); 1233 1280 1234 1281 $self->image_progress_event( 1282 Wx::NewEventType 1283 ); 1284 1285 $self->image_done_event( 1235 1286 Wx::NewEventType 1236 1287 ); … … 1289 1340 my ( $handler, $event ) = @_; 1290 1341 my $data = $event->GetData; 1291 $handler->on_image_ progress($data);1342 $handler->on_image_done($data); 1292 1343 } 1293 1344 ); -
extensions/pLoader/trunk/src/Uploader/GUI/Frame.pm
r6538 r6707 484 484 ) 485 485 ); 486 wxTheApp->layout_clean(1);487 486 }, 488 487 }, … … 1062 1061 my $data = $event->GetData; 1063 1062 $handler->upload_progressdlg->batch_end($data); 1063 wxTheApp->images->remove_processed; 1064 $handler->refresh_image_context; 1065 } 1066 ); 1067 1068 Wx::Event::EVT_COMMAND( 1069 $self, 1070 -1, 1071 wxTheApp->image_done_event, 1072 sub { 1073 my ( $handler, $event ) = @_; 1074 my $data = $event->GetData; 1075 printf("image_done_event %s\n", Dumper $data); 1076 if($data->{preferences}{remove_uploaded_from_selection}){ 1077 my $gr = $data->{global_rank}; 1078 if(defined $gr){ 1079 wxTheApp->images->set_to_be_removed($gr) if $data->{transfer_successful}; 1080 } 1081 } 1064 1082 } 1065 1083 ); … … 1124 1142 1125 1143 $self->images->remove_selection; 1126 $self->imageviewer->Refresh; 1127 1128 if (!$self->imageviewer->GetItemCount){ 1144 $self->refresh_image_context; 1145 } 1146 1147 sub refresh_image_context { 1148 my ( $self ) = @_; 1149 1150 $self->imageviewer->Refresh; 1151 1152 if ($self->imageviewer->is_empty){ 1129 1153 $self->image_preview_dlg->image( 1130 1154 0 -
extensions/pLoader/trunk/src/Uploader/GUI/wxChoiceFilteredPanel.pm
r5542 r6707 459 459 my( $self, $event ) = @_; 460 460 461 $self-> init_choices_list(461 $self->refresh_choices_list( 462 462 $self->choices->() 463 463 ); -
extensions/pLoader/trunk/src/Uploader/GUI/wxImageListCtrl.pm
r6426 r6707 543 543 544 544 545 545 sub is_empty { 546 my ( $self ) = @_; 547 548 !$self->GetItemCount; 549 } 546 550 1; 547 551 -
extensions/pLoader/trunk/src/Uploader/Images.pm
r6538 r6707 31 31 author 32 32 type 33 global_rank 34 global_rank_indx 33 35 /; 34 36 … … 37 39 /; 38 40 41 my @tmp_properties = qw/ 42 to_be_removed_grank 43 /; 44 45 39 46 __PACKAGE__->mk_accessors(@cbk_properties); 40 47 __PACKAGE__->mk_accessors(@storable_properties); 41 48 __PACKAGE__->mk_accessors(@app_properties); 42 43 my $_global_rank = -1; 49 __PACKAGE__->mk_accessors(@tmp_properties); 50 44 51 45 52 sub Init { … … 49 56 $self->ordered_image_ids([]) if !defined $self->ordered_image_ids; 50 57 $self->selection([]) if !defined $self->selection; 58 $self->global_rank(-1) if !defined $self->global_rank; 59 $self->global_rank_indx({}) if !defined $self->global_rank_indx; 60 $self->to_be_removed_grank([]) if !defined $self->to_be_removed_grank; 51 61 } 52 62 … … 90 100 $self->ordered_image_ids->[$i] = $image_id ; 91 101 102 $self->global_rank( 103 1+$self->global_rank 104 ); 105 106 $self->global_rank_indx->{ 107 $self->global_rank 108 } = $i; 92 109 93 110 my $image = $self->_images->{ … … 104 121 site_tags => [], 105 122 site_high_file => $file->{ANSIPathName}, 106 global_rank => ++$_global_rank,123 global_rank => $self->global_rank, 107 124 } 108 125 ); … … 176 193 my ( $self, $indx ) = @_; 177 194 195 return unless defined $indx; 178 196 my $id = $self->ordered_image_ids->[$indx]; 179 197 … … 222 240 223 241 242 sub remove_processed { 243 my ( $self ) = @_; 244 245 return if ( $self->is_empty ); 246 return if (! defined $self->to_be_removed_grank ); 247 248 my $to_remove_indx = []; 249 # check if the global rank correspond 250 # the image may have changed 251 foreach(@{$self->to_be_removed_grank}) { 252 my $indx = $self->global_rank_indx->{$_}; 253 my $img; 254 if(defined $indx){ 255 $img = $self->get_image($indx); 256 } 257 if(defined $img){ 258 push @$to_remove_indx, $indx if 259 $img->global_rank == $_; 260 } 261 } 262 263 $self->_remove_selection($to_remove_indx); 264 # clear image selection 265 $self->to_be_removed_grank([]); 266 } 267 268 224 269 sub _remove_selection { 225 270 my ( $self, $list ) = @_; 271 printf("_remove_selection %s\n", Dumper $list); 226 272 # the list is sorted, ascendant 227 273 # we reverse it to have … … 238 284 } 239 285 286 287 # postpone actual removal. 288 sub set_to_be_removed { 289 my ( $self, $global_rank ) = @_; 290 291 push @{$self->to_be_removed_grank}, $global_rank; 292 } 293 294 240 295 sub delete_image { 241 296 my ( $self, $indx ) = @_; … … 245 300 # have to check if that id is used more than once 246 301 my $count = grep { $id eq $_} @{$self->ordered_image_ids}; 302 303 # global rank is unique 304 delete $self->global_rank_indx->{ 305 $self->_images->{$id}->global_rank 306 }; 247 307 248 308 delete $self->_images->{$id} unless $count > 1; … … 517 577 518 578 579 # when the progress list is cleared 519 580 sub reset_add_rank { 520 581 my ( $self ) = @_; -
extensions/pLoader/trunk/src/Uploader/Object.pm
r6426 r6707 31 31 version 32 32 storable_file 33 localized_msg 33 34 /); 34 35 -
extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm
r6426 r6707 19 19 # +-----------------------------------------------------------------------+ 20 20 package Uploader::PWG::WebServices; 21 21 use threads; 22 use threads::shared; 23 22 24 use strict; 23 25 use warnings; … … 238 240 ); 239 241 } 240 242 241 243 return ( $result->is_success, $result->status_line ); 242 244 } … … 514 516 $self->log_image_progress( 515 517 $image, 516 sprintf("sending %s", $image->{file_type_code}), 518 sprintf( 519 "%s : %s", 520 $self->localized_msg->{"start sending"}, 521 $image->{file_type_code} 522 ), 517 523 0, 518 524 ); … … 553 559 $self->log_image_progress( 554 560 $image, 555 sprintf("sending %s", $image->{file_type_code}), 561 sprintf( 562 "%s : %s", 563 $self->localized_msg->{"sending"}, 564 $image->{file_type_code} 565 ), 556 566 100*($chunk_pos/$content_length), 557 567 ); … … 604 614 605 615 } 616 606 617 607 618 sub add_image { -
extensions/pLoader/trunk/src/Uploader/ResizeManager.pm
r6522 r6707 15 15 16 16 Uploader::ResizeWorker->new({ 17 thumb_dir => $self->thumb_dir, 18 wx_thumb_dir => $self->wx_thumb_dir, 19 resized_dir => $self->resized_dir, 20 preferences => $self->preferences, 21 write_type => 'jpg', 17 thumb_dir => $self->thumb_dir, 18 wx_thumb_dir => $self->wx_thumb_dir, 19 resized_dir => $self->resized_dir, 20 preferences => $self->preferences, 21 write_type => 'jpg', 22 localized_msg => $self->localized_msg, 22 23 }); 23 24 } -
extensions/pLoader/trunk/src/Uploader/ResizeWorker.pm
r6538 r6707 37 37 $self->log_image_progress( 38 38 $image, 39 "cancelled",39 $self->localized_msg->{"cancelled"}, 40 40 0, 41 41 ); … … 80 80 my ( $self, $image ) = @_; 81 81 82 $image->{status} = "prepared, waiting for transfer";82 $image->{status} = $self->localized_msg->{"prepared, waiting for transfer"}; 83 83 $image->{progress} = 25; 84 84 … … 114 114 ); 115 115 116 Wx::PostEvent($self->event_handler, $thread_event); 116 eval { 117 Wx::PostEvent($self->event_handler, $thread_event); 118 } 119 117 120 } 118 121 … … 123 126 $self->log_image_progress( 124 127 $image, 125 "creating web size",128 $self->localized_msg->{"preparing web size"}, 126 129 5, 127 130 ); … … 140 143 $self->log_image_progress( 141 144 $image, 142 "web size created",145 $self->localized_msg->{"web size prepared"}, 143 146 10, 144 147 ); … … 338 341 $self->log_image_progress( 339 342 $image, 340 "preparing high",343 $self->localized_msg->{"preparing high"}, 341 344 15, 342 345 ); … … 447 450 $self->log_image_progress( 448 451 $image, 449 "high prepared",452 $self->localized_msg->{"high prepared"}, 450 453 25, 451 454 ); -
extensions/pLoader/trunk/src/Uploader/TransferManager.pm
r6525 r6707 6 6 use base qw/Uploader::ThreadManager/; 7 7 use Uploader::TransferWorker; 8 use vars qw/$AUTOLOAD/;9 8 __PACKAGE__->mk_accessors(qw/ 10 9 pwg … … 18 17 19 18 Uploader::TransferWorker->new({ 20 pwg => $self->pwg, 19 pwg => $self->pwg, 20 localized_msg => $self->localized_msg, 21 21 }); 22 22 … … 27 27 my ( $self ) = @_; 28 28 29 !scalar @{$self->destination_category}; 29 defined $self->destination_category ? 30 !scalar @{$self->destination_category} : 31 1; 30 32 } 31 33 -
extensions/pLoader/trunk/src/Uploader/TransferWorker.pm
r6538 r6707 34 34 return unless $image->{image_id}; 35 35 36 $self->log_image_progress( 37 $image, 38 "cancelled", 39 0, 40 ); 36 ( $image->{status}, $image->{progress} ) = ($self->localized_msg->{"cancelled"}, 0); 37 $self->post_image_progress_event($image); 41 38 } 42 39 … … 49 46 ); 50 47 51 52 48 $self->progress_event( 53 49 $progress_event … … 57 53 $transfer_done_event 58 54 ); 59 55 60 56 61 57 if(!$self->exists_image($image)){ … … 66 62 } 67 63 64 $self->post_image_done_event($image); 68 65 } 69 66 … … 81 78 my ( $self, $image ) = @_; 82 79 83 $self->log_image_progress($image, "sending files", 0); 80 ( $image->{status}, $image->{progress} ) = ($self->localized_msg->{"sending files"}, 0); 81 $self->post_image_progress_event($image); 82 84 83 $self->add_image_files($image); 85 84 $self->add_image($image); 86 $self->log_image_progress($image, "transfered", 100); 87 88 } 89 90 91 sub log_image_progress { 92 my ( $self, $image, $status, $value ) = @_; 93 94 $image->{status} = $status; 95 $image->{progress} = $value; 85 96 86 $self->post_image_progress_event($image); 97 87 } … … 110 100 111 101 112 $self->log_image_progress($image, "check files", 0); 102 ( $image->{status}, $image->{progress} ) = ($self->localized_msg->{"checking files"}, 0); 103 $self->post_image_progress_event($image); 104 113 105 my @file_types = ('site_resized_file', 'site_thumb_file'); 114 106 push @file_types, 'site_high_file' if $image->{upload_high}; … … 118 110 }@file_types; 119 111 120 $self->log_image_progress($image, "files checked", 100); 112 ( $image->{status}, $image->{progress} ) = ($self->localized_msg->{"files checked"}, 100); 113 $self->post_image_progress_event($image); 121 114 } 122 115 … … 157 150 my ( $self, $image ) = @_; 158 151 159 $self->pwg->add_image($image); 152 my ( $is_success, $status_line ) = $self->pwg->add_image($image); 153 154 $image->{transfer_successful} = $is_success; 155 $image->{status} = $is_success ? $self->localized_msg->{"transfered"} : $status_line ; 160 156 } 161 157 … … 164 160 my ( $self, $image ) = @_; 165 161 166 $self->log_image_progress($image, "updating", 0); 162 163 ( $image->{status}, $image->{progress} ) = ($self->localized_msg->{"updating"}, 0); 164 $self->post_image_progress_event($image); 167 165 168 166 $self->update_image_files($image); 167 $self->post_image_progress_event($image); 168 169 169 $self->update_image_properties($image); 170 171 $self->log_image_progress($image, "updated", 100); 170 $self->post_image_progress_event($image); 172 171 } 173 172 … … 177 176 178 177 if($image->{preferences}{reupload_action_files}){ 179 $self->log_image_progress($image, "updating files", 0); 178 ( $image->{status}, $image->{progress} ) = ($self->localized_msg->{"updating files"}, 0); 179 $self->post_image_progress_event($image); 180 180 181 $self->init_image_files_checksums($image); 181 182 $self->update_image_modified_files($image); 182 $self->log_image_progress($image, "files updated", 100);183 183 } 184 184 } … … 188 188 my ( $self, $image ) = @_; 189 189 190 $self->pwg->update_image_modified_files($image); 190 my ( $is_success, $status_line ) = $self->pwg->update_image_modified_files($image); 191 $image->{transfer_successful} = $is_success; 192 $image->{status} = $is_success ? $self->localized_msg->{"files updated"} : $status_line ; 191 193 } 192 194 … … 195 197 my ( $self, $image ) = @_; 196 198 197 $self->log_image_progress($image, "updating properties", 0); 198 $self->pwg->update_image_properties($image); 199 $self->log_image_progress($image, "properties updated", 100); 199 ( $image->{status}, $image->{progress} ) = ($self->localized_msg->{"updating properties"}, 0); 200 $self->post_image_progress_event($image); 201 202 my ( $is_success, $status_line ) = $self->pwg->update_image_properties($image); 203 204 $image->{transfer_successful} = $is_success; 205 $image->{status} = $is_success ? $self->localized_msg->{"properties updated"} : $status_line ; 206 } 207 208 209 sub post_image_done_event { 210 my ( $self, $image ) = @_; 211 212 $image->{progress} = 100; 213 214 $self->post_image_event( 215 $self->done_event, 216 $image 217 ); 200 218 } 201 219 … … 219 237 shared_clone($image) 220 238 ); 221 Wx::PostEvent($self->event_handler, $thread_event); 239 240 eval { 241 Wx::PostEvent($self->event_handler, $thread_event); 242 } 222 243 } 223 244
Note: See TracChangeset
for help on using the changeset viewer.