Changeset 4475
- Timestamp:
- Dec 12, 2009, 12:48:34 AM (14 years ago)
- Location:
- extensions/pLoader/trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pLoader/trunk/src/Uploader/GUI/DlgCommon.pm
r4469 r4475 12 12 ); 13 13 14 sub InitHandler { 15 my ( $self ) = @_; 16 17 # to connect the right event handler to each control 18 my $ctrl_handlers = { 19 'Wx::TextCtrl' => sub { my ( $ctrl ) = @_; Wx::Event::EVT_TEXT( $ctrl, $ctrl, sub { $self->OnTextCtrl(@_) } ); }, 20 }; 21 22 map { 23 my $ctrl =$self->FindWindow($_); 24 if(defined $ctrl){ 25 $ctrl_handlers->{ ref $ctrl}->($ctrl) if exists $ctrl_handlers->{ ref $ctrl}; 26 } 27 } 28 keys %{$self->properties}; 29 30 31 } 32 33 # what does happen when the text changes 34 sub OnTextCtrl { 35 my ( $self, $ctrl, $event ) = @_; 36 37 printf("OnTextCtrl %s, %s\n", $ctrl->GetId, $event->GetString); 38 my $id = $ctrl->GetId; 39 # change the property value 40 $self->properties->{$id}->{value}->( 41 $event->GetString 42 ) if exists $self->properties->{$id}->{value}; 43 44 # exec the callback 45 $self->properties->{$id}->{frame_callback}->() if exists 46 $self->properties->{$id}->{frame_callback}; 47 48 } 49 50 my $change_value = { 51 'Wx::TextCtrl' => sub { my ($ctrl, $value ) = @_; $ctrl->ChangeValue($value)}, 52 'Wx::CheckBox' => sub { my ($ctrl, $value ) = @_; $ctrl->SetValue($value)}, 53 }; 14 54 15 55 sub SetProperties { … … 20 60 #printf("ctrl %s : %s\n", $_, $ctrl); 21 61 if(defined $ctrl){ 22 # checkbox, static text 23 $ctrl->SetLabel( 24 $self->properties->{$_}->{label} 25 ) if exists$self->properties->{$_}->{label}; 26 27 $ctrl->SetValue( 28 $self->properties->{$_}->{value}->() 29 ) if exists$self->properties->{$_}->{value}; 30 31 # radiobox 32 my $labels =$self->properties->{$_}->{labels}; 33 $labels||=[]; 34 for(my $i=0; $i < scalar @$labels ; $i++){ 35 $ctrl->SetItemLabel($i, $labels->[$i]); 36 } 37 # only works for control with items 38 $ctrl->SetSelection( 39 $self->properties->{$_}->{selection}->() 40 ) if exists $self->properties->{$_}->{selection}; 41 62 # checkbox, static text 63 $change_value->{ref $ctrl}->( 64 $ctrl, 65 $self->properties->{$_}->{value}->() 66 ) if exists $self->properties->{$_}->{value}; 67 # only works for control with items 68 $ctrl->SetSelection( 69 $self->properties->{$_}->{selection}->() 70 ) if exists $self->properties->{$_}->{selection}; 42 71 } 43 72 } 44 73 keys %{$self->properties}; 74 } 75 76 sub InitLabels { 77 my ( $self ) = @_; 78 79 map { 80 my $ctrl =$self->FindWindow($_); 81 #printf("ctrl %s : %s\n", $_, $ctrl); 82 if(defined $ctrl){ 83 # checkbox, static text 84 $ctrl->SetLabel( 85 $self->properties->{$_}->{label} 86 ) if exists $self->properties->{$_}->{label}; 87 88 # radiobox 89 my $labels =$self->properties->{$_}->{labels}; 90 $labels||=[]; 91 for(my $i=0; $i < scalar @$labels ; $i++){ 92 $ctrl->SetItemLabel($i, $labels->[$i]); 93 } 94 } 95 } 96 keys %{$self->properties}; 97 45 98 } 46 99 … … 66 119 keys %{$self->properties}; 67 120 } 121 68 122 1; -
extensions/pLoader/trunk/src/Uploader/GUI/wxChoiceFilteredPanel.pm
r4094 r4475 65 65 66 66 67 my $self = $class->SUPER::new( $params->{parentwnd}, -1, wxDefaultPosition, wxDefaultSize );67 my $self = $class->SUPER::new( $params->{parentwnd}, $params->{id}||-1, wxDefaultPosition, wxDefaultSize ); 68 68 $self->_init_panel; 69 69 $self->_init_properties($params); 70 70 printf("%s, %s\n", $self, $self->GetId); 71 71 $self->Refresh; 72 72 … … 86 86 87 87 $self->choices( 88 $params->{choices} 88 $params->{choices}|| sub { [] } 89 89 ); 90 90 91 91 $self->selection( 92 $params->{selection} 93 ); 94 95 my $choices = $self->choices->() ||[];92 $params->{selection}|| sub{ [] } 93 ); 94 95 my $choices = $self->choices->(); 96 96 $self->search_result( 97 97 [] … … 136 136 137 137 $self->listchoices( 138 Wx::CheckListBox->new( $self, -1, wxDefaultPosition, [320, 300], [], 0 )138 Wx::CheckListBox->new( $self, -1, wxDefaultPosition, [320,200], [], 0 ) 139 139 ); 140 140 $vsizer->AddWindow( $self->listchoices, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2 ); -
extensions/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm
r4468 r4475 127 127 piwigo_tags 128 128 image_tags 129 piwigo_photo_properties 130 dlg_piwigo_photo_properties 131 piwigo_photo_properties_tags 129 132 /; 130 133 __PACKAGE__->mk_accessors( @properties ); … … 156 159 use Storable; 157 160 use Uploader::GUI::wxPropertyGridPanel; 161 use Uploader::GUI::wxPhotoProperties; 158 162 use utf8; 159 163 $|=1; … … 323 327 sub _set_setting_properties { 324 328 my ( $self ) = @_; 325 329 330 $self->piwigo_photo_properties( 331 { 332 $main::CAPTION => { label=>gettext("Photo caption :")}, 333 $main::PHOTO_PROPERTIES_CAPTION => { 334 value => sub { $self->imagelist->current_image->site_name(@_) }, 335 frame_callback => sub { $self->imageviewer->Refresh() }, 336 }, 337 $main::COMMENT => { label=>gettext("Comment :")}, 338 $main::PHOTO_PROPERTIES_COMMENT => { 339 value => sub { $self->imagelist->current_image->site_comment(@_) }, 340 }, 341 $main::AUTHOR => { label=>gettext("Author :")}, 342 $main::PHOTO_PROPERTIES_AUTHOR => { 343 value => sub { $self->imagelist->current_image->site_author(@_) }, 344 }, 345 $main::TAGS => { label=>gettext("Tags :")}, 346 $main::CREATE_DATE => { label=>gettext("Create date :")}, 347 $main::PHOTO_PROPERTIES_CREATE_DATE => { 348 value => sub { $self->imagelist->current_image->create_date(@_) }, 349 }, 350 $main::PRIVACY_LEVEL => { label=>gettext("Privacy level :")}, 351 } 352 ); 326 353 327 354 $self->piwigo_properties( … … 663 690 $self->advanced_settings_panel, 664 691 $self->watermark_settings_panel, 692 $self->piwigo_photo_properties_tags 665 693 ); 666 694 … … 710 738 sub _refresh_settings_panels_properties { 711 739 my ( $self ) = @_; 740 741 $self->dlg_piwigo_photo_properties->properties( 742 $self->piwigo_photo_properties 743 ); 712 744 713 745 $self->image_prop_piwigo->properties( … … 748 780 sub _init_settings_panels { 749 781 my ( $self ) = @_; 750 751 782 752 783 $self->image_prop_piwigo( … … 834 865 ); 835 866 867 $self->dlg_piwigo_photo_properties( 868 Uploader::GUI::wxPhotoProperties->new( 869 { 870 parentwnd => $self, 871 properties => $self->piwigo_photo_properties, 872 tags => { 873 id => $main::PHOTO_PROPERTIES_TAG, 874 choices => $self->piwigo_tags, 875 selection => $self->image_tags, 876 creation_callback => sub { $self->_create_piwigo_tag(@_) }, 877 }, 878 } 879 ) 880 ); 881 882 $self->piwigo_photo_properties_tags( 883 $self->dlg_piwigo_photo_properties->FindWindow($main::PHOTO_PROPERTIES_TAG) 884 ); 885 836 886 837 887 $self->general_settings_panel->Show(0); … … 845 895 ); 846 896 847 897 $self->image_preview->Show(0); 848 898 $self->image_prop_piwigo->Show(0); 849 850 899 $self->image_prop_exif->Show(0); 851 900 … … 916 965 ->CenterPane->Resizable->CloseButton(0) ); 917 966 967 $self->manager->AddPane( 968 $self->dlg_piwigo_photo_properties, 969 Wx::AuiPaneInfo->new->Name( "piwigo_photo_properties" ) 970 ->Right->Position( 0 )->Resizable->CloseButton(0) 971 ); 918 972 919 973 $self->manager->AddPane( 920 974 $self->create_tree, 921 975 Wx::AuiPaneInfo->new->Name( "categories" ) 922 ->Right->Position( 0)->Resizable->CloseButton(0),976 ->Right->Position( 1 )->Resizable->CloseButton(0), 923 977 ); 924 978 … … 947 1001 } 948 1002 else { 949 $self->manager->GetPane("categories")->MinSize(300,100); 1003 $self->manager->GetPane("piwigo_photo_properties")->MinSize(600,350); 1004 $self->manager->GetPane("categories")->MinSize(600,100); 950 1005 951 1006 $self->manager->GetPane("tb1")->Caption( gettext("Tools") ); … … 1169 1224 } 1170 1225 @$images; 1171 1172 1226 1173 1227 $self->tree( 1174 1228 Wx::TreeCtrl->new( … … 1185 1239 1186 1240 $self->tree->SetImageList( $self->treeimglist ); 1187 $self->populate_tree_categories if !wxTheApp->use_offline;1241 $self->populate_tree_categories($self->tree) if !wxTheApp->use_offline; 1188 1242 $self->tree ; 1189 1243 } … … 1191 1245 1192 1246 sub populate_tree_categories { 1193 my ( $self ) = @_;1247 my ( $self, $tree ) = @_; 1194 1248 1195 1249 $self->populate_tree( 1196 $ self->tree,1250 $tree, 1197 1251 wxTheApp->pwg->categories, 1198 1252 ) if defined wxTheApp->pwg ; 1199 1253 1200 #$self->tree->ExpandAll;1201 1254 1202 1255 } … … 1709 1762 1710 1763 $event->Skip; 1764 1711 1765 } 1712 1766 … … 1726 1780 } 1727 1781 1782 $self->dlg_piwigo_photo_properties->SetProperties; 1728 1783 $self->image_prop_piwigo->Refresh; 1729 1784 $self->image_prop_exif->Refresh; 1730 1785 $self->image_prop_tags->Refresh; 1786 $self->piwigo_photo_properties_tags->Refresh; 1731 1787 1732 1788 } -
extensions/pLoader/trunk/src/Uploader/GUI/wxImageReuploadDlg.pm
r4469 r4475 51 51 $params->{properties} 52 52 ); 53 53 $self->InitLabels(); 54 54 $self->SetProperties(); 55 55 $self->_initEventHandlers(); … … 70 70 EVT_BUTTON( $self, $main::ID_REUPLOAD_OK, \&OnOK ); 71 71 EVT_CLOSE( $self, \&OnClose ); 72 73 74 72 } 75 73
Note: See TracChangeset
for help on using the changeset viewer.