Changeset 4632
- Timestamp:
- Jan 8, 2010, 4:41:15 PM (14 years ago)
- Location:
- extensions/pLoader/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pLoader/trunk/src/Uploader/GUI/wxApp.pm
r4616 r4632 113 113 privacy_level 114 114 user_defined_properties 115 bin_dir 116 resource_dir 117 locale_dir 115 118 / 116 119 ); … … 124 127 } 125 128 129 # not very clean but : 130 # at that moment, object is not yet instanciated 131 # only way : class variable 132 my $bin_dir; 133 my $resource_dir; 134 my $locale_dir; 135 sub new { 136 my ( $self, $params ) = @_; 137 138 $bin_dir = $params->{bin_dir}||'.'; 139 $locale_dir = $params->{locale_dir}||'.'; 140 $resource_dir = $params->{resource_dir}||'.'; 141 142 $self->SUPER::new(); 143 } 126 144 127 145 sub OnInit { 128 146 my( $self ) = @_; 129 147 148 $self->bin_dir( 149 $bin_dir 150 ); 151 152 $self->locale_dir( 153 $locale_dir 154 ); 155 156 $self->resource_dir( 157 $resource_dir 158 ); 159 130 160 $self->version( 131 161 '2.0.7b' … … 178 208 } 179 209 else { 180 $self->_readParams( 'pLoader.ini') unless defined $conf ;181 } 182 183 $self->_read_default_user_properties( 'properties.ini') ;210 $self->_readParams( $self->bin_path('pLoader.ini') ) unless defined $conf ; 211 } 212 213 $self->_read_default_user_properties( $self->bin_path('properties.ini') ) ; 184 214 185 215 $self->site_url( … … 233 263 } 234 264 265 266 # helper method to get the full path for a resource 267 sub resource_path{ 268 my ( $self, $file ) = @_; 269 270 File::Spec->catfile($self->bin_dir, '..', $self->resource_dir, $file); 271 } 272 273 sub bin_path{ 274 my ( $self, $file ) = @_; 275 276 File::Spec->catfile($self->bin_dir, $file); 277 } 278 279 sub locale_path{ 280 my ( $self, $file ) = @_; 281 282 File::Spec->catfile($self->bin_dir, '..', $self->locale_dir, $file); 283 } 284 285 sub locale_catalog_path{ 286 my ( $self, $file ) = @_; 287 288 File::Spec->catfile($self->bin_dir, '..', $self->locale_dir, $self->locale->GetCanonicalName, $file); 289 } 290 235 291 sub _set_stored_layout { 236 292 my ( $self ) = @_; … … 360 416 if(Wx::Locale::IsAvailable($_->[1])){ 361 417 my $locale = Wx::Locale->new($_->[1]); 362 $locale->AddCatalogLookupPathPrefix('../locale'); 418 $locale->AddCatalogLookupPathPrefix( 419 File::Spec->catfile($self->bin_dir, '..', $self->locale_dir) 420 ); 363 421 $_ if $locale->AddCatalog('pLoader'); 364 422 } … … 407 465 $self->current_language 408 466 ); 409 $locale->AddCatalogLookupPathPrefix( '../locale'); 467 $locale->AddCatalogLookupPathPrefix( 468 File::Spec->catfile($self->bin_dir, '..', $self->locale_dir) 469 ); 410 470 if(!$locale->AddCatalog( 'pLoader.mo' )){ 411 471 Wx::LogMessage gettext("Cannot find translation catalog files for %s. Use default language"), $locale->GetCanonicalName(); … … 592 652 593 653 my $icon = Wx::Icon->new(); 594 $icon->LoadFile('../res/favicon.ico', wxBITMAP_TYPE_ICO); 654 $icon->LoadFile( 655 File::Spec->catfile($self->bin_dir, '..', 'res', 'favicon.ico'), 656 wxBITMAP_TYPE_ICO 657 ); 595 658 $self->login_dlg->SetIcon($icon); 596 659 … … 934 997 935 998 my $icon = Wx::Icon->new(); 936 $icon->LoadFile('../res/favicon.ico', wxBITMAP_TYPE_ICO); 999 $icon->LoadFile( 1000 File::Spec->catfile( 1001 $self->bin_dir, '..', 'res', 'favicon.ico' 1002 ), 1003 wxBITMAP_TYPE_ICO 1004 ); 937 1005 $self->frame->SetIcon($icon); 938 1006 } -
extensions/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm
r4616 r4632 814 814 my ( $self ) = @_; 815 815 816 my $file = sprintf( 817 "../locale/%s/gs.html", 818 wxTheApp->locale->GetCanonicalName 819 ); 816 my $file = wxTheApp->locale_catalog_path('gs.html'); 820 817 821 818 $self->htmlhome( … … 1048 1045 } 1049 1046 ( 1050 '../res/tree_pwg.png',1051 '../res/tree_folder.png',1047 wxTheApp->resource_path('tree_pwg.png'), 1048 wxTheApp->resource_path('tree_folder.png'), 1052 1049 ) 1053 1050 ]; … … 1186 1183 "", 1187 1184 "", 1188 '../res/mnu_folder_new.png',1185 wxTheApp->resource_path('mnu_folder_new.png'), 1189 1186 ], 1190 1187 [ … … 1198 1195 wxTheApp->branding->{category}, 1199 1196 ), 1200 '../res/mnu_folder_new.png',1197 wxTheApp->resource_path('mnu_folder_new.png'), 1201 1198 ], 1202 1199 [ … … 1207 1204 wxTheApp->branding->{category}, 1208 1205 ), 1209 '../res/mnu_refresh.png',1206 wxTheApp->resource_path('mnu_refresh.png'), 1210 1207 ], 1211 1208 [ … … 1216 1213 wxTheApp->branding->{category}, 1217 1214 ), 1218 '../res/mnu_expandall.png',1215 wxTheApp->resource_path('mnu_expandall.png'), 1219 1216 ], 1220 1217 [ … … 1225 1222 wxTheApp->branding->{category}, 1226 1223 ), 1227 '../res/mnu_collapseall.png',1224 wxTheApp->resource_path('mnu_collapseall.png'), 1228 1225 ], 1229 1226 ); … … 1251 1248 "", 1252 1249 "", 1253 '../res/mnu_properties.png',1250 wxTheApp->resource_path('mnu_properties.png'), 1254 1251 ], 1255 1252 [ … … 1257 1254 gettext("Properties"), 1258 1255 gettext("Modify photo properties"), 1259 '../res/mnu_properties.png',1256 wxTheApp->resource_path('mnu_properties.png'), 1260 1257 ], 1261 1258 [ … … 1263 1260 gettext("Preview"), 1264 1261 gettext("Display photo preview"), 1265 '../res/mnu_preview.png',1262 wxTheApp->resource_path('mnu_preview.png'), 1266 1263 ], 1267 1264 ); … … 1957 1954 100, 1958 1955 gettext("Getting started"), 1959 '../res/tb_getting_started.png',1956 wxTheApp->resource_path('tb_getting_started.png'), 1960 1957 wxBITMAP_TYPE_PNG, 1961 1958 1, 1962 '../res/tb_getting_started.png',1959 wxTheApp->resource_path('tb_getting_started.png'), 1963 1960 gettext("Display getting started panel") 1964 1961 ], … … 1966 1963 101, 1967 1964 gettext("Add photo to selection"), 1968 '../res/tb_add.png',1965 wxTheApp->resource_path('tb_add.png'), 1969 1966 wxBITMAP_TYPE_PNG, 1970 1967 1, 1971 '../res/tb_add.png',1968 wxTheApp->resource_path('tb_add.png'), 1972 1969 gettext("Add photo to selection for resizing and uploading") 1973 1970 ], … … 1975 1972 102, 1976 1973 gettext("Remove photo from selection"), 1977 '../res/tb_remove.png',1974 wxTheApp->resource_path('tb_remove.png'), 1978 1975 wxBITMAP_TYPE_PNG, 1979 1976 1, 1980 '../res/tb_remove.png',1977 wxTheApp->resource_path('tb_remove.png'), 1981 1978 gettext("Remove photo from selection. Files are not deleted ") 1982 1979 ], … … 1984 1981 103, 1985 1982 gettext("Upload to Piwigo"), 1986 '../res/tb_upload.png',1983 wxTheApp->resource_path('tb_upload.png'), 1987 1984 wxBITMAP_TYPE_PNG, 1988 1985 wxTheApp->use_offline ? 0 : 1, 1989 '../res/tb_upload.png',1986 wxTheApp->resource_path('tb_upload.png'), 1990 1987 gettext("Upload photos to Piwigo.") 1991 1988 ], … … 1993 1990 104, 1994 1991 gettext("Global settings"), 1995 '../res/tb_settings.png',1992 wxTheApp->resource_path('tb_settings.png'), 1996 1993 wxBITMAP_TYPE_PNG, 1997 1994 0, 1998 '../res/tb_settings.png',1995 wxTheApp->resource_path('tb_settings.png'), 1999 1996 gettext("Change global settings.") 2000 1997 ], … … 2002 1999 105, 2003 2000 gettext("Language choice"), 2004 '../res/tb_i18n.png',2001 wxTheApp->resource_path('tb_i18n.png'), 2005 2002 wxBITMAP_TYPE_PNG, 2006 2003 1, 2007 '../res/tb_i18n.png',2004 wxTheApp->resource_path('tb_i18n.png'), 2008 2005 gettext("Language choice") 2009 2006 ], … … 2169 2166 } 2170 2167 2168 2171 2169 1; -
extensions/pLoader/trunk/src/Uploader/GUI/wxImageListCtrl.pm
r4588 r4632 46 46 wxLIST_STATE_FOCUSED 47 47 wxIMAGE_LIST_SMALL 48 wxTheApp 48 49 /; 49 50 use Wx::Event qw/ … … 90 91 ); 91 92 $self->wx_img->Add( 92 Wx::Bitmap->new( '../res/image.png', wxBITMAP_TYPE_PNG )93 Wx::Bitmap->new( wxTheApp->resource_path('image.png'), wxBITMAP_TYPE_PNG ) 93 94 ); 94 95 -
extensions/pLoader/trunk/src/ploader.pl
r4590 r4632 20 20 21 21 use strict; 22 use FindBin; 23 use lib "$FindBin::Bin"; 24 use lib "$FindBin::Bin/../res"; 25 use lib "$FindBin::Bin/../lib"; 22 26 use Wx; 23 27 use Class::Accessor::Fast; … … 29 33 $SIG{__DIE__} = \&OnDieHandler; 30 34 31 require '../res/global_settings_wdr.pl'; 32 require '../res/progress_wdr.pl'; 33 require '../res/login_wdr.pl'; 34 require '../res/reupload_wdr.pl'; 35 require '../res/photo_properties_wdr.pl'; 35 # search path defined by use lib "$Bin/../res" 36 require 'global_settings_wdr.pl'; 37 require 'progress_wdr.pl'; 38 require 'login_wdr.pl'; 39 require 'reupload_wdr.pl'; 40 require 'photo_properties_wdr.pl'; 36 41 37 42 eval { 38 my $app = Uploader::GUI::wxApp->new(@_); 43 my $app = Uploader::GUI::wxApp->new( 44 { 45 bin_dir => $FindBin::Bin, 46 resource_dir => 'res', 47 locale_dir => 'locale', 48 } 49 ); 39 50 $app->MainLoop(); 40 51 };
Note: See TracChangeset
for help on using the changeset viewer.