Wx/App.pm

filter: Statementstmt 33.3% 1 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 50.0% 2 / 4 CC 1 SCAR 2.6
CC
1
Cov
33%
BEGIN
1.3
CRAP 1.3
« Wx/cpan_connector.pm ↑ Summary Wx/Configure.pm »
1 package CPANPLUS::Shell::Wx::App;
2 0 ▶use Wx qw(wxBITMAP_TYPE_BMP wxSPLASH_CENTRE_ON_SCREEN wxSPLASH_NO_TIMEOUT wxSIMPLE_BORDER
Subroutine BEGIN: called CC=1 SCAR=2.6
3 0 wxFRAME_NO_TASKBAR wxSTAY_ON_TOP);
4 use Wx::XRC;
5 use Cwd;
6 use Data::Dumper;
7 use CPANPLUS::Shell::Wx::Frame;
8 use CPANPLUS::Shell::Wx::util;
9  
10 #enable gettext support
11 use Wx::Locale gettext => '_T';
12  
13 BEGIN {
14 use vars qw( @ISA $VERSION );
15 @ISA = qw( Wx::App);
16 $VERSION = '0.01';
17 }
18  
19 use base 'Wx::App';
20  
21 #create a new app instance
22 sub new {
23 my( $class, $parent ) = @_;
24 print _T("Creating new CPANPLUS::Shell::Wx::App...\n");
25 my $self = $class->SUPER::new( $parent );
26 return $self;
27 }
28  
29 #initialize the app
30 sub OnInit{
31 my $self=shift;
32  
33 #create splaashscreen
34 my $splashImage=Wx::Bitmap->new(_uGetInstallPath('CPANPLUS::Shell::Wx::res::splash.bmp'),wxBITMAP_TYPE_BMP );
35 $self->{splash}=Wx::SplashScreen->new(
36 $splashImage, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_NO_TIMEOUT,10000,undef);
37  
38  
39 print _T("Creating new CPANPLUS::Shell::Wx::Frame...\n");
40 #ensure we are working with a valid files
41 my $xrc_file = _uGetInstallPath('CPANPLUS::Shell::Wx::res::MainWin.xrc');
42 print _T("Locating XRC File: $xrc_file...");
43 unless ( -e $xrc_file ) {
44 print _T("[ERROR]\n\tUnable to find XRC Resource file!\n\tExiting...\n");
45 return 1;
46 }
47 print _T("[Done]\nCreating New Frame and Loading XRC File...");
48  
49 #create frame from xrc file
50 $self->{xresWin} = Wx::XmlResource->new();
51 Wx::XmlResource::AddSubclassFactory( CPANPLUS::Shell::Wx::Frame::XRCFactory->new );
52 $self->{xresWin}->InitAllHandlers();
53 $self->{xresWin}->Load($xrc_file);
54 my $mainWin=CPANPLUS::Shell::Wx::Frame->new($self); #CPANPLUS::Shell::Wx::Frame->new($self);
55 $self->{xresWin}->LoadFrame( $mainWin,undef, 'main_window' )
56 or return;
57 print _T("[Done]\n");
58  
59 #show the main window
60 $mainWin->Show(1);
61  
62 return 1;
63 }
64 1;
« Wx/cpan_connector.pm ↑ Summary Wx/Configure.pm »