Changeset 4632 for extensions/pLoader/trunk/src/Uploader/GUI/wxApp.pm
- Timestamp:
- Jan 8, 2010, 4:41:15 PM (14 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.