Changeset 5261 for extensions/pLoader/trunk/src
- Timestamp:
- Mar 22, 2010, 5:16:48 PM (15 years ago)
- Location:
- extensions/pLoader/trunk/src/Uploader/GUI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pLoader/trunk/src/Uploader/GUI/Frame.pm
r5184 r5261 20 20 package Uploader::GUI::Frame; 21 21 use strict; 22 use Data::Dumper; 22 23 use Carp; 23 24 use Wx; 24 25 use Wx::DND; 25 26 use Wx qw/ 26 wxSP_3DBORDER27 wxSP_3D28 wxNO_FULL_REPAINT_ON_RESIZE29 27 wxCLIP_CHILDREN 30 28 wxYES_NO … … 32 30 wxICON_QUESTION 33 31 wxITEM_NORMAL 34 wxNullBitmap35 32 wxID_OK 36 33 wxDEFAULT_FRAME_STYLE … … 50 47 wxFD_OPEN 51 48 wxFD_MULTIPLE 52 wxLI_HORIZONTAL53 wxALIGN_CENTER_VERTICAL54 wxALIGN_CENTER_HORIZONTAL55 49 wxALL 56 50 wxGROW … … 59 53 wxTheApp 60 54 wxIMAGE_LIST_NORMAL 61 wxAUI_NB_TAB_MOVE62 wxAUI_NB_TAB_SPLIT63 55 wxNO_BORDER 64 56 wxTE_MULTILINE 65 57 wxTE_READONLY 66 58 wxITEM_NORMAL 67 wxCLIP_CHILDREN68 59 wxBORDER_NONE 69 60 wxNullBitmap … … 81 72 wxVERTICAL 82 73 wxEXPAND 74 wxSWISS 75 wxNORMAL 76 wxBOLD 77 wxALIGN_CENTER 83 78 /; 84 79 use base qw/Wx::Frame Class::Accessor::Fast/; … … 755 750 ); 756 751 752 $self->init_empty_category_msg; 753 $self->set_empty_tree_panel_evt_paint; 754 $self->show_pwg_categories_empty_msg; 757 755 758 756 $self->init_dnd_targets; … … 960 958 961 959 $self->tree->SetImageList( $self->treeimglist ); 962 $self->populate_tree_categories if !wxTheApp->use_offline; 960 if(wxTheApp->use_offline){ 961 $self->tree->Enable(0); 962 } 963 else{ 964 $self->populate_tree_categories ; 965 } 966 963 967 $self->tree ; 968 } 969 970 971 sub set_empty_tree_panel_evt_paint{ 972 my ( $self ) = @_; 973 Wx::Event::EVT_PAINT( $self->tree, sub { 974 my ( $tree, $event ) = @_; 975 if(exists $tree->{_empty_panel} and ! exists $tree->{_empty_panel}{_paint}){ 976 my ($w, $h) = $tree->GetSizeWH; 977 my ($x, $y) = $tree->{_empty_panel}->GetPositionXY; 978 979 $tree->{_empty_panel}{x} = $x if !exists $tree->{_empty_panel}{x} ; 980 $tree->{_empty_panel}{y} = $y if !exists $tree->{_empty_panel}{y}; 981 my ($wp, $hp) = $tree->{_empty_panel}->GetSizeWH; 982 my $x_off = ($w-$wp)/2 > 0 ? ($w-$wp)/2 : 0; 983 my $y_off = ($h-$hp)/2 > 0 ? ($h-$hp)/2 : 0; 984 $tree->{_empty_panel}->Move( 985 [ 986 $tree->{_empty_panel}{x}+$x_off, 987 $tree->{_empty_panel}{y}+$y_off 988 ] 989 ); 990 $tree->{_empty_panel}{_paint} = 1; 991 } 992 $event->Skip; 993 } 994 ) if 1; 995 996 } 997 998 999 sub init_empty_category_msg { 1000 1001 my ( $self ) = @_; 1002 # add a panel 1003 my $empty_panel = Wx::Panel->new($self->tree, -1, wxDefaultPosition, wxDefaultSize); 1004 my( $item0 ) = Wx::BoxSizer->new( wxVERTICAL ); 1005 1006 my $fb = Wx::Font->new( 12, wxSWISS, wxNORMAL, wxBOLD ); 1007 1008 1009 my( $item1 ) = Wx::Button->new( 1010 $empty_panel, 1011 $main::CATEGORIES_ADD, 1012 wxTheApp->branding->{'Add new category'}, 1013 wxDefaultPosition, 1014 [-1,40], 1015 0 1016 ); 1017 my $btfont = Wx::Font->new(12, wxSWISS, wxNORMAL, wxNORMAL ); 1018 $item1->SetFont($btfont); 1019 $item0->AddWindow( $item1, 0, wxALIGN_CENTER|wxALL, 5 ); 1020 1021 1022 $empty_panel->SetSizer( $item0 ); 1023 $item0->SetSizeHints( $empty_panel ); 1024 1025 $self->tree->{_empty_panel} = $empty_panel; 1026 $self->tree->{_empty_panel}->SetBackgroundColour(wxWHITE); 1027 1028 my ($wp, $hp) = $self->tree->{_empty_panel}->GetSizeWH; 1029 1030 $self->tree->SetMinSize( [20+$wp, -1 ]); 1031 1032 } 1033 1034 1035 sub pwg_categories_are_empty { 1036 my ( $self ) = @_; 1037 1038 scalar @{wxTheApp->pwg->categories} < 1 ? 1 : 0 ; 964 1039 } 965 1040 … … 972 1047 wxTheApp->pwg->categories, 973 1048 ) if defined wxTheApp->pwg ; 974 975 976 } 1049 } 1050 1051 1052 sub show_pwg_categories_empty_msg { 1053 my ( $self ) = @_; 1054 1055 if($self->pwg_categories_are_empty){ 1056 $self->tree->{_empty_panel}->Show(1); 1057 } 1058 else{ 1059 $self->tree->{_empty_panel}->Show(0); 1060 } 1061 } 1062 977 1063 978 1064 … … 1168 1254 Wx::Event::EVT_BUTTON( $self, $self->imageviewer->add_button->GetId, \&OnAddImages ); 1169 1255 1256 Wx::Event::EVT_BUTTON( $self, $main::CATEGORIES_ADD, \&OnAddCategories ); 1257 1170 1258 # only refresh when calling event is finished 1171 1259 Wx::Event::EVT_IDLE( … … 1440 1528 1441 1529 if($success){ 1530 $self->tree->{_empty_panel}->Show(0); 1442 1531 $self->_append_category($parent_item, $name, $content->{result}{id}); 1443 1532 } 1444 1533 } 1534 1535 1445 1536 $dialog->Destroy; 1446 1537 } … … 1462 1553 $self->pwg->RefreshCategories(); 1463 1554 $self->populate_tree_categories; 1555 $self->show_pwg_categories_empty_msg; 1464 1556 } 1465 1557 … … 1798 1890 return if !scalar @{$self->imagelist->sums}; 1799 1891 1800 if( scalar @{$self->imagelist->categories} ){ 1892 if( $self->destination_categories_are_empty ){ 1893 Wx::MessageBox( 1894 sprintf( 1895 "%s", 1896 wxTheApp->branding->{'What is the destination category?'} 1897 ), 1898 gettext("Piwigo upload error"), 1899 wxOK | wxICON_EXCLAMATION, 1900 ); 1901 1902 } 1903 else { 1801 1904 # all selected is implicit 1802 1905 if(!scalar @{$self->imageviewer->GetSelectedItems}){ … … 1837 1940 } 1838 1941 } 1839 else { 1840 Wx::MessageBox( 1841 sprintf( 1842 "%s", 1843 wxTheApp->branding->{'What is the destination category?'} 1844 ), 1845 gettext("Piwigo upload error"), 1846 wxOK | wxICON_EXCLAMATION, 1847 ); 1848 } 1942 } 1943 1944 1945 sub destination_categories_are_empty { 1946 my ( $self ) = @_; 1947 1948 !scalar @{$self->imagelist->categories}; 1849 1949 } 1850 1950 -
extensions/pLoader/trunk/src/Uploader/GUI/Layout/PhotoPropertiesCategoriesTags.pm
r5184 r5261 111 111 use vars qw($PRIVACY_LEVEL); $PRIVACY_LEVEL = 10014; 112 112 use vars qw($PHOTO_PROPERTIES_PRIVACY_LEVEL); $PHOTO_PROPERTIES_PRIVACY_LEVEL = 10015; 113 113 114 114 115 sub photo_properties_caption_comments { … … 399 400 } 400 401 402 403 use vars qw($CATEGORIES_ADD); $CATEGORIES_ADD = 10020; 404 405 401 406 1; 402 407
Note: See TracChangeset
for help on using the changeset viewer.