Changeset 5041 for extensions/pLoader/trunk/src
- Timestamp:
- Mar 5, 2010, 7:41:14 AM (15 years ago)
- Location:
- extensions/pLoader/trunk/src/Uploader
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pLoader/trunk/src/Uploader/GUI/DlgCommon.pm
r4784 r5041 20 20 package Uploader::GUI::DlgCommon; 21 21 use strict; 22 use Wx qw/wxDP_ALLOWNONE wxDefaultPosition wxDefaultSize/; 22 23 use Wx::Calendar; 23 24 use Wx::Locale qw/:default/; 24 25 use Data::Dumper; 25 26 use base qw/ 26 27 Class::Accessor::Fast … … 190 191 sprintf("%s/%s/%s", $yyyy, $mm, $dd) 191 192 ); 193 if(-1 eq $value){ 194 $date->SetToCurrent; 195 } 192 196 $ctrl->SetValue($date); 193 197 }, 194 198 }; 195 199 -
extensions/pLoader/trunk/src/Uploader/GUI/Frame.pm
r4973 r5041 291 291 $self->imageviewer_item_refresh(0); 292 292 } 293 $self->OnUpdateNotebook; 293 294 $self->OnUpdateToolbar; 294 295 $event->Skip; … … 335 336 $main::CAPTION => { label=>gettext("Photo caption")}, 336 337 $main::PHOTO_PROPERTIES_CAPTION => { 337 value => sub { $self->imagelist->current_image->site_name(@_) }, 338 value => sub { 339 $self->multi_selection_mode ? 340 $self->imagelist->SetImageSelectionName(@_): 341 $self->imagelist->current_image->site_name(@_) 342 }, 338 343 frame_callback => sub { $self->imageviewer_item_refresh(1); }, 339 344 }, 340 345 $main::COMMENT => { label=>gettext("Comment")}, 341 $main::PHOTO_PROPERTIES_COMMENT => { 342 value => sub { $self->imagelist->current_image->site_comment(@_) }, 346 $main::PHOTO_PROPERTIES_COMMENT => { 347 value => sub { 348 $self->multi_selection_mode ? 349 $self->imagelist->SetImageSelectionComment(@_): 350 $self->imagelist->current_image->site_comment(@_) 351 }, 343 352 frame_callback => sub { $self->imageviewer_item_refresh(1); }, 344 353 }, 345 354 $main::AUTHOR => { label=>gettext("Author")}, 346 355 $main::PHOTO_PROPERTIES_AUTHOR => { 347 value => sub { $self->imagelist->current_image->site_author(@_) }, 356 value => sub { 357 $self->multi_selection_mode ? 358 $self->imagelist->SetImageSelectionAuthor(@_): 359 $self->imagelist->current_image->site_author(@_) 360 }, 348 361 frame_callback => sub { $self->imageviewer_item_refresh(1); }, 349 362 }, … … 351 364 $main::CREATE_DATE => { label=>gettext("Create date")}, 352 365 $main::PHOTO_PROPERTIES_CREATE_DATE => { 353 value => sub { $self->imagelist->current_image->create_date(@_) }, 366 value => sub { 367 $self->multi_selection_mode ? 368 $self->imagelist->SetImageSelectionCreateDate(@_): 369 $self->imagelist->current_image->create_date(@_) 370 }, 354 371 frame_callback => sub { $self->imageviewer_item_refresh(1); }, 355 372 }, 356 373 $main::PRIVACY_LEVEL => { label=>gettext("Who can see the photo?")}, 357 374 $main::PHOTO_PROPERTIES_PRIVACY_LEVEL => { 358 selection => sub { $self->imagelist->current_image->privacy_level(@_)}, 375 selection => sub { 376 $self->multi_selection_mode ? 377 $self->imagelist->SetImageSelectionPrivacyLevel(@_): 378 $self->imagelist->current_image->privacy_level(@_) 379 }, 359 380 choices => wxTheApp->privacy_level_choices, 360 381 }, 361 $main::PHOTO_PROPERTIES_NB => { texts => [gettext("Photo properties"), gettext("Tags")] }, 382 $main::PHOTO_PROPERTIES_NB => { 383 texts => [ 384 gettext("Photo properties"), 385 gettext("Tags") 386 ], 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 ], 391 }, 362 392 $main::PHOTO_PROPERTIES_UPLOAD => { label=>gettext("Upload to Piwigo") }, 363 393 } … … 637 667 ); 638 668 639 #$self->image_tags(640 # sub { eval { $self->imagelist->current_image->site_tags(@_) } }641 #);642 669 $self->image_tags( 643 670 sub { scalar @{$self->imagelist->image_selection} > 1 ? $self->imagelist->SetImageSelectionTags(@_) : $self->imagelist->current_image->site_tags(@_)||[] } … … 1259 1286 } 1260 1287 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 } 1307 1261 1308 sub OnRemoveImages { 1262 1309 my( $self, $event ) = @_; … … 1542 1589 1543 1590 # for batch mode : reset the batch buffer if single selection 1544 $self->imagelist->SetImageSelectionTags([]) if(scalar @{$self->imagelist->image_selection} > 1); 1545 1591 if($self->multi_selection_mode){ 1592 $self->imagelist->SetImageSelectionTags([]); 1593 $self->imagelist->image_selection_privacy_level(-1); 1594 $self->imagelist->image_selection_name(""); 1595 $self->imagelist->image_selection_author(""); 1596 $self->imagelist->image_selection_comment(""); 1597 $self->imagelist->image_selection_create_date(-1); 1598 } 1546 1599 # process image_preview in idle time 1547 1600 # and when current event is processed … … 1553 1606 $self->piwigo_photo_properties_tags->Refresh; 1554 1607 1608 } 1609 1610 sub multi_selection_mode { 1611 my ( $self ) = @_; 1612 1613 scalar @{$self->imagelist->image_selection} > 1; 1555 1614 } 1556 1615 -
extensions/pLoader/trunk/src/Uploader/GUI/Layout/PhotoProperties.pm
r4974 r5041 16 16 use Wx qw( wxVERTICAL wxHORIZONTAL wxALL wxLEFT wxRIGHT wxTOP wxBOTTOM wxCENTRE wxGROW ); 17 17 use Wx qw( wxALIGN_RIGHT wxALIGN_BOTTOM wxALIGN_CENTER wxALIGN_CENTER_VERTICAL wxALIGN_CENTER_HORIZONTAL ); 18 use Wx qw( wxTE_MULTILINE wxDP_DROPDOWN );18 use Wx qw( wxTE_MULTILINE wxDP_DROPDOWN wxDP_ALLOWNONE); 19 19 20 20 # Bitmap functions … … 66 66 $item2->AddWindow( $item9, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); 67 67 68 my( $item10 ) = Wx::DatePickerCtrl->new( $parent, $main::PHOTO_PROPERTIES_CREATE_DATE, Wx::DateTime->new(), wxDefaultPosition, [200,-1], wxDP_ DROPDOWN);68 my( $item10 ) = Wx::DatePickerCtrl->new( $parent, $main::PHOTO_PROPERTIES_CREATE_DATE, Wx::DateTime->new(), wxDefaultPosition, [200,-1], wxDP_ALLOWNONE ); 69 69 $item2->AddWindow( $item10, 0, wxALIGN_CENTER_VERTICAL, 5 ); 70 70 … … 77 77 78 78 my $tags = $_[1]; 79 $tags->{parentwnd}=$parent;80 my( $item13 ) = Uploader::GUI::wxChoiceFilteredPanel->new($tags);79 $tags->{parentwnd}=$parent; 80 my( $item13 ) = Uploader::GUI::wxChoiceFilteredPanel->new($tags); 81 81 $item11->AddWindow( $item13, 0, wxALIGN_CENTER_VERTICAL, 5 ); 82 82 -
extensions/pLoader/trunk/src/Uploader/GUI/wxApp.pm
r4973 r5041 214 214 $self->_init_userdir; 215 215 216 my $conf = retrieve $self->conf_file if -e $self->conf_file; 216 my $conf = retrieve $self->conf_file if -e $self->conf_file; 217 217 218 218 if(defined $conf ){ … … 407 407 while(++$i<$n){ 408 408 push @$list, join( 409 410 411 412 409 ', ', 410 map{ gettext($_) } 411 @$pl[$i..$n] 412 ); 413 413 } 414 414 push @$list, gettext($pl->[$n]); 415 416 415 416 $list; 417 417 } 418 418 … … 425 425 grep {$_} 426 426 map{ 427 428 429 430 427 # a locale may be unavailable due to system limitations ( ex: chinese, japanese when language pack are not installed ) 428 if(Wx::Locale::IsAvailable($_->[1])){ 429 my $locale = Wx::Locale->new($_->[1]); 430 $locale->AddCatalogLookupPathPrefix( 431 431 File::Spec->catfile($self->root_dir, $self->locale_dir) 432 432 ); 433 434 433 $_ if $locale->AddCatalog('pLoader'); 434 } 435 435 } 436 436 @{$self->languages} … … 483 483 Wx::LogMessage gettext("Cannot find translation catalog files for %s. Use default language"), $locale->GetCanonicalName(); 484 484 } 485 $self->locale($locale); 485 $self->locale($locale); 486 486 } 487 487 … … 531 531 532 532 sub _init_imagelist { 533 my ( $self ) = @_; 533 my ( $self ) = @_; 534 534 535 535 my $stored_imagelist; … … 643 643 644 644 sub Login { 645 my ( $self ) = @_; 645 my ( $self ) = @_; 646 646 647 647 $self->login_dlg( … … 650 650 title => gettext("Piwigo login"), 651 651 site_url => sub { $self->site_url(@_) }, 652 site_username => sub { $self->site_username(@_) }, 652 site_username => sub { $self->site_username(@_) }, 653 653 site_password => sub { $self->site_password(@_) }, 654 use_offline => sub { $self->use_offline(@_) }, 654 use_offline => sub { $self->use_offline(@_) }, 655 655 } 656 656 ) … … 677 677 $self->site_url 678 678 ) 679 ); 679 ); 680 680 } 681 681 … … 729 729 ); 730 730 mkdir $userdatadir; 731 } 731 } 732 732 } 733 733 … … 791 791 792 792 map { 793 793 my $image = $self->imagelist->image_sums->{$_}; 794 794 795 795 $wximagelist->Add( … … 864 864 $self->GetWxBitmapType($type), 865 865 )){ 866 867 868 869 866 Wx::LogMessage( 867 gettext("An error has occured. Can not save file %s"), 868 $image_file_out, 869 ) 870 870 }; 871 871 } … … 882 882 categories => gettext("albums"), 883 883 Categories => gettext("Albums"), 884 'Add new category' => gettext("Add new album"), 884 'Add new category' => gettext("Add new album"), 885 885 'Category name' => gettext("Album name :"), 886 886 'New category' => gettext("New album"), … … 943 943 944 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 945 my $expr_params ; 946 eval { $expr_params = read_file( $file ); } ; 947 948 my $paramValues = [] ; 949 if($expr_params){ 950 my $expr = '$paramValues = ' ; 951 $expr .= "$expr_params ; " ; 952 eval $expr ; 953 } 954 955 return unless 'ARRAY' eq ref $paramValues ; 956 957 if(scalar(@$paramValues )){ 958 my $params = $paramValues->[0] ; 959 $self->SetKeyValues($params); 960 } 961 961 } 962 962 963 963 sub _read_default_user_properties { 964 965 966 967 968 969 970 971 972 973 974 975 976 964 my( $self, $file ) = @_ ; 965 966 967 my $expr_params ; 968 eval { $expr_params = read_file( $file ); } ; 969 my $properties; 970 if($expr_params){ 971 my $expr = '$properties = ' ; 972 $expr .= " { $expr_params }; " ; 973 eval $expr ; 974 } 975 $properties = {} unless 'HASH' eq ref $properties; 976 $self->user_defined_properties($properties); 977 977 978 978 } … … 981 981 982 982 sub SetKeyValues { 983 my ( $self, $params )= @_; 983 my ( $self, $params )= @_; 984 984 985 985 foreach( keys %$params ) { -
extensions/pLoader/trunk/src/Uploader/GUI/wxChoiceFilteredPanel.pm
r4800 r5041 383 383 my $choices = $self->choices->()||[]; 384 384 [ 385 grep { $_->{name} =~ / ^$searched/} @$choices385 grep { $_->{name} =~ /$searched/i} @$choices 386 386 ] 387 387 } -
extensions/pLoader/trunk/src/Uploader/GUI/wxImageListCtrl.pm
r4779 r5041 252 252 } 253 253 254 sub GetSelectectItemsCount { 255 my ( $self ) = @_; 256 257 scalar @{$self->GetSelectedItems}; 258 } 254 259 255 260 sub GetSelectedItems { … … 270 275 push @$items, $item 271 276 } 272 277 273 278 $items; 274 279 } -
extensions/pLoader/trunk/src/Uploader/GUI/wxPhotoProperties.pm
r4784 r5041 95 95 $nb->AddPage( $page2, "Tags" ); 96 96 97 $self->{notebook} = $nb; 98 97 99 } 98 100 -
extensions/pLoader/trunk/src/Uploader/ImageList.pm
r5020 r5041 128 128 stop_processing 129 129 image_selection_tags 130 image_selection_privacy_level 131 image_selection_name 132 image_selection_comment 133 image_selection_author 134 image_selection_create_date 130 135 / 131 136 ); … … 736 741 display_mode 737 742 image_selection_tags 743 image_selection_properties 738 744 / 739 745 ] … … 1404 1410 } 1405 1411 1412 sub multi_selection_mode { 1413 my ( $self ) = @_; 1414 1415 scalar @{$self->image_selection} > 1; 1416 } 1417 1418 1406 1419 sub SetImageSelectionTags { 1407 1420 my ( $self, $tags ) = @_; … … 1412 1425 # append to each image 1413 1426 # if multiple selection 1414 if( scalar @{$self->image_selection} > 1){1427 if($self->multi_selection_mode){ 1415 1428 map { 1416 1429 # need to dedup … … 1433 1446 } 1434 1447 1448 1449 sub SetImageSelectionPrivacyLevel { 1450 my ( $self, $privacy_level ) = @_; 1451 1452 # append to each image 1453 # if multiple selection 1454 if($self->multi_selection_mode){ 1455 if(defined $privacy_level){ 1456 $self->image_selection_privacy_level($privacy_level); 1457 map { 1458 $self->GetImage($_)->privacy_level( 1459 $privacy_level 1460 ) ; 1461 }@{$self->image_selection} 1462 }; 1463 } 1464 1465 $self->image_selection_privacy_level; 1466 } 1467 1468 sub SetImageSelectionName { 1469 my ( $self, $name ) = @_; 1470 1471 # append to each image 1472 # if multiple selection 1473 if($self->multi_selection_mode){ 1474 if(defined $name){ 1475 $self->image_selection_name($name); 1476 map { 1477 $self->GetImage($_)->site_name( 1478 $name 1479 ) ; 1480 }@{$self->image_selection} 1481 }; 1482 } 1483 1484 $self->image_selection_name; 1485 } 1486 1487 sub SetImageSelectionAuthor { 1488 my ( $self, $author ) = @_; 1489 1490 # append to each image 1491 # if multiple selection 1492 if($self->multi_selection_mode){ 1493 if(defined $author){ 1494 $self->image_selection_author($author); 1495 map { 1496 $self->GetImage($_)->site_author( 1497 $author 1498 ) ; 1499 }@{$self->image_selection} 1500 }; 1501 } 1502 1503 $self->image_selection_author; 1504 } 1505 1506 sub SetImageSelectionComment { 1507 my ( $self, $comment ) = @_; 1508 1509 # append to each image 1510 # if multiple selection 1511 if($self->multi_selection_mode){ 1512 if(defined $comment){ 1513 $self->image_selection_comment($comment); 1514 map { 1515 $self->GetImage($_)->site_comment( 1516 $comment 1517 ) ; 1518 }@{$self->image_selection} 1519 }; 1520 } 1521 1522 $self->image_selection_comment; 1523 } 1524 1525 1526 sub SetImageSelectionCreateDate { 1527 my ( $self, $date ) = @_; 1528 1529 # append to each image 1530 # if multiple selection 1531 if($self->multi_selection_mode){ 1532 if(defined $date){ 1533 $self->image_selection_create_date($date); 1534 map { 1535 $self->GetImage($_)->create_date( 1536 $date 1537 ) ; 1538 }@{$self->image_selection} 1539 }; 1540 } 1541 1542 $self->image_selection_create_date; 1543 } 1544 1435 1545 1;
Note: See TracChangeset
for help on using the changeset viewer.