[Catalyst-commits] r7631 - in trunk/Catalyst-Engine-Wx:
demo/lib/SampleApp/Controller
demo/lib/SampleApp/Controller/Test demo/lib/SampleAppWx
lib/Catalyst/Engine lib/Catalyst/Helper/View lib/Catalyst/Log
lib/Catalyst/View
eriam at dev.catalyst.perl.org
eriam at dev.catalyst.perl.org
Thu Apr 24 20:08:05 BST 2008
Author: eriam
Date: 2008-04-24 20:08:04 +0100 (Thu, 24 Apr 2008)
New Revision: 7631
Modified:
trunk/Catalyst-Engine-Wx/demo/lib/SampleApp/Controller/Root.pm
trunk/Catalyst-Engine-Wx/demo/lib/SampleApp/Controller/Test/And.pm
trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/default.pm
trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/display.pm
trunk/Catalyst-Engine-Wx/lib/Catalyst/Engine/Wx.pm
trunk/Catalyst-Engine-Wx/lib/Catalyst/Helper/View/WxApp.pm
trunk/Catalyst-Engine-Wx/lib/Catalyst/Log/Wx.pm
trunk/Catalyst-Engine-Wx/lib/Catalyst/View/WxHtmlEasyPrinting.pm
Log:
change the way view works
Modified: trunk/Catalyst-Engine-Wx/demo/lib/SampleApp/Controller/Root.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/demo/lib/SampleApp/Controller/Root.pm 2008-04-24 19:05:32 UTC (rev 7630)
+++ trunk/Catalyst-Engine-Wx/demo/lib/SampleApp/Controller/Root.pm 2008-04-24 19:08:04 UTC (rev 7631)
@@ -13,7 +13,8 @@
$c->stash->{books} = [$c->model('SampleAppDB::Book')->all];
- $c->forward('SampleApp::View::Wx');
+ $c->forward( $c->component('Wx') );
}
+
1;
Modified: trunk/Catalyst-Engine-Wx/demo/lib/SampleApp/Controller/Test/And.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/demo/lib/SampleApp/Controller/Test/And.pm 2008-04-24 19:05:32 UTC (rev 7630)
+++ trunk/Catalyst-Engine-Wx/demo/lib/SampleApp/Controller/Test/And.pm 2008-04-24 19:08:04 UTC (rev 7631)
@@ -9,7 +9,8 @@
sub display : Local {
my ( $self, $c ) = @_;
- $c->stash->{class} = 'display';
- $c->forward('SampleApp::View::Wx');
+ #$c->stash->{class} = 'display';
+
+ $c->forward( $c->component('Wx') );
}
1;
Modified: trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/default.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/default.pm 2008-04-24 19:05:32 UTC (rev 7630)
+++ trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/default.pm 2008-04-24 19:08:04 UTC (rev 7631)
@@ -6,9 +6,9 @@
use Wx ':everything';
use Catalyst::Engine::Wx::Event qw(
- EVT_QUIT
- EVT_CLOSE
- EVT_LIST_ITEM_ACTIVATED
+ CAT_EVT_QUIT
+ CAT_EVT_CLOSE
+ CAT_EVT_LIST_ITEM_ACTIVATED
);
use base 'Wx::Frame';
@@ -49,12 +49,20 @@
Wx::LogMessage( "Welcome to Catalyst::Engine::Wx !" );
- EVT_LIST_ITEM_ACTIVATED( $self, $list_ctrl, 'Test::And->display' );
- EVT_CLOSE( $self, sub { EVT_QUIT; } );
+ CAT_EVT_LIST_ITEM_ACTIVATED( $self, $list_ctrl, 'Test::And->display' );
+ CAT_EVT_CLOSE( $self, sub { CAT_EVT_QUIT; } );
return 1;
}
+sub display {
+ my ($self, $catalyst, $c ) = @_;
+
+ print " method display of $self !! \n";
+
+ Wx::MessageBox('Hello world', 'Hello' );
+}
+
1;
Modified: trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/display.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/display.pm 2008-04-24 19:05:32 UTC (rev 7630)
+++ trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/display.pm 2008-04-24 19:08:04 UTC (rev 7631)
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Wx ':everything';
+#use Wx ':everything';
sub new {
my ($class, $catalyst, $c ) = @_;
Modified: trunk/Catalyst-Engine-Wx/lib/Catalyst/Engine/Wx.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/lib/Catalyst/Engine/Wx.pm 2008-04-24 19:05:32 UTC (rev 7630)
+++ trunk/Catalyst-Engine-Wx/lib/Catalyst/Engine/Wx.pm 2008-04-24 19:08:04 UTC (rev 7631)
@@ -30,6 +30,9 @@
sub run {
my ( $self, $class, $options ) = @_;
+
+
+#print "OK\n";
$options ||= {};
$self->{bootstrap} = delete $options->{bootstrap} || '/';
@@ -64,6 +67,7 @@
my $locale = Wx::Locale->new( Wx::Locale::GetSystemLanguage );
Wx::InitAllImageHandlers();
$app = Wx::SimpleApp->new;
+
POE::Kernel->loop_run();
POE::Kernel->run();
Modified: trunk/Catalyst-Engine-Wx/lib/Catalyst/Helper/View/WxApp.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/lib/Catalyst/Helper/View/WxApp.pm 2008-04-24 19:05:32 UTC (rev 7630)
+++ trunk/Catalyst-Engine-Wx/lib/Catalyst/Helper/View/WxApp.pm 2008-04-24 19:08:04 UTC (rev 7631)
@@ -71,10 +71,11 @@
=head1 DESCRIPTION
-This helper module creates a Wx View module. It goes further than
-Catalyst::Helper::View::Wx in that it creates a folder to hold
-your Wx classes.
+This helper module creates a Wx View module. It creates also
+a sample window with some controls to get you started.
+You can also use other helpers to get other applications skeletons.
+
It also build
=head2 METHODS
@@ -237,7 +238,7 @@
use strict;
use warnings;
-use Wx qw[ :everything ];
+#use Wx qw[ :everything ];
require [% app %];
use Catalyst::Log::Wx;
@@ -248,4 +249,4 @@
bootstrap => 'Root->default',
});
-1;
\ No newline at end of file
+1;
Modified: trunk/Catalyst-Engine-Wx/lib/Catalyst/Log/Wx.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/lib/Catalyst/Log/Wx.pm 2008-04-24 19:05:32 UTC (rev 7630)
+++ trunk/Catalyst-Engine-Wx/lib/Catalyst/Log/Wx.pm 2008-04-24 19:08:04 UTC (rev 7631)
@@ -48,29 +48,39 @@
sub new {
my $class = shift;
my $self = $class->SUPER::new;
+
+
+ print "new \n";
+ my $locale = Wx::Locale->new( Wx::Locale::GetSystemLanguage );
+ Wx::InitAllImageHandlers();
+my $app = Wx::SimpleApp->new;
+eval {
$self->levels( scalar(@_) ? @_ : keys %LEVELS );
-
- $self->frame(Wx::Frame->new( undef, -1, 'Catalyst::Log::Wx', wxDefaultPosition, [600,400], wxDEFAULT_FRAME_STYLE ));
- $self->frame->{reloader} = Wx::TextCtrl->new($self->frame, -1, "", wxDefaultPosition, wxDefaultSize, );
- $self->frame->{logger} = Wx::TextCtrl->new($self->frame, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY);
-
+ $self->frame(Wx::Frame->new( undef, -1, 'Catalyst::Log::Wx', wxDefaultPosition, [600,400], wxDEFAULT_FRAME_STYLE ));
+## $self->frame->{reloader} = Wx::TextCtrl->new($self->frame, -1, "", wxDefaultPosition, wxDefaultSize, );
+ $self->frame->{logger} = Wx::TextCtrl->new($self->frame, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY);
+#
my $log = Wx::LogTextCtrl->new( $self->frame->{logger} );
$self->frame->{old_log} = Wx::Log::SetActiveTarget( $log );
-
- $self->frame->{sizer_2} = Wx::BoxSizer->new(wxVERTICAL);
- $self->frame->{sizer_2}->Add($self->frame->{reloader}, 0, wxEXPAND, 0);
- $self->frame->{sizer_2}->Add($self->frame->{logger}, 4, wxEXPAND, 0);
- $self->frame->SetSizer($self->frame->{sizer_2});
- $self->frame->{sizer_2}->Fit($self->frame);
- $self->frame->Layout();
-
- Wx::Event::EVT_TEXT_ENTER($self->frame, $self->frame->{reloader}->GetId, \&_reload);
-
- $self->frame->SetSize(Wx::Size->new(600, 400));
- $self->frame->{logger}->SetFont(Wx::Font->new(8, wxMODERN, wxNORMAL, wxNORMAL, 0, ""));
-
- $self->frame->Show(1);
+#
+# $self->frame->{sizer_2} = Wx::BoxSizer->new(wxVERTICAL);
+# $self->frame->{sizer_2}->Add($self->frame->{reloader}, 0, wxEXPAND, 0);
+# $self->frame->{sizer_2}->Add($self->frame->{logger}, 4, wxEXPAND, 0);
+# $self->frame->SetSizer($self->frame->{sizer_2});
+# $self->frame->{sizer_2}->Fit($self->frame);
+# $self->frame->Layout();
+#
+## Wx::Event::EVT_TEXT_ENTER($self->frame, $self->frame->{reloader}->GetId, \&_reload);
+#
+# $self->frame->SetSize(Wx::Size->new(600, 400));
+# $self->frame->{logger}->SetFont(Wx::Font->new(8, wxMODERN, wxNORMAL, wxNORMAL, 0, ""));
+#
+ $self->frame->Show(1)
+ if $ENV{CATALYST_DEBUG} == 1;
+ };
+ print "done \n";
+
return $self;
}
@@ -100,17 +110,24 @@
my $level = shift;
my $message = join( "\n", @_ );
chomp($message);
-
- $self->frame->{logger}->WriteText($message."\n");
+eval {
+ if ($level eq 'error' or $level eq 'fatal') {
+ Wx::MessageBox($message, $level);
+ }
+ else {
+ $self->frame->{logger}->WriteText($message."\n")
+ if $ENV{CATALYST_DEBUG} == 1;
+ }
+ };
}
-sub _reload {
- my ($self, $event) = @_;
-
- EVT($self, $self->{reloader}->GetValue);
-
- $event->Skip;
-}
+#sub _reload {
+# my ($self, $event) = @_;
+#
+# EVT($self, $self->{reloader}->GetValue);
+#
+# $event->Skip;
+#}
1;
__END__
Modified: trunk/Catalyst-Engine-Wx/lib/Catalyst/View/WxHtmlEasyPrinting.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/lib/Catalyst/View/WxHtmlEasyPrinting.pm 2008-04-24 19:05:32 UTC (rev 7630)
+++ trunk/Catalyst-Engine-Wx/lib/Catalyst/View/WxHtmlEasyPrinting.pm 2008-04-24 19:08:04 UTC (rev 7631)
@@ -6,8 +6,6 @@
use base qw/Catalyst::View/;
-use Wx::Html;
-
our $VERSION = "0.02_05";
=head1 NAME
@@ -18,9 +16,15 @@
=cut
sub new {
- my ( $class, $c, $arguments ) = @_;
+ my ( $class, $c, $arguments ) = @_;
my $self = bless {}, $class;
+ if ($ENV{CATALYST_ENGINE} eq 'Wx') {
+ eval {
+ require Wx::Html;
+ };
+ }
+
return $self;
}
More information about the Catalyst-commits
mailing list